Skip to content

Connecting Your Terminal

The endpoint is /api/mcp on the same host you open the terminal on: if the terminal's address is https://your-terminal-host/trade, the endpoint is https://your-terminal-host/api/mcp. The examples below keep it in an environment variable:

export E8_MCP_ENDPOINT="https://your-terminal-host/api/mcp"   # your terminal's host

The server name e8-terminal, the e8_ prefix on tools and API keys, and the E8_API_KEY variable are the identifiers the terminal itself uses — its own generated client config uses the same names. Keep them as written.

You need a credential. There is no anonymous access — every tool call, including simple price lookups, requires either an API key or an OAuth connection.

OAuth API key
How you get it Browser approval, once Minted at /settings
Best for Daily interactive use Cron jobs, servers, CI, headless scripts
Expiry Access token refreshes automatically Until you revoke it
Scope control You approve a scope list on screen Full scopes by default — see Safety & Limits
Rate limit 60/min, 10,000/day Set per key

If a browser is available where the agent runs, use OAuth. If not — a server, a cron job, a container — use an API key.


Claude Code

OAuth

claude mcp add --transport http e8-terminal "$E8_MCP_ENDPOINT"

On first use, Claude Code opens your browser to the terminal's consent screen listing the permissions being requested. Approve it and the connection is live. Check it:

claude mcp list

API key

For anything headless. Mint a key at /settings → API Keys, then:

export E8_API_KEY="e8_..."

claude mcp add --transport http e8-terminal "$E8_MCP_ENDPOINT" \
  --header "Authorization: Bearer $E8_API_KEY"

Keep the key in an environment variable or a secret manager. Never commit it.

First call

claude -p "Using the e8-terminal tools, list my trading accounts with balance and equity."

Cursor

Add the server to ~/.cursor/mcp.json for all projects, or .cursor/mcp.json inside one project. Replace your-terminal-host with your terminal's host:

{
  "mcpServers": {
    "e8markets": {
      "url": "https://your-terminal-host/api/mcp",
      "headers": {
        "Authorization": "Bearer ${E8_API_KEY}"
      }
    }
  }
}

Set E8_API_KEY in your shell environment before launching Cursor. Restart Cursor after editing the file, then check that the server shows as connected under Settings → MCP.


Claude Desktop and other MCP clients

The same block works for Claude Desktop, Windsurf, Zed, and anything else that reads a standard mcpServers map. On macOS, Claude Desktop's config lives at:

~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "e8markets": {
      "url": "https://your-terminal-host/api/mcp",
      "headers": {
        "Authorization": "Bearer e8_your_key_here"
      }
    }
  }
}

Replace your-terminal-host as above. Quit and reopen the app after editing. Desktop clients read config only at launch.


Raw HTTP — any harness

If you are driving MCP from your own script, another agent framework, or a workflow tool, talk to the endpoint directly. It is JSON-RPC 2.0 over HTTP.

Two headers matter on every request:

Authorization: Bearer $E8_API_KEY
Accept: application/json, text/event-stream

The Accept header is not optional — the transport rejects requests that do not offer text/event-stream.

List the tools

tools/list needs no session:

curl -s "$E8_MCP_ENDPOINT" \
  -H "Authorization: Bearer $E8_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | jq '.result.tools | length'

That prints the number of tools available to your credential. Treat the tool list as the source of truth — it changes as tools are added and retired, so read it rather than relying on a count written down anywhere, including here.

Call a tool

tools/call needs no session either, but it does require the Authorization header:

curl -s "$E8_MCP_ENDPOINT" \
  -H "Authorization: Bearer $E8_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": {
      "name": "e8_trade_asset_get",
      "arguments": { "symbol": "EURUSD" }
    }
  }' | jq -r '.result.content[0].text'

That is the whole contract. Change name and arguments and you can reach every tool.

Sessions

You can also open a stateful session with initialize, which returns an mcp-session-id header to pass on subsequent calls. You rarely need it — the stateless calls above are simpler and survive server restarts. Use sessions only if your client requires the full MCP handshake.


Verify it works

Run scripts/smoke-test.sh:

export E8_API_KEY="e8_..."
export E8_MCP_ENDPOINT="https://your-terminal-host/api/mcp"
./smoke-test.sh

Expected output:

✓ Endpoint reachable
✓ Credential accepted
✓ 24 tools available
✓ Market data readable    (EURUSD @ 1.08432)
✓ Account data readable   (2 accounts)
⚠ trade:execute present   — this key can place and close orders

The tool count is whatever your credential can currently see; it moves as tools are added and retired, so do not treat the number above as a target.

That last line is a warning, not an error. See Safety & Limits if you did not intend it.


When it does not work

401 with a WWW-Authenticate header. Your credential was rejected or missing. The response carries a pointer to the OAuth metadata:

WWW-Authenticate: Bearer realm="E8Markets MCP API", resource_metadata="..."

Check that the key starts with e8_, that your environment variable actually expanded, and that the key has not been revoked in settings.

429 with a Retry-After header. You exceeded 60 calls in a minute or 10,000 in a day. The header tells you how many seconds to wait. If a loop is hitting this, it is polling too fast — see the rate-limit budgeting section in Safety & Limits.

HTML instead of JSON. If the response body is a web page rather than JSON, you have hit an edge-security challenge before reaching the API. This is not a credential problem and retrying will not help. Report it to support — see Troubleshooting & Support.

-32601 Method not found. Your client sent a method the endpoint does not serve statelessly. Either send initialize first to open a session, or stick to tools/list, tools/call, and ping.

A tool returns "Insufficient permissions". Your credential is valid but lacks the scope that tool requires. The error names the missing scope. See the scope table in Safety & Limits.

A market-data tool errors on a symbol you know exists. Treat this as a data-source failure, not a missing symbol. Market data reaches the MCP server through an upstream price feed, and when that path is degraded the tools error rather than returning empty results. Retrying the same call, or trying a different symbol or timeframe, will not help.

Two rules follow for anything automated:

  • Never convert a tool error into "no data". A monitoring loop that reports "EURUSD unavailable" when the feed is down looks identical to one reporting a genuine gap. Log the error text.
  • Never retry an authentication error. A rejected credential is rejected for every symbol and every timeframe. Fail loudly and stop; retrying just burns your rate limit.

Next: Tool Reference for what you can call, or Recipes to start building.