tradingview
A high-performance FastMCP server for programmatically scraping TradingView market data. The server provides unified endpoints for retrieving historical price data, computing technical indicators, and extracting market-relevant news. It is designed for automated research workflows, trading systems, and data-driven analytics pipelines.
claude mcp add --transport stdio smitkunpara-tradingview-mcp uv run python server.py \ --env TRADINGVIEW_COOKIE="your_tradingview_cookies_here"
How to use
This MCP server exposes both a stdio (MCP) interface and a REST HTTP API for real-time TradingView data scraping and paper trading. The stdio interface is intended for AI assistants or other MCP clients that communicate over the MCP protocol via standard input/output. The available tools cover Market Data, News, Community insights, Options data, and a beta Paper Trading suite, enabling tasks such as fetching historical data, getting indicators, retrieving news, pulling trading ideas, and simulating trades with P&L tracking. The HTTP API (Vercel) provides REST endpoints for direct integration into web apps or services, with similar capabilities and additional HTTP-based workflows. Use the stdio interface for AI-driven workflows and the HTTP API for external apps or browser-based integrations.
To use the stdio MCP server, run the server process and connect your MCP client to the process via standard in/out. The TradingView server exposes tools like get_historical_data, get_all_indicators, get_news_headlines, get_news_content, get_ideas, get_minds, get_option_chain_greeks, get_nse_option_chain_oi, and paper trading operations such as place_order, close_position, view_positions, show_capital, set_alert, alert_manager, view_available_alerts, and remove_alert. When running the server, ensure the required environment variable TRADINGVIEW_COOKIE is set with your TradingView cookies to enable data access.
If you prefer REST, you can query the HTTP API endpoints once the HTTP server is running, typically at http://localhost:4589, to fetch data or perform actions like creating paper trades directly via HTTP requests.
How to install
Prerequisites:
- Python 3.8+ installed on your system
- Git installed
- Optional: uvx/pipx installed to manage the MCP runtime (the project uses uv for the MCP interface)
Installation steps:
-
Clone the repository: git clone https://github.com/smitkunpara/tradingview-mcp.git cd tradingview-mcp
-
Set up the runtime for MCP (UV/uvx):
If you use pipx to install uvx (recommended):
python -m pip install --user pipx python -m pipx ensurepath pipx install uvx
Or install uvx via your preferred method per the project's guidance
-
Configure environment for TradingView cookies: cp .env.example .env # then edit .env with your TradingView cookie
In this setup, TRADINGVIEW_COOKIE is required for the MCP stdio server
-
Start the MCP stdio server (MCP itself): uv sync uv run python server.py
-
(Optional) Start the HTTP API server (Vercel-based REST endpoints): uv run python vercel/app.py
-
Configure MCP client (examples): In .vscode/mcp.json, the TradingView entry should look like: { "servers": { "TradingView": { "command": "uv", "args": ["run", "python", "server.py"], "env": { "TRADINGVIEW_COOKIE": "your_tradingview_cookies_here" } } } }
Additional notes
Notes and tips:
- Paper trading is optional and can be disabled by removing or commenting out the paper trading imports and registrations in both the stdio server and the Vercel HTTP API, as described in the README.
- The TRADINGVIEW_COOKIE environment variable is required for data access; ensure you supply a valid cookie from TradingView.
- The HTTP endpoints (Vercel) are in beta; expect possible edge-case issues and verify results against the MCP stdio tools when possible.
- If you modify paper trading components, tests and the documentation cover how to re-enable or disable features; keep your environment variables aligned with the enabled features.
- The available tools are grouped into categories (Market Data, News, Community, Options, Paper Trading). Use the appropriate tool names when constructing MCP requests from your client.
Related MCP Servers
unsplash
🔎 A MCP server for Unsplash image search.
pydantic-rpc
PydanticRPC is a Python library for rapidly exposing Pydantic models as gRPC, ConnectRPC, and MCP services without protobuf files.
python
🔐 Plug-and-play auth for Python MCP servers.
mcp-android -python
MCP Android agent - This project provides an *MCP (Model Context Protocol)* server for automating Android devices using uiautomator2. It's designed to be easily plugged into AI agents like GitHub Copilot Chat, Claude, or Open Interpreter to control Android devices through natural language.
ptt_mcp_server
The best PTT MCP server
Vector-Knowledge-Base
A semantic search engine that transforms your documents into an intelligent, searchable knowledge base using vector embeddings and AI