tradingview-mcp-py
Provides trading analysis tools powered by TradingView's Screener API, including technical indicators, candlestick patterns, multi-timeframe analysis, and stock screening.
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., "@tradingview-mcp-pyWhat's the technical analysis for TSLA?"
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.
J-SQUAD TradingView MCP โ Python (tradingview-mcp-py)
30 tools ยท 5 modules โ MCP server for stock analysis (TradingView Screener API, Yahoo Finance, IDX/BEI, backtesting, news sentiment, trade math). Lean edition, no CDP โ no TradingView Desktop / Chrome required, so it's VPS-compatible.
Built by CenblueOne as part of the J-SQUAD system (IDX trading bot).
๐ค For AI agents / harnesses (Claude Code, Hermes, opencode, Cursor, Grok, etc.): read
AGENTS.mdโ architecture, how to run/test, tool inventory, and mandatory rules (never upgrademcp, never use"command": "python", etc.).
โจ Highlights
โ No TradingView Desktop โ uses TradingView public Screener API + Yahoo Finance (runs headless on servers/VPS)
โ IDX-ready โ
idx_*tools auto-append.JK(BBRI โ BBRI.JK)โ Graceful degradation โ if a library is missing, only that module's tools are disabled
โ Tested โ
pytest13 tests passed (helpers + server import + market_cap mocked)โ Multi-agent ready โ one shared venv across many agents; per-agent config files; stdio (no port conflicts)
Related MCP server: Trading MCP Server
โ ๏ธ Agent / AI Guide โ Check FIRST Before Installing / Configuring
Read this section every time an agent (Claude Code, Hermes, opencode, Grok, etc.) wants to install / configure / upgrade this server. This server can be shared by MANY agents on one machine โ the most common mistakes come from unnecessary re-installs or using
"command": "python".
Mandatory checklist:
Check whether it's already installed โ don't blindly reinstall:
# venv exists? Test-Path "<REPO_DIR>\venv\Scripts\python.exe" # mcp 1.x installed? (MUST be < 2.0.0) & "<REPO_DIR>\venv\Scripts\python.exe" -c "import importlib.metadata as m; print(m.version('mcp'))"If it exists and mcp is
1.xโ STOP, don't install anything.NEVER upgrade / reinstall
mcp. The server uses themcp.server.fastmcp.FastMCPAPI which only exists in mcp 1.x. mcp 2.x completely reworked the API โ the server fails to start.requirements.txtalready pinsmcp>=1.2.0,<2.0.0.NEVER use
"command": "python"/"command": "python3". Always point to the venv python with an absolute path โ PATH differs per agent (e.g. store-alias on Windows, orpythonpointing to a different interpreter without dependencies). Venv path:<REPO_DIR>\venv\Scripts\python.exeNEVER reinstall / upgrade while another agent is running. The single
venvis shared.pip install/pip upgradein the middle mutates the dependencies used by all agents โ other agents break (real case: mcp bumped to 2.x removedFastMCP). Install ONCE viainstall.bat.One venv + one server.py โ many separate config files. Each agent has its own MCP config file; paste the same entry (see
mcp-config.example.json) into each file. Don't overwrite another agent's config.Verify after configuring โ test 1 tool from EACH agent before using together:
# import must succeed without errors (run from the project folder) cd "<REPO_DIR>" & "<REPO_DIR>\venv\Scripts\python.exe" -c "import server; print('server OK')"Or call a tool directly from each agent's chat (
idx_price BBRI). Don't continue if any agent still errors.
๐ฆ Modules & Tools (30 total)
Technical Analysis โ 6 tools (tradingview-ta)
Tool | Description |
| Full TA: RSI, MACD, BB, EMA, ADX, Stoch, CCI |
| TA for many symbols (max 25, rate-limited) |
| Multi-timeframe: 1h + 4h + 1d + 1w alignment |
| Detect 15 candlestick patterns |
| Bollinger Band: position, bandwidth, squeeze |
| Screen stocks by TA signal + RSI filter |
Yahoo Finance โ 4 tools (yfinance)
Tool | Description |
| Realtime price (AAPL, BTC-USD, BBRI.JK, ^JKSE) |
| Market cap + 52w high/low + TA context |
| Global snapshot: S&P500, NASDAQ, VIX, IHSG, BTC, ETH, GOLD, OIL, DXY |
| Historical OHLCV (configurable period + interval) |
IDX / BEI โ 11 tools
Tool | Description |
| BEI stock price (auto |
| BEI stock TA via TradingView Screener |
| BEI stock MTF |
| IHSG snapshot + top 10 LQ45 + gainers/losers |
| Screen BEI stocks by movement & volume |
| BUY/SELL/HOLD signals for a BEI stock list |
| Backtest strategies on BEI stocks |
| 100pt stock score (trend/momentum/volatility) |
| Morning brief: scan BEI watchlist, rank TA + price |
| TA + Price + Sentiment โ STRONG BUY/SELL |
| Live headlines (Yahoo, CNBC, MarketWatch) |
Backtesting โ 3 tools (services/backtest_service.py)
Tool | Description |
| 1 strategy, institutional metrics |
| Compare 9 strategies, ranked by total return |
| Walk-forward, overfitting detection |
Trading Utilities & Sentiment โ 6 tools
Tool | Description |
| Sentiment from Yahoo News for a symbol |
| Lot size by risk management |
| Risk:Reward ratio from entry/SL/TP |
| Log a trade to the local journal |
| Trade journal history |
| Global trading sessions (WIB / UTC+7) |
๐ง Requirements
Python >= 3.11 (tested on 3.11)
mcp >= 1.2.0, < 2.0.0 (MUST be 1.x โ server uses mcp.server.fastmcp.FastMCP)
tradingview-ta >= 3.3.0
yfinance >= 0.2.40
pandas >= 2.0.0
numpy >= 1.24.0
feedparser >= 6.0.0
requests >= 2.31.0Not needed
websocket-client/ Chrome โ the CDP module (TradingView Desktop) was removed on 03 Jul 2026.
๐ Installation
install.bat(Windows) or the manual commands below โ run ONCE. After installation, replace every<REPO_DIR>in the config examples with the absolute path where you cloned this repo on your machine.
Windows
install.batLinux / macOS (VPS-compatible)
python3 -m venv venv
venv/bin/pip install -r requirements.txtVerify (all OS)
venv/Scripts/python server.py # Windows
venv/bin/python server.py # Linux/macOS โ MCP stdio server, waits for JSON-RPC on stdinNEVER run a bare
pip install mcp/ upgrade mcp.requirements.txtpinsmcp>=1.2.0,<2.0.0โ mcp 2.x completely reworked the API and is incompatible.
Quick smoke test (no network)
venv/Scripts/pip install pytest # Windows
venv/bin/pip install pytest # Linux/macOS
venv/Scripts/python -m pytest # Windows โ 13 passed
venv/bin/python -m pytest # Linux/macOS โ 13 passed๐ค Per-Agent Configuration (Universal โ stdio)
IMPORTANT: each agent has its own config file. Don't merge multiple agents into one file, and don't overwrite another agent's config.
Claude Code / Grok
~/.claude.json (global) or .mcp.json (project root) โ mcpServers:
{
"mcpServers": {
"tradingview-mcp-py": {
"command": "<REPO_DIR>\\venv\\Scripts\\python.exe",
"args": ["<REPO_DIR>\\server.py"],
"env": {}
}
}
}Hermes Agent
~/.hermes/config.yaml โ mcp_servers:
mcp_servers:
tradingview-mcp-py:
command: "<REPO_DIR>\\venv\\Scripts\\python.exe"
args: ["<REPO_DIR>\\server.py"]
type: stdioopencode
opencode.json (project root) โ mcp:
{
"mcp": {
"tradingview-mcp-py": {
"type": "local",
"command": ["<REPO_DIR>\\venv\\Scripts\\python.exe", "<REPO_DIR>\\server.py"]
}
}
}Absolute path is MANDATORY for
command(venv python) andargs(server.py). Don't use"command": "python". Ready-to-use example:mcp-config.example.json.
Verify
After registering, call a tool from each agent's chat, e.g.:
get_ta BBRI exchange=IDX screener=indonesia
idx_deep_analysis TLKM
morning_brief_idx๐ฅ Multi-Agent โ Several Agents on 1 Machine
Same pattern as other MCP servers in this workspace (yfinance-mcp-final, invezgo-mcp):
Rule | Explanation |
1 venv + 1 server.py โ N separate configs | All agents use the same venv & server, but each agent has its own config |
stdio | Each agent spawns its own Python process โ no port conflicts, no stdout contention |
Absolute path |
|
mcp pinned to 1.x |
|
Install once | Don't reinstall while another agent is running โ it mutates shared dependencies |
Check first | Before installing, run the checklist at the top of this README |
Most common error scenarios:
All tools error "unknown function" / import fails โ venv was upgraded to mcp 2.x or system python was used. Check:
venv\Scripts\python -c "import importlib.metadata as m; print(m.version('mcp'))"โ must be1.x."python: can't open file 'server.py'" โ use an absolute path, not relative.
Agent A works, agent B errors โ usually agent B uses
"command": "python"pointing to a different Python / one without dependencies. Point all agents to the same venv.Yahoo rate limit (429) across 4 agents at once โ expected; raise the
requests.Sessionretry inserver.pyor limit polling frequency.
๐ All AI Clients (Model-Agnostic)
This server uses MCP stdio transport โ usable by any AI model / client that supports MCP, not just one vendor:
Client | How to register |
Claude Code / Grok |
|
Claude Desktop | Add the block to |
Hermes Agent |
|
opencode |
|
Cursor / VS Code | Add to |
ChatGPT / others | If the client supports MCP stdio, point it to |
All clients above call the same tools (get_ta, idx_deep_analysis,
morning_brief_idx, etc.). Nothing is hardcoded to a specific model.
Multi-agent golden rule: one shared venv, but separate config per agent + absolute path. Don't merge all agents into a single config file.
๐ก Usage Examples
Analyze BBRI:
Analyze BBRI on IDX โ TA + sentiment + priceโ combined_analysis(symbol="BBRI", exchange="IDX", screener="indonesia")
Morning scan IDX:
Run morning brief for IDXโ morning_brief_idx()
Backtest:
Backtest TLKM with supertrend strategy for 1 yearโ idx_backtest(symbol="TLKM", strategy="supertrend", period="1y")
Position sizing:
Balance 10k, risk 1%, SL 50 pips, goldโ position_size(balance=10000, risk_pct=1, sl_pips=50, instrument="gold")
๐งฉ Module Dependency Map
TA tools โ tradingview-ta
YF tools โ yfinance
IDX tools โ tradingview-ta + yfinance
News/Sentiment โ feedparser + yfinance
Backtest โ services/backtest_service.py (pandas/numpy)All modules degrade gracefully โ missing library โ only that module's tools are off.
๐งช Testing
venv\Scripts\pip install pytest
venv\Scripts\python -m pytest # 13 passed (helpers, server import, market_cap mocked)Tests don't need network (mock yfinance / tradingview_ta).
๐ Part of J-SQUAD
The J-SQUAD IDX bot system:
ARA Hunter โ ARA detection
Bandar Hunter โ institutional accumulation detection
Signal Aggregator โ signal aggregation
KINARA ENGINE โ TradingView webhook โ Telegram
๐ License
See the LICENSE file โ MIT. Free to use, fork, and
develop. For security policy, see SECURITY.md.
This server cannot be installed
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 Servers
- Alicense-qualityBmaintenanceThe most complete AI-powered trading toolkit for Claude and MCP clients, offering backtesting, live sentiment, Yahoo Finance, and 30+ technical analysis tools in one MCP server.MIT
- AlicenseAqualityFmaintenanceA comprehensive MCP server for stock analysis and trading insights, including stock screening, fundamental analysis, insider trading, options analysis, social media research, and news analysis.1074MIT
- Flicense-qualityBmaintenanceA 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.
- FlicenseBqualityCmaintenanceA TradingView-style market research and charting MCP server that provides tools for market data, indicators, watchlists, and local HTML chart rendering without scraping TradingView.9
Related MCP Connectors
7-factor stock scoring MCP server. US/HK/CN, 74 stocks. Free + Premium (USDC/Base). x402 ready.
Hosted MCP for stocks, options, Greeks, brokers, order previews, alerts, and workflows.
MCP server exposing the Backtest360 engine API as tools for AI agents.
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/CenblueOne/tradingview-mcp-py'
If you have feedback or need assistance with the MCP directory API, please join our Discord server