tradingagents-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@tradingagents-mcpRun a deep analysis on Bitcoin (BTC) and share the research report."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TradingAgents MCP Server
将 TradingAgents 多智能体金融研究引擎,以标准 MCP 协议暴露给任意 LLM Host(Codex、Claude Desktop、Cursor 等)的薄适配层。
重要边界:本服务器只产出研究报告与非执行性决策。它不连接任何券商账户,不提交、修改或取消订单。研究结果仅供参考,不构成投资建议。
为什么需要它?
TradingAgents 本身是一个 Python 框架,需要通过编写代码或命令行方式驱动,LLM Host 无法直接调用它。TradingAgents MCP Server 解决了三个问题:
零代码接入:LLM Host 通过 MCP 协议即可启动研究任务、查询进度、读取完整报告,无需理解 TradingAgents 内部结构。
异步任务模型:完整金融研究耗时较长(数分钟到数十分钟),本服务器将每次分析建模为异步任务,不阻塞 MCP 调用。
开箱即用的研究管线:内置任务队列、SQLite 持久化、幂等控制、取消与确认式删除,服务重启后任务状态不会丢失。
Related MCP server: financial-research-agent
特性亮点
7 个 MCP 工具 + 1 个 MCP 资源:完整覆盖能力查询、任务启动、状态轮询、结果读取、任务列表、取消与删除。
异步任务状态机:
queued → running → succeeded / failed / cancelled,支持长时间研究任务。幂等创建:
idempotency_key保证同一分析请求重复提交只创建一次任务。持久化存储:任务元数据存于 SQLite,报告与中间产物存于磁盘,服务重启后可恢复。
确认式删除:成果永不自动清理;删除必须传入完全匹配的
run_id二次确认。凭证隔离:LLM API Key 等敏感配置只存在于服务端环境变量中,MCP 协议层不接触凭证。
架构概览
flowchart LR
A[LLM Host<br/>Codex / Claude Desktop] -->|MCP stdio| B[MCP Server<br/>tradingagents_mcp.server]
B --> C[(SQLite<br/>tasks.db)]
B --> D[TaskRuntime<br/>单 worker 串行队列]
D -->|子进程隔离| E[worker.py]
E --> F[TradingAgentsGraph<br/>propagate]
F --> G[final_state.json<br/>complete_report.md]
G --> B
B -->|MCP Resource| AMCP Server:处理工具与资源请求,维护任务队列。
SQLite:存储任务元数据与幂等映射,支持原子状态迁移。
TaskRuntime:单 worker 串行执行任务,子进程隔离保证上游异常不影响服务器进程。
worker.py:子进程内运行
TradingAgentsGraph.propagate(),产出final_state.json与complete_report.md。
快速开始
前置要求
Python 3.10+
已安装 TradingAgents:
pip install tradingagents(或从源码安装)已配置 LLM API Key(见下文「LLM 配置」)
安装
cd tradingagents-mcp
pip install -e .启动
# 方式一:直接启动
python -m tradingagents_mcp.server
# 方式二:使用启动脚本(自动探测 TradingAgents 源码位置)
./start_server.shLLM 配置
LLM 提供商配置沿用 TradingAgents 自身的环境变量,由上游 TradingAgentsGraph 读取。MCP 适配器不接触这些凭证。
变量 | 说明 | 示例 |
| LLM 提供商 |
|
| 深度思考模型名 |
|
| 快速思考模型名 |
|
| API 地址 |
|
| API Key(也可直接用 |
|
| 单次调用最大 token 数 |
|
| 采样温度 |
|
服务端配置环境变量:
变量 | 说明 | 默认值 |
| 数据目录(数据库、任务工作区) |
|
| 最大排队任务数 |
|
| 单任务超时(秒) |
|
| 上游图类导入路径(自定义安装布局时覆盖) |
|
提示:所有凭证均以环境变量方式注入服务端进程,MCP 工具参数中永远不会出现 API Key。
配置到 MCP Host
Codex / Claude Desktop
{
"mcpServers": {
"tradingagents": {
"command": "python",
"args": ["-m", "tradingagents_mcp.server"]
}
}
}工具与资源
工具 | 说明 | 只读 | 幂等 |
| 查询服务器能力与配置(不含凭证) | ✅ | ✅ |
| 启动分析任务 | ❌ | ✅( |
| 查询任务状态与时间戳 | ✅ | ✅ |
| 获取结果摘要(评级、置信度、报告 URI) | ✅ | ✅ |
| 分页列出任务,支持状态过滤 | ✅ | ✅ |
| 取消 queued / running 任务 | ❌ | ✅ |
| 永久删除任务(需 | ❌ | ✅ |
MCP 资源:
tradingagents://analyses/{run_id}/report— 完整的 Markdown 研究报告(仅succeeded任务可访问)
支持的资产与研究参数
参数 | 取值 | 说明 |
|
| 股票代码或加密货币符号 |
|
| 默认 |
|
| 分析日期,不可为未来日期 |
|
| 默认 |
|
| 默认 |
| 分析师类型列表 | 默认按 |
| 可选字符串 | 相同参数 + 相同 key 返回已有任务 |
使用示例
1. 查询能力
调用 get_capabilities返回支持的资产类型、研究深度、输出语言、队列限制等。
2. 启动分析
调用 start_analysis,参数:
- symbol: "AAPL"
- analysis_date: "2025-01-15"
- asset_type: "stock"
- depth: "shallow"
- language: "English"返回 run_id,例如 run_a1b2c3d4e5f67890。
3. 轮询状态
调用 get_analysis_status,参数:
- run_id: "run_a1b2c3d4e5f67890"任务状态流转:queued → running → succeeded / failed / cancelled。轮询直到终态。
4. 读取结果摘要
调用 get_analysis_result,参数:
- run_id: "run_a1b2c3d4e5f67890"返回评级、置信度与报告资源 URI。
5. 阅读完整报告
通过 MCP 资源读取:
tradingagents://analyses/run_a1b2c3d4e5f67890/report数据存储
所有数据存储在 TRADINGAGENTS_MCP_DATA_DIR(默认 ~/.tradingagents-mcp/):
~/.tradingagents-mcp/
├── tasks.db # SQLite 任务元数据数据库
└── runs/
├── run_abc123/ # 每个任务的独立工作区
│ ├── request.json
│ ├── final_state.json
│ ├── complete_report.md
│ ├── SUCCESS.json 或 error.json
│ └── worker_stderr.log
└── ...任务成果永不自动清理,只有显式调用
delete_analysis才会删除。服务重启后,中断的
running任务会自动重新入队。
安全与边界
不做交易:不连接券商,不提交、修改或取消任何订单。
凭证隔离:API Key 只存在于服务端环境变量,绝不通过 MCP 协议传输。
只读查询为主:除
start_analysis、cancel_analysis、delete_analysis外,其余工具均为只读。数据默认本地:报告与数据库存储在本地数据目录,不依赖外部 SaaS。
FAQ
Q:为什么不直接在 MCP Host 里调用 TradingAgents? A:TradingAgents 是 Python 框架,LLM Host 无法原生执行任意 Python。MCP 适配器将研究能力封装为标准化工具,且提供队列、持久化、幂等、取消等工程能力。
Q:如何配置 API Key?
A:在启动 MCP 服务器的进程环境中设置 TRADINGAGENTS_API_KEY(或 OPENAI_API_KEY / DEEPSEEK_API_KEY)等变量。服务器不会通过 MCP 工具暴露或接收凭证。
Q:研究报告可以删除吗?
A:可以,但必须显式调用 delete_analysis 并传入完全匹配的 run_id。成果不会自动清理,避免误删。
Q:分析结果会过期或被覆盖吗? A:不会。每个任务有独立工作区与持久化存储,幂等键保证同一请求只创建一次任务。
开发与测试
pip install pytest pytest-asyncio
pytest tests/使用 MCP Inspector 交互式调试:
npx @modelcontextprotocol/inspector python -m tradingagents_mcp.server许可证
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server exposing the Backtest360 engine API as tools for AI agents.
MCP server for OpenMM — exposes market data, account, trading, and strategy tools to AI agents
- Helvetic ResearchOAuth
Research-only MCP server: turn your AI into a quant research desk — backtests, no trades.
The vetted, cross-LLM marketplace of doer agents — itself an MCP server.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server that provides AI agents with financial tools including real-time quotes, backtesting, technical analysis, and multi-exchange data via a simple CLI interface.1MIT
- FlicenseNot gradedqualityDmaintenanceMCP server that exposes stock research tools (fundamentals, news, technicals, analyst ratings) to AI clients, enabling autonomous generation of structured investment briefs.
- AlicenseAqualityAmaintenanceAn MCP server exposing a registry of paper-backed quantitative trading methods plus a deterministic, no-LLM decision helper for reproducible trading research.13MIT
- AlicenseAqualityDmaintenanceAn MCP server that exposes trading analytics — technical indicators, portfolio state, risk metrics, and backtest results — as tools an LLM agent can call.5MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/blurryface1/tradingagents-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server