tradingview-mcp-chefy
tradingview-mcp-chefy
面向真正进行回测的交易者的 Token 高效型 TradingView MCP。
这是一个专门为策略测试构建的分支。现有的 TradingView MCP 在图表阅读和早间工作流方面表现良好,但在迭代 Pine 策略时会大量消耗 Token —— 每次回测读取都会将完整的交易列表、权益曲线和控制台输出转储到你的上下文中。此分支重写了这些读取操作,在数据传输前先在 TradingView 运行时内部进行聚合,默认返回摘要,并按需提供详细信息。
[!WARNING] 与 TradingView Inc. 或 Anthropic 无关联。 此工具通过 Chrome DevTools Protocol 连接到你本地运行的 TradingView 桌面应用。使用前请查阅 免责声明。
[!IMPORTANT] 需要有效的 TradingView 订阅。 此工具不会绕过任何 TradingView 付费墙。它读取并控制你机器上已经运行的 TradingView 桌面应用。
[!NOTE] 所有处理均在本地进行。 不会向任何地方发送数据。没有任何 TradingView 数据会离开你的机器。
贡献者
本项目基于以下两项前期工作:
tradesdontlie/tradingview-mcp — 原始的 CDP 桥接和工具界面。艰苦的抓取工作由他们完成。
LewisWJackson/tradingview-mcp-jackson — 添加了早间简报工作流、规则配置和 v2.14+ 启动修复的分支。此分支基于他的版本进行开发。
如果这些仓库对你有帮助,请去给它们加星。
Related MCP server: J-SQUAD TradingView MCP Combined
此分支的不同之处
区域 | 上游行为 | 此分支 |
| 返回完整的策略测试器负载 | 默认返回 |
| 仅有 | 支持游标分页。默认 |
| 逐点完整曲线 | 下采样至 N 个桶(默认 50)。使用 |
| 所有控制台输出 | 新增 |
新增: | — | 单次调用,包含所有关键指标,约 200 字节 |
新增: | — | 在服务端对比两个策略运行结果,仅返回差异 |
最终效果: 一次典型的回测读取从约 50KB 减少到约 200 字节。在繁重的迭代会话(20 次以上运行)中,这相当于节省了 20 美元与 1 美元 Token 费用的区别。
状态
预发布。 分支已建立。新的聚合工具正在编写中。在 v0.2 发布之前,此仓库的行为与 LewisWJackson/tradingview-mcp-jackson 完全相同 —— 如果你现在需要稳定性,请使用那个版本。
路线图:
[x] Fork 仓库,建立结构
[ ]
backtest_summary(浏览器内聚合)[ ]
backtest_trades_paged(游标分页)[ ]
backtest_equity_summary(下采样)[ ]
pine_console_errors(过滤工具)[ ] 与上游的 Token 成本基准测试
[ ] 将无争议的修复 PR 回传给 LewisWJackson 上游
[ ] v0.2 发布
快速开始
目前与上游设置相同。 当新工具在 v0.2 中发布时,安装路径保持不变 —— 只有
mcpServers配置名称可能会更改。
前置要求
TradingView 桌面应用(实时/策略数据需要付费订阅)
Node.js 18+
Claude Code(或任何 MCP 客户端)
macOS, Windows 或 Linux
安装
git clone https://github.com/Chefy3x/tradingview-mcp-chefy.git ~/tradingview-mcp-chefy
cd ~/tradingview-mcp-chefy
npm install使用调试端口启动 TradingView
Mac:
./scripts/launch_tv_debug_mac.shWindows:
scripts\launch_tv_debug.batLinux:
./scripts/launch_tv_debug_linux.sh添加到 Claude Code
添加到 ~/.claude/.mcp.json(与现有服务器合并):
{
"mcpServers": {
"tradingview": {
"command": "node",
"args": ["/Users/YOUR_USERNAME/tradingview-mcp-chefy/src/server.js"]
}
}
}将 YOUR_USERNAME 替换为你的实际用户名(在 Mac/Linux 上使用 echo $USER 查看)。
验证
重启 Claude Code 并询问:"Use tv_health_check to verify TradingView is connected."
架构
Claude Code ←→ MCP stdio ←→ src/server.js ←→ CDP :9222 ←→ TradingView Desktop (Electron)连接:
localhost:9222上的 Chrome DevTools Protocol聚合: 对于回测读取,通过 CDP 发送的 JS 表达式在返回前会在 TradingView 运行时内部 执行缩减。相同的网络跳数,跨边界传输的数据量减少约 200 倍。
无外部网络调用 — 所有内容均在本地运行
零额外依赖 — 仅使用上游已有的依赖
贡献
与上游的双向交流:
对现有工具的 Token 效率改进 → 我会将这些 PR 回传给 LewisWJackson 上游,以便大家受益
新的
backtest_*系列工具 → 保留在此分支中(改变了 MCP 使用的思维模型)
如果你在共享代码路径中发现错误,请在此处提交 issue,我会进行处理。
免责声明
本项目仅供个人、教育和研究目的使用。
此工具使用 Chrome DevTools Protocol (CDP),这是所有基于 Chromium 的应用程序中内置的标准调试接口。它不会对任何专有的 TradingView 协议进行逆向工程,不会连接到 TradingView 的服务器,也不会绕过任何访问控制。调试端口必须由用户通过标准的 Chromium 命令行标志显式启用。
使用本软件即表示你同意:
你全权负责确保你的使用符合 TradingView 的使用条款 和所有适用法律。
此工具访问未记录的内部 TradingView API,这些 API 可能随时更改。
此工具不得用于重新分发、转售或商业利用 TradingView 的市场数据。
作者不对任何账户封禁、暂停或其他后果负责。
使用风险自负。
许可证
MIT — 见 LICENSE。继承自上游。仅适用于源代码,不适用于 TradingView 的软件、数据或商标。
This server cannot be deployed
Maintenance
Related MCP Connectors
Evidence-gated quant research for TradingView Pine Script strategies, run from your AI client.
> TradingMCP puts a market analyst inside your AI assistant. Paste one URL into Claude, ChatGPT, Cursor, VS Code or any MCP client and ask in plain language: screen for breakouts, run a multi-timeframe analysis, backtest a strategy with walk-forward validation, scan for smart-money and volume signals, or get a one-prompt morning market brief. In clients that support MCP Apps, price charts and the Markets panel are drawn right in the chat. > 40+ tools covering crypto (real-time), stocks, ETFs, FX, futures and commodities across major global exchanges. > Hosted, nothing to install: Pro $9/month (2,500 tool calls) or Pro+ $29/month (10,000). Paid upfront with a 14-day money-back guarantee; your API key arrives right after checkout. > Built on the open-source tradingview-mcp core (MIT, ~5k GitHub stars): self-host it free, or use the hosted version with zero ops. > For research and education, not financial advice. Not affiliated with TradingView
AI-powered Pine Script v6 strategy generator built for prop-firm futures traders.
Backtest trading strategies, Monte Carlo robustness, exact Pine export, sealed out-of-sample judge.
Related MCP Servers
- AlicenseBqualityAmaintenanceMCP server that lets AI agents directly control and interact with the TradingView desktop app via 88 chart-control tools, enabling automated chart reading, Pine Script compilation, strategy optimization, and replay control.11344 npm53MIT
- FlicenseNot gradedqualityBmaintenanceA comprehensive MCP server that integrates TradingView Desktop automation, screener API, Yahoo Finance, IDX/BEI tools, backtesting, news sentiment, trade math, and market sessions. It enables traders to perform technical analysis, backtest strategies, manage positions, and automate TradingView tasks through natural language.-
- FlicenseNot gradedqualityCmaintenanceAn MCP server that extends TradingView with AI-driven morning briefs, trading rule automation, and 81 tools for chart control, Pine Script development, replay practice, and multi-pane layouts.76 npm-
- AlicenseBqualityBmaintenanceTradingView MCP server — real-time market data, technical indicators, screeners, and backtesting for Claude, ChatGPT, Cursor, Copilot, and any MCP client. Stocks, crypto, forex & futures across global exchanges.441MIT