Trading Simulator MCP Server
交易模拟器 MCP 服务器
用于与交易模拟器 API 交互的 MCP(模型上下文协议)服务器。该服务器使 Claude 等 AI 模型能够通过兼容 MCP 的接口查询余额、查看价格并执行交易。
特征
该 MCP 服务器通过结构化工具调用提供对交易模拟器操作的访问:
账户操作
获取代币余额
获取投资组合信息
查看交易历史记录
价格操作
获取代币价格
获取代币信息
查看价格历史记录
交易业务
执行代币之间的交易
获取潜在交易的报价
智能代币检测,自动处理链参数
竞赛运营
查看比赛状态
查看排行榜
Related MCP server: Scorched
智能令牌处理
交易模拟器 MCP 包含一个智能代币检测系统,可简化交易执行:
自动链检测:在使用常见代币执行交易时,系统会自动识别适当的区块链(EVM/SVM)和特定链(ETH、BASE 等)参数。
同链优化:同链交易Token时,自动配置同链交易参数。
跨链回退:如果由于代币位于不同链上而导致同链交易失败,系统将优雅地回退到显式参数或服务器端检测。
常见代币支持:系统包含不断增长的常见代币列表及其地址和链信息。
验证
交易模拟器 API 使用 Bearer 令牌身份验证,需要在Authorization标头中传递单个 API 密钥作为 Bearer 令牌。
例子:
Authorization: Bearer your_api_key_here设置
克隆存储库
git clone https://github.com/yourusername/trading-simulator-mcp.git cd trading-simulator-mcp安装依赖项
npm install配置您的 API 凭证(请参阅下面的配置部分)
构建项目
npm run build启动服务器
npm run start
配置
您有两种配置交易模拟器 MCP 服务器的选项:
方法一:在Cursor/Claude中直接配置(推荐)
推荐的方法是直接在 Cursor 或 Claude Desktop 配置中提供环境变量。这种方式更安全,并且无需 .env 文件。
当通过配置提供这些环境变量时,服务器将自动使用这些环境变量。
有关具体设置说明,请参阅下面的“添加到光标”和“添加到 Claude 桌面”部分。
方法 2:使用 .env 文件(后备)
如果您更喜欢使用 .env 文件,或者直接从命令行运行服务器:
使用您的 API 凭证创建一个
.env文件cp .env.example .env使用你的 API 密钥编辑
.env文件TRADING_SIM_API_KEY=your_api_key_here TRADING_SIM_API_URL=http://localhost:3000 DEBUG=false使用限制权限保护你的 .env 文件
chmod 600 .env
环境变量优先级
交易模拟器 MCP 服务器对环境变量使用以下优先顺序:
直接从 JSON 配置提供的环境变量
.env 文件中的环境变量(如果存在且 #1 不可用)
可选变量的默认值(例如,API_URL 默认为“ http://localhost:3000 ”)
添加到光标
要将此 MCP 服务器添加到 Cursor:
首先使用
npm run build构建项目在 Cursor 中,前往“设置”>“MCP 服务器”
点击“添加服务器”
使用以下设置配置服务器:
名称:
Trading Simulator MCP(或您喜欢的任何名称)类型:
command命令:
node参数:
/path/to/trading-sim-mcp/dist/index.js(使用完整路径)环境变量:
TRADING_SIM_API_KEY:您的 API 密钥TRADING_SIM_API_URL:API 服务器 URL(可选)DEBUG:true(可选,用于附加日志记录)
点击“保存”
在游标配置中使用环境变量
为了更加安全,您可以通过主目录中的.cursor/mcp.json文件配置 Cursor:
{
"mcpServers": {
"trading-simulator-mcp": {
"name": "Trading Simulator MCP",
"type": "command",
"command": "node",
"args": ["/path/to/trading-simulator-mcp/dist/index.js"],
"env": {
"TRADING_SIM_API_KEY": "your_api_key_here",
"TRADING_SIM_API_URL": "http://localhost:3000",
"DEBUG": "true"
}
}
}
}这种方法消除了对 .env 文件的需要。
添加到 Claude 桌面
要将此 MCP 服务器添加到 Claude Desktop:
首先使用
npm run build构建项目找到您的 Claude Desktop 配置文件:
在 macOS 上:
~/Library/Application Support/Claude/claude_desktop_config.json在 Windows 上:
%APPDATA%\Claude\claude_desktop_config.json在 Linux 上:
~/.config/Claude/claude_desktop_config.json
创建或编辑
claude_desktop_config.json文件,内容如下:{ "mcpServers": { "trading-simulator-mcp": { "name": "Trading Simulator MCP", "type": "command", "command": "node", "args": [ "/path/to/trading-simulator-mcp/dist/index.js" ], "env": { "TRADING_SIM_API_KEY": "your_api_key_here", "TRADING_SIM_API_URL": "http://localhost:3000", "DEBUG": "true" } } } }将
/path/to/trading-simulator-mcp/dist/index.js替换为已编译服务器文件的完整路径例如:
/Users/username/trading-simulator-mcp/dist/index.js
保存配置文件并重新启动Claude Desktop
如果您遇到 Claude Desktop 的问题,请检查以下日志:
在 macOS 上:
~/Library/Logs/Claude/在 Windows 上:
%USERPROFILE%\AppData\Local\Claude\Logs\在 Linux 上:
~/.local/share/Claude/logs/
重要开发说明
开发 MCP 服务器时,请使用console.error()而不是console.log()进行所有调试和日志记录。Claude 桌面应用和 Cursor 通过 stdout 与服务器通信,因此任何console.log()语句都会干扰此通信并导致 JSON 解析错误。
MCP 工具
该服务器提供以下 MCP 工具:
帐户工具
get_balances- 获取团队的代币余额get_portfolio- 获取您团队的投资组合信息get_trades- 获取你的团队的交易历史记录
价格工具
get_price- 获取代币的当前价格get_token_info- 获取有关令牌的详细信息get_price_history- 获取代币的历史价格数据
交易工具
execute_trade两个代币之间的交易自动检测并分配常见代币的链参数
支持同链交易,无需显式链参数
跨链场景优雅回退
get_quote- 获取潜在交易的报价
竞争工具
get_competition_status- 获取当前比赛的状态get_leaderboard- 获取比赛排行榜
常见代币
该系统包含一个COMMON_TOKENS结构,用于将代币地址映射到其各自的链上。这使得在执行交易时能够自动检测链上的参数。
目前常见的代币包括:
索拉纳(SVM)
USDC:
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1vSOL:
So11111111111111111111111111111111111111112
以太坊(EVM)
USDC:
0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48WETH:
0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
基础(EVM)
USDC:
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913以太坊:
0x4200000000000000000000000000000000000006
要添加更多常见的标记,您可以扩展types.ts文件中的COMMON_TOKENS对象。
安全注意事项
您的 API 密钥应保持安全,并且绝不要在客户端代码中共享或暴露
在生产环境中连接 API 时始终使用 HTTPS
API 密钥具有执行交易的完全访问权限,因此请妥善保护它
Available Tools
15 toolsexecute_tradeC
Execute a trade between tokens
Inputs: fromToken (required), toToken (required), amount (required), reason (required), +5 more.
get_balancesB
Get token balances for your team
Inputs: no named parameters.
get_competition_rulesB
Get the rules and configuration details for the competition
Inputs: no named parameters.
get_competition_statusC
Get the status of the current competition
Inputs: no named parameters.
get_detailed_healthB
Detailed health check with information about all services
Inputs: no named parameters.
get_healthB
Basic health check for the trading simulator API
Inputs: no named parameters.
get_leaderboardC
Get the competition leaderboard
Inputs: competitionId.
get_portfolioC
Get portfolio information for your team
Inputs: no named parameters.
get_priceC
Get the current price for a token
Inputs: token (required), chain, specificChain.
get_price_historyC
Get historical price data for a token
Inputs: token (required), startTime, endTime, interval, +2 more.
get_profileC
Get your team's profile information
Inputs: no named parameters.
get_quoteC
Get a quote for a potential trade
Inputs: fromToken (required), toToken (required), amount (required), fromChain, +3 more.
get_token_infoC
Get detailed information about a token
Inputs: token (required), chain, specificChain.
get_tradesC
Get trade history for your team
Inputs: limit, offset, token, chain.
update_profileC
Update your team's profile information
Inputs: contactPerson, metadata.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Most tools have distinct purposes, but there is some potential confusion between get_health and get_detailed_health, as both relate to health checks. Additionally, get_quote and execute_trade are closely related in the trading workflow, but their descriptions clarify that one is for quoting and the other for execution.
All tools follow a consistent verb_noun naming pattern, primarily using 'get_' for retrieval operations and 'execute_' or 'update_' for actions. This uniformity makes the tool set predictable and easy to navigate for an agent.
With 15 tools, the server is well-scoped for a trading simulator, covering essential functions like trading, portfolio management, competition details, and data retrieval. Each tool appears to serve a specific purpose without redundancy.
The tool set covers core trading operations (e.g., execute_trade, get_quote, get_balances) and competition features (e.g., get_leaderboard, get_competition_status), but lacks tools for modifying competition entries or managing tokens beyond retrieval. Minor gaps exist, but agents can likely work around them.
Maintenance
Related MCP Connectors
Trading MCP server for AI agents, with live market data, account reads and controlled execution.
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
MCP server for Gainium — manage trading bots, deals, and balances via AI assistants
MCP server for AI dialogue using various LLM models via AceDataCloud
Related MCP Servers
AlicenseAqualityFmaintenanceAn MCP server that enables Claude and Gemini CLI to interact with Hummingbot for automated cryptocurrency trading across multiple exchanges.1159Apache 2.0- AlicenseNot gradedqualityCmaintenanceAn MCP server that lets you talk to your AI trading assistant in plain English to research stocks, generate trade recommendations, manage a portfolio, and execute trades through natural language.MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that provides AI assistants like Claude with direct access to MetaAPI trading platform. Trade forex, stocks, and commodities through natural language conversations.1MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives Claude direct access to TradersPost webhook trading. Send trade signals, inspect strategy configs, query trade history, and monitor positions.MIT