Skip to content

Connect an Agent

Use the MCP URL of the network you want — https://mcp.testnet.rubin.trade/mcp or https://mcp.mainnet.rubin.trade/mcp. The examples below use mainnet and the server name Rubin Mainnet; any name works.

Clients with OAuth

These clients discover the Rubin authorization server on their own. You add the URL, the client opens your browser on rubin.trade, you pick the account and confirm one wallet signature — that is the whole setup. See OAuth & Trading Keys for what happens behind it.

claude.ai and Claude Desktop

  1. Open Settings → Connectors and click Add custom connector.
  2. Name: Rubin Mainnet, URL: https://mcp.mainnet.rubin.trade/mcp. Leave the OAuth Client ID and Secret fields empty.
  3. Click Add — the browser opens rubin.trade. Choose the account and confirm the signature in your wallet.

ChatGPT

  1. Open Settings → Apps, turn on Developer mode and click Create app.
  2. Name: Rubin Mainnet, Server URL: https://mcp.mainnet.rubin.trade/mcp, Authentication: OAuth.
  3. Tick I understand and want to continue and click Create. ChatGPT opens rubin.trade to authorize.

Claude Code

claude mcp add --transport http rubin https://mcp.mainnet.rubin.trade/mcp

Then run /mcp in Claude Code, pick rubin and authenticate — the same browser flow.

Clients with a Bearer credential

For clients without MCP OAuth, headless agents and API calls, pass a credential in the Authorization header.

Get the credential

In the web app open More → API Trading Keys and create an MCP Token. It is base64 of:

{ "tradingPrivateKey": "0x…", "masterAddress": "rit1…" }

Leave out tradingPrivateKey for a read-only agent. Here, unlike OAuth, the trading key is created in your browser and you hold it: keep the token secret, use it only over HTTPS, and never paste it into a chat. To encode a file by hand: base64 -i credential.json (macOS) or base64 -w0 credential.json (Linux).

Cursor

.cursor/mcp.json in the project, or ~/.cursor/mcp.json:

{
  "mcpServers": {
    "Rubin Mainnet": {
      "url": "https://mcp.mainnet.rubin.trade/mcp",
      "headers": { "Authorization": "Bearer PASTE_BASE64_CREDENTIAL" }
    }
  }
}

Claude Code with a credential

claude mcp add --transport http rubin https://mcp.mainnet.rubin.trade/mcp \
  --header "Authorization: Bearer PASTE_BASE64_CREDENTIAL"

Or commit a project .mcp.json with "type": "http", "url" and "headers" as in the Cursor example.

GitHub Copilot (VS Code)

.vscode/mcp.json, or run MCP: Add Server:

{
  "servers": {
    "Rubin Mainnet": {
      "type": "http",
      "url": "https://mcp.mainnet.rubin.trade/mcp",
      "headers": { "Authorization": "Bearer PASTE_BASE64_CREDENTIAL" }
    }
  }
}

Codex CLI

codex mcp add "Rubin Mainnet" \
  --url https://mcp.mainnet.rubin.trade/mcp \
  --header "Authorization: Bearer PASTE_BASE64_CREDENTIAL"

Gemini CLI

~/.gemini/settings.json:

{
  "mcpServers": {
    "Rubin Mainnet": {
      "httpUrl": "https://mcp.mainnet.rubin.trade/mcp",
      "headers": { "Authorization": "Bearer PASTE_BASE64_CREDENTIAL" }
    }
  }
}

Anthropic Messages API

{
  "mcp_servers": [
    {
      "type": "url",
      "url": "https://mcp.mainnet.rubin.trade/mcp",
      "name": "rubin",
      "authorization_token": "PASTE_BASE64_CREDENTIAL"
    }
  ],
  "tools": [{ "type": "mcp_toolset", "mcp_server_name": "rubin" }]
}

stdio-only hosts

npx mcp-remote https://mcp.mainnet.rubin.trade/mcp \
  --header "Authorization: Bearer PASTE_BASE64_CREDENTIAL"

Check the connection

Ask the agent to call whoami. It answers with the account in both address forms, the session mode (trade or read-only) and the limits. Then list_markets returns the tickers to trade.