Skip to main content
Glama
truemarkets-mcp-server

truemarkets-mcp-server

by jun229

truemarkets-mcp-server

MCP (Model Context Protocol) server for True Markets. Gives AI agents native trading capabilities without shelling out to bash.

Why this exists

The True Markets CLI (tm) works with agents through bash skills — the agent runs tm buy SOL 50 -o json --force and parses stdout. This works, but has fundamental problems:

  1. Two-quote problem: --dry-run and --force fetch separate quotes. The agent decides based on quote A but executes at quote B's price.

  2. No slippage protection: No mechanism to reject execution if price moves.

  3. Process overhead: Every command spawns a new process, re-reads credentials, re-establishes HTTP connections.

  4. Fragile parsing: Agent must parse JSON from stdout mixed with stderr warnings.

The MCP server solves all of these:

  • Quote caching: tm_get_quote returns a quote_id cached for 60 seconds. tm_execute_trade uses the same quote — no price surprise.

  • Structured responses: Tools return typed JSON via MCP's structuredContent, no stdout parsing.

  • Persistent auth: Credentials loaded once on startup, tokens refreshed automatically.

  • Native tool calls: Agents call tools directly instead of composing bash strings.

Related MCP server: o2 Exchange MCP Server

Tools

Read-only

Tool

Description

tm_get_price

Get token price in USDC (no API key needed)

tm_get_balances

Get token balances across chains

tm_list_assets

List available tokens

tm_get_profile

Get account email and wallet addresses

Trading

Tool

Description

Destructive

tm_get_quote

Get a trade quote (cached 60s)

No

tm_execute_trade

Execute a cached quote

Yes

tm_prepare_transfer

Prepare outbound transfer

No

tm_execute_transfer

Execute a prepared transfer

Yes

Agent workflow

1. tm_get_balances          → check available funds
2. tm_get_quote(buy, SOL, 50) → inspect price, fee, issues
3. [agent decides: price acceptable? issues empty?]
4. tm_execute_trade(quote_id) → execute the SAME quote

Compare to the CLI flow where step 4 fetches a new quote silently.

Setup

Prerequisites

  • Node.js 18+

  • Existing True Markets account (tm signup / tm login via the CLI)

  • API key configured (tm config set api_key <key>)

The MCP server reads credentials from ~/.config/truemarkets/ — the same location the CLI uses. No separate auth setup needed.

Install

npm install -g truemarkets-mcp-server

Configure your agent

Claude Code / claude.ai

Add to your MCP config (.claude/mcp.json or via settings):

{
  "mcpServers": {
    "truemarkets": {
      "command": "truemarkets-mcp-server",
      "args": []
    }
  }
}

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "truemarkets": {
      "command": "npx",
      "args": ["truemarkets-mcp-server"]
    }
  }
}

Environment variables

Variable

Description

TM_AUTH_TOKEN

Override stored auth token

TM_API_KEY

Override stored API key

Development

git clone https://github.com/true-markets/mcp-server.git
cd mcp-server
npm install
npm run build
npm start

Test with the MCP inspector:

npx @modelcontextprotocol/inspector node dist/index.js

Architecture

src/
├── index.ts              # Entry point, stdio transport
├── constants.ts          # API host, paths, version
├── types.ts              # Shared types and helpers
├── services/
│   ├── auth.ts           # Token/key management (reads ~/.config/truemarkets/)
│   ├── api-client.ts     # DeFi Gateway HTTP client
│   └── signer.ts         # Turnkey P256 payload signing
└── tools/
    ├── read.ts           # Read-only tools (price, balances, assets, profile)
    └── trade.ts          # Trading tools (quote, execute, transfer)

License

MIT

Available Tools

8 tools
tm_execute_tradeExecute a quoted tradeA
Destructive

Execute a trade using a quote_id from tm_get_quote.

IMPORTANT: Only call this after inspecting the quote from tm_get_quote. The quote must be less than 60 seconds old and have no issues.

This tool signs the quote payloads with the user's Turnkey API key and submits the trade. It is irreversible.

Args:

  • quote_id (string): The quote_id from tm_get_quote

Returns: { success, order_id, tx_hash, explorer_url }

Inputs: quote_id (required).

tm_execute_transferExecute a prepared transferA
Destructive

Execute a transfer prepared with tm_prepare_transfer. Irreversible.

Args:

  • transfer_id (string): From tm_prepare_transfer

Returns: { success, tx_hash, chain, sent, fee, explorer_url }

Inputs: transfer_id (required).

tm_get_balancesGet account balancesA
Read-onlyIdempotent

Get token balances for the authenticated user across all chains.

Args:

  • chain (string, optional): Filter by "solana" or "base"

Returns: Array of { symbol, chain, balance, name }

Inputs: chain.

tm_get_priceGet token priceA
Read-onlyIdempotent

Get the current price of a token in USDC by running a zero-cost quote.

Resolves token symbols (SOL, ETH) to addresses automatically. Does NOT require an API key — only auth token.

Args:

  • token (string): Token symbol (e.g. "SOL") or contract address

  • chain (string): "solana" or "base" (default: "solana")

Returns: { token, chain, price_usdc, qty_in, qty_out }

Inputs: token (required), chain.

tm_get_profileGet account profileA
Read-onlyIdempotent

Get the authenticated user's profile including email and wallet addresses.

Returns: { email, wallets: [{ chain, address }] }

Inputs: no named parameters.

tm_get_quoteGet a trade quoteA
Read-only

Request a quote for buying or selling a token. Returns pricing info and a quote_id that can be passed to tm_execute_trade within 60 seconds.

IMPORTANT: Always call this BEFORE tm_execute_trade. Inspect the quote (price, fee, issues) and only execute if acceptable. This solves the price uncertainty problem — you see the exact price you'll get.

Args:

  • side ("buy" | "sell"): Trade direction

  • token (string): Token symbol (SOL, ETH) or contract address

  • amount (string): Quantity as a decimal string

  • chain ("solana" | "base"): Blockchain network (default: solana)

  • qty_unit ("base" | "quote"): What the amount represents (default: "quote" for buy, "base" for sell)

Returns: { quote_id: string, // Pass this to tm_execute_trade side, token, chain, you_pay: string, // Amount + asset you send you_receive: string, // Amount + asset you get fee: string, effective_price: string, // USDC per token issues: [], // Any problems (e.g. insufficient balance) expires_in_seconds: 60 }

Inputs: side (required), token (required), amount (required), chain, +1 more.

tm_list_assetsList available tokensA
Read-onlyIdempotent

List all tokens available for trading on True Markets.

Args:

  • chain (string, optional): Filter by "solana" or "base"

Returns: Array of { symbol, name, chain, address }

Inputs: chain.

tm_prepare_transferPrepare a token transferA
Read-only

Prepare a transfer to an external wallet address. Returns transfer details and a transfer_id for execution with tm_execute_transfer.

Args:

  • to (string): Destination wallet address

  • token (string): Token symbol or contract address

  • amount (string): Quantity as decimal string

  • chain ("solana" | "base"): Chain (default: solana)

  • qty_unit ("base" | "quote"): Amount unit (default: base)

Returns: { transfer_id, to, token, amount, chain }

Inputs: to (required), token (required), amount (required), chain, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no overlap: executing trades, executing transfers, getting balances, getting prices, getting profiles, getting quotes, listing assets, and preparing transfers. The descriptions clearly differentiate their functions and workflows.

    Naming Consistency5/5

    All tools follow a consistent 'tm_' prefix with verb_noun pattern (e.g., tm_execute_trade, tm_get_balances, tm_list_assets). The naming is perfectly uniform across all eight tools.

    Tool Count5/5

    With 8 tools, this server is well-scoped for a trading/transfer platform. It covers essential operations (quotes, trades, transfers, balances, assets, prices, profiles) without being overwhelming or sparse.

    Completeness5/5

    The tool set provides complete coverage for the trading domain: quote-get-execute workflow for trades, prepare-execute for transfers, plus supporting tools for balances, assets, prices, and profiles. There are no obvious gaps in core operations.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to perform cryptocurrency trading analysis and execution with 38+ tools including real-time market data, technical indicators, risk management, and support for both paper trading and live execution on Hyperliquid.
      7
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to interact with the o2 Exchange on the Fuel Network to perform on-chain trading, manage accounts, and access real-time market data. It provides tools for executing various order types and calculating over 16 technical indicators for comprehensive market analysis.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to securely trade on Hyperliquid perpetual exchange, including order placement, position management, market data retrieval, and vault operations via natural language.
      23 PyPI
      24
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to trade on Interactive Brokers: check quotes, balance, positions, and execute buy/sell orders (including fractional shares by dollar amount) via the Client Portal API.
      20
      14
      MIT