Credentials
Nothing for reading. Two headers for trading.
Reading needs nothing at all. Markets, candles, the order book, the tape, funding, swap quotes and the leaderboard all answer an unauthenticated request. If all you want is an agent that talks about markets, stop here.
Anything about your account, your positions or your orders needs two values, sent as headers on every request:
| Header | Value |
|---|---|
| x-account-id | Your account id: 0x and 64 hex characters |
| x-trading-key | Your trading key: a 32 byte secret, as hex |
curl -X POST https://swapmos.com/mcp \
-H 'content-type: application/json' \
-H 'x-account-id: 0x<64 hex characters>' \
-H 'x-trading-key: <32 byte hex secret>' \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call",
"params":{"name":"list_positions","arguments":{}}}'On the local server the same two values are environment variables, SWAPMOS_ACCOUNT_ID and SWAPMOS_TRADING_KEY, set in the config block beside SWAPMOS_API_URL. Both are needed. One without the other stays read-only, because a key with no account id cannot sign anything, and reporting otherwise would let an agent plan around tools that always fail.
Where they come from
- 1Open Swapmos in a browser and connect the wallet you want to trade from.
- 2Go to the futures terminal and press Enable trading. The wallet signs, which registers the account and binds a trading key your browser generated.
- 3Copy the account id and the trading key from the account panel into your agent's configuration.
The trading key is not a wallet key
This distinction is the whole security model, and it is worth being exact about.
- It is not a wallet private key and not a seed phrase. This server never accepts one, and no tool has a field for it. If any tool or document ever asks you for a seed phrase, that is not this software.
- It can place orders, cancel orders and close positions. That is its entire scope.
- It cannot withdraw or transfer funds. A withdrawal is signed by the wallet itself, which only happens in a browser, and no tool here moves money off the exchange.
- It expires, and it can be revoked in the app at any time without touching the wallet.
- Your balances belong to the account, not to the key. Losing the key never loses funds.
When they are missing
A credentialed tool called without headers fails with the code unauthorized and a sentence naming what is absent. It does not fall back to a demo account and it does not guess. The same code comes back when a key has expired, in which case enable trading again in the app and copy the new one.
Credentials are read per request and never stored. The endpoint keeps no session, so an agent acting for two accounts simply sends different headers.