关于 TradeOS (test)
TradeOS MCP bridge 将 TradeOS 交易情报接入兼容 MCP 的 AI 工具,面向市场分析和交易 Agent 工作流。它支持 HTTP OAuth 连接,也提供 npm stdio 桥接以适配仅支持本地进程的客户端。
主要功能
- 01搜索股票代码与比较价差
- 02结合宏观背景分析市场
- 03管理自定义交易 Agent
- 04支持 HTTP OAuth 接入
- 05提供 npm stdio 桥接
适用场景
- 01通过自然语言查询和分析市场
- 02比较交易品种的价差
- 03在 AI 客户端中运行自定义交易 Agent
MCP 相关
该项目将 MCP 调用转发至 TradeOS Streamable HTTP 端点;客户端可使用 HTTP OAuth,或通过 npm stdio 桥接并配置访问令牌。
配置
远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。
https://ai.tradeos.xyz/api/agent/mcp-callclaude mcp add --transport http tradeos-ai-tradeos-mcp-test https://ai.tradeos.xyz/api/agent/mcp-call{"mcpServers":{"tradeos-ai-tradeos-mcp-test":{"type":"http","url":"https://ai.tradeos.xyz/api/agent/mcp-call"}}}在 Cursor 中打开{"servers":{"tradeos-ai-tradeos-mcp-test":{"type":"http","url":"https://ai.tradeos.xyz/api/agent/mcp-call"}}}在 VS Code 中打开{"mcpServers":{"tradeos-ai-tradeos-mcp-test":{"type":"http","url":"https://ai.tradeos.xyz/api/agent/mcp-call"}}}{"mcpServers":{"tradeos-ai-tradeos-mcp-test":{"serverUrl":"https://ai.tradeos.xyz/api/agent/mcp-call"}}}命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。
工具
详细介绍
tradeos-mcp
TradeOS MCP 可将 TradeOS 交易智能接入兼容 MCP 的 AI 工具,让你的助手通过自然语言提示词分析市场、搜索股票代码、比较价差、利用宏观背景,并直接管理自定义交易 Agent。
概述
此仓库在 npm 上发布 @tradeos/tradeos-mcp:一个 stdio MCP 桥接程序,可通过 TradeOS Streamable HTTP(mcp-call)代理工具。你可以通过以下两种方式进行连接:
| 模式 | 最适合 | 身份验证 |
|---|---|---|
| HTTP(推荐) | Cursor、Claude Code、大多数 MCP 客户端 | 在客户端中通过浏览器 OAuth 进行身份验证 |
| npm stdio | 仅支持 command / stdio 的客户端 | TRADEOS_ACCESS_TOKEN 环境变量 |
生产环境端点(两种模式最终都会调用此端点):
https://ai.tradeos.xyz/api/agent/mcp/mcp-call
产品文档:TradeOS MCP 集成与使用
先决条件
- Node.js 18+
- 拥有 MCP API 访问权限的 TradeOS 账户
- 使用 npm stdio 时:能够运行本地安装(参见 Windows 说明)
选项 A — HTTP(推荐)
无需安装 npm。客户端会处理 OAuth。
Cursor
编辑用户配置 ~/.cursor/mcp.json(Windows:%USERPROFILE%\.cursor\mcp.json):
{
"mcpServers": {
"tradeos": {
"url": "https://ai.tradeos.xyz/api/agent/mcp/mcp-call"
}
}
}
保存后,重启 Cursor(或在 Settings → MCP 中刷新 MCP),然后按提示完成 OAuth。
Claude Code(插件 — 推荐)
使用 tradeos-skills/ 中附带的插件:
claude --plugin-dir ./tradeos-skills
然后完成 OAuth 并运行 /tradeos:analyze。完整插件工作流(验证、提交至社区市场):tradeos-skills/README.md — 与 Claude 插件文档保持一致。
选项 B — npm stdio 桥接程序
客户端需要本地进程(command + stdio)时使用。
1. 本地安装
在 Windows 上,不要在 MCP 中依赖 npx(存在缓存/路径问题)。请一次性安装到固定目录:
mkdir -p ~/tradeos-mcp-run # Windows: mkdir %USERPROFILE%\Downloads\tradeos-mcp-run
cd ~/tradeos-mcp-run # Windows: cd %USERPROFILE%\Downloads\tradeos-mcp-run
npm install @tradeos/tradeos-mcp
如有需要,可指定版本,例如 @tradeos/[email protected]。
2. 获取 TRADEOS_ACCESS_TOKEN
运行 OAuth 辅助程序(打开浏览器 → 登录 TradeOS → 输出令牌):
# Linux / macOS
npx -y -p @tradeos/tradeos-mcp tradeos-mcp-oauth
# Or subcommand on main bin:
npx -y @tradeos/tradeos-mcp oauth
# Or, from your install directory:
node node_modules/@tradeos/tradeos-mcp/scripts/fetch-token.mjs
Windows(推荐):
cd /d %USERPROFILE%\Downloads\tradeos-mcp-run
node node_modules\@tradeos\tradeos-mcp\scripts\fetch-token.mjs
复制输出的 JWT(eyJ...)。如要在本地开发此仓库,请将其复制到 .env:
cp .example.env .env
# TRADEOS_ACCESS_TOKEN=eyJ...
只使用 npm install 安装此软件包的最终用户不需要 .env ——请改为在 MCP 客户端配置(mcp.json)中设置令牌。
不要将令牌提交到 git。
3. 配置 Cursor
{
"mcpServers": {
"tradeos-npm": {
"command": "node",
"args": [
"C:/Users/YOU/Downloads/tradeos-mcp-run/node_modules/@tradeos/tradeos-mcp/build/index.js"
],
"env": {
"TRADEOS_ACCESS_TOKEN": "eyJ..."
}
}
}
}
将 YOU 和路径替换为实际的安装位置。在 JSON 中使用正斜杠或转义后的反斜杠。
如果 Cursor 找不到 node,请设置完整路径:
"command": "C:/nvm4w/nodejs/node.exe"
在 Settings → MCP 中启用 tradeos-npm。状态应显示已连接,并列出工具。
4. 在终端中验证(可选)
mcp.json 中的环境变量不会应用于你的 Shell。请在同一个终端会话中设置令牌:
REM Windows CMD
set TRADEOS_ACCESS_TOKEN=eyJ...
node C:\Users\YOU\Downloads\tradeos-mcp-run\node_modules\@tradeos\tradeos-mcp\build\index.js
# Linux / macOS
export TRADEOS_ACCESS_TOKEN=eyJ...
node ~/tradeos-mcp-run/node_modules/@tradeos/tradeos-mcp/build/index.js
成功:
[tradeos-mcp] remote: https://ai.tradeos.xyz/api/agent/mcp/mcp-call
[tradeos-mcp] stdio bridge ready
按 Ctrl+C 停止。Cursor 会启动自己的进程;你无需保持此终端处于打开状态。
Windows 说明
- MCP 中请在
mcp.json使用本地node和安装路径,而不要使用npx。 - 如果 npm 缓存错误提及
C:\Program Files\nodejs\node_cache,请运行一次:npm config set cache "%USERPROFILE%\.npm-cache" npx @pkg tradeos-mcp-oauth在 Windows 上可能会运行错误的 bin。建议使用:
或在安装目录中运行npx -y -p @tradeos/tradeos-mcp tradeos-mcp-oauthnode .../scripts/fetch-token.mjs。- 清除损坏的 npx 缓存(请先退出 Cursor):
rmdir /s /q "%USERPROFILE%\.npm-cache\_npx"
npm 软件包参考
| 项目 | 值 |
|---|---|
| 软件包 | @tradeos/tradeos-mcp |
| MCP Registry 名称 | io.github.TradeOS-AI/tradeos-mcp |
| 可执行文件:MCP 桥接程序 | tradeos-mcp |
| 可执行文件:OAuth 令牌 | tradeos-mcp-oauth |
| OAuth 子命令 | 可执行文件 tradeos-mcp 上的 oauth |
安装:
npm install @tradeos/tradeos-mcp
开发(此仓库)
git clone https://github.com/TradeOS-AI/tradeos-mcp.git
cd tradeos-mcp
npm ci
npm run build
npm run oauth:token # browser OAuth → prints token (copy into .env if needed)
npm run registry:verify
| 脚本 | 用途 |
|---|---|
npm run build | 将 stdio 桥接程序编译到 build/ |
npm run oauth:token | 浏览器 OAuth → 输出令牌 |
npm run registry:verify | 发布前检查(package.json ↔ server.json) |
npm run registry:sync-version <ver> | 从发布标签同步版本 |
发布(维护者)
推送版本标签以触发 .github/workflows/publish-mcp.yml:
git tag v1.0.0
git push origin v1.0.0
- 稳定标签(
v1.0.0)会发布到 npmlatest和 MCP Registry。 - 预发布标签(
v1.0.0-beta.1)会使用与预发布标签匹配的 npm dist-tag 发布(例如beta)。 - 需要 GitHub Actions 密钥
NPM_TOKEN(适用于@tradeos的 Classic Automation 令牌)。
在 Registry API 上验证:
curl "https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.TradeOS-AI/tradeos-mcp"
故障排除
| 症状 | 可能原因 | 解决方法 |
|---|---|---|
TRADEOS_ACCESS_TOKEN is required | 环境变量 / mcp.json 中未设置令牌 | 运行 OAuth 辅助程序;在 MCP 配置中设置 env |
连接时出现 unauthorized | 令牌已过期或无效 | 重新运行 OAuth;粘贴新的 JWT(不带 Bearer 前缀) |
EPERM / node_cache | npm 缓存位于 Program Files 下 | npm config set cache "%USERPROFILE%\.npm-cache" |
TAR_ENTRY_ERROR / 'tradeos-mcp' is not recognized | npx 在 Windows 上运行失败 | 本地安装,并在 mcp.json 中使用 node 路径 |
MODULE_NOT_FOUND for node_modules/... | 从错误的目录运行了脚本 | cd 到安装目录,或使用绝对路径 |
| 令牌在终端中可用,但在 Cursor 中不可用 | mcp.json 路径或令牌不匹配 | 确保路径一致;重启 Cursor / 刷新 MCP |
| MCP 已连接,但没有工具 | 启用了错误的服务 | 禁用有问题的 localhost 条目;使用生产环境 HTTP URL 或可正常工作的 tradeos-npm |
相关内容
tradeos-skills/— Claude Code 插件 + analyze 技能server.json— MCP Registry 清单- TradeOS MCP 常见问题(GitBook)
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。