truemarkets-mcp-server

truemarkets-mcp-server

Enables AI agents to perform native trading on True Markets by providing tools for price lookups, balance management, and secure trade execution with quote caching. It replaces fragile CLI-based workflows with structured JSON responses and persistent authentication for more reliable financial operations.

Category
Visit Server

README

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.

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
truemarkets-mcp-server