Python environment for the Twelve Data SDK, plus an MCP server that exposes live market data to Claude Desktop.
git clone https://github.com/headstrongpete/twelvedata-mcp.git
cd twelvedata-mcp
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtGet a key at https://twelvedata.com/account/api-keys, then:
cp .env.example .env # edit .env and paste your keyBoth the example script and the MCP server read TWELVEDATA_API_KEY from the
environment, falling back to this .env file.
source .venv/bin/activate
python example.py # fetches AAPL, prints a DataFrame, writes aapl.htmltd_mcp_server.py is an MCP server that lets Claude pull market data into a chat.
Tools exposed:
| Tool | Description |
|---|---|
search_symbols |
Find tickers by name/ticker |
get_price |
Latest real-time price |
get_quote |
Full quote (OHLCV, change, 52-wk range) |
get_time_series |
Historical OHLCV bars |
get_technical_indicator |
Any of 103 indicators (RSI, MACD, SMA, …) |
list_indicators |
Names accepted by get_technical_indicator |
get_exchange_rate |
Forex rate for a pair (e.g. USD/JPY) |
convert_currency |
Convert an amount across a pair |
get_company_profile |
Sector, industry, description (plan-dependent) |
get_statistics |
Valuation & key stats (plan-dependent) |
get_earnings |
Earnings history/estimates (plan-dependent) |
get_dividends |
Dividend history (plan-dependent) |
get_api_usage |
Remaining API credits on your plan |
Add a twelvedata entry to your claude_desktop_config.json:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"twelvedata": {
"command": "/absolute/path/to/twelvedata-mcp/.venv/bin/python",
"args": ["/absolute/path/to/twelvedata-mcp/td_mcp_server.py"]
}
}
}Use absolute paths. The API key is not stored in the config — the
server loads it from the .env file next to td_mcp_server.py.
To activate: fully quit and reopen Claude Desktop. Then in a chat, the
twelvedata tools appear under the tools/🔌 menu. Try: "What's the current RSI
for NVDA?" or "Compare the last month of AAPL vs MSFT."
source .venv/bin/activate
python td_mcp_server.py # stdio server (Ctrl-C to stop)
# or inspect it interactively:
mcp dev td_mcp_server.py- The websocket extra is named
websocket(installswebsocket-client), notwebsocket-client. Pinned versions are inrequirements-lock.txt. - Fundamentals tools (
get_company_profile,get_statistics,get_earnings,get_dividends) depend on your Twelve Data plan; on the free tier they may return an "not available" error, which the tool surfaces cleanly. - Prices are point-in-time market data, not investment advice.
MIT © Peter Squires