loading…
Search for a command to run...
loading…
Enables AI agents to perform native trading on True Markets by providing tools for price lookups, balance management, and secure trade execution with quote cach
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.
MCP (Model Context Protocol) server for True Markets. Gives AI agents native trading capabilities without shelling out to bash.
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:
--dry-run and --force fetch separate quotes. The agent decides based on quote A but executes at quote B's price.The MCP server solves all of these:
tm_get_quote returns a quote_id cached for 60 seconds. tm_execute_trade uses the same quote — no price surprise.structuredContent, no stdout parsing.| 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 |
| 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 |
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.
tm signup / tm login via the CLI)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.
npm install -g truemarkets-mcp-server
Add to your MCP config (.claude/mcp.json or via settings):
{
"mcpServers": {
"truemarkets": {
"command": "truemarkets-mcp-server",
"args": []
}
}
}
Add to .cursor/mcp.json:
{
"mcpServers": {
"truemarkets": {
"command": "npx",
"args": ["truemarkets-mcp-server"]
}
}
}
| Variable | Description |
|---|---|
TM_AUTH_TOKEN |
Override stored auth token |
TM_API_KEY |
Override stored API key |
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
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)
MIT
Add this to claude_desktop_config.json and restart Claude Desktop.
{
"mcpServers": {
"truemarkets-mcp-server": {
"command": "npx",
"args": []
}
}
}