loading…
Search for a command to run...
loading…
Enables natural language access to Zerodha trading accounts for retrieving portfolio holdings, positions, orders, funds, and real-time market prices. Supports s
Enables natural language access to Zerodha trading accounts for retrieving portfolio holdings, positions, orders, funds, and real-time market prices. Supports secure authentication for Indian stock market trading operations via Claude, Cursor, and other MCP-compatible AI tools.
Query your Zerodha trading account via MCP (Model Context Protocol). Works with Claude Code, Claude Desktop, Cursor, and other MCP-compatible AI tools.
| Tool | Description |
|---|---|
get_account_funds |
Available balance and margins |
get_portfolio_holdings |
Long-term demat holdings |
get_open_positions |
Intraday/F&O positions with P&L |
get_todays_orders |
Today's order history |
get_current_pnl |
Combined P&L summary |
get_instrument_ltp |
Last traded price of any instrument |
get_instrument_ohlc |
OHLC data of any instrument |
get_pnl_summary |
Historical P&L summary for a date range (max 3 months) |
get_pnl_heatmap |
Daily P&L breakdown for a date range (max 3 months) |
git clone https://github.com/anish5256/zerodha-mcp.git
cd zerodha-mcp
pip install -e .
The server requires these environment variables for authentication:
| Variable | Description |
|---|---|
ZERODHA_USER_ID |
Your Zerodha client ID (e.g., AB1234) |
ZERODHA_PASSWORD |
Your Zerodha login password |
ZERODHA_TOTP_KEY |
Your TOTP secret key (32-character base32 string) |
Your TOTP secret key is the 32-character code you used when setting up 2FA in Google Authenticator/Authy. It looks like: ABCD1234EFGH5678IJKL9012MNOP3456
If you don't have it saved, reset 2FA in Zerodha Console to get a new one.
Add to ~/.mcp.json:
{
"mcpServers": {
"zerodha": {
"command": "python",
"args": ["/path/to/zerodha-mcp/server.py"],
"env": {
"ZERODHA_USER_ID": "YOUR_USER_ID",
"ZERODHA_PASSWORD": "YOUR_PASSWORD",
"ZERODHA_TOTP_KEY": "YOUR_TOTP_SECRET"
}
}
}
}
Then restart Claude Code.
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"zerodha": {
"command": "python",
"args": ["/path/to/zerodha-mcp/server.py"],
"env": {
"ZERODHA_USER_ID": "YOUR_USER_ID",
"ZERODHA_PASSWORD": "YOUR_PASSWORD",
"ZERODHA_TOTP_KEY": "YOUR_TOTP_SECRET"
}
}
}
}
Then restart Claude Desktop.
Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"zerodha": {
"command": "python",
"args": ["C:\\path\\to\\zerodha-mcp\\server.py"],
"env": {
"ZERODHA_USER_ID": "YOUR_USER_ID",
"ZERODHA_PASSWORD": "YOUR_PASSWORD",
"ZERODHA_TOTP_KEY": "YOUR_TOTP_SECRET"
}
}
}
}
Then restart Claude Desktop.
Add to Cursor's MCP settings (Settings > MCP):
{
"zerodha": {
"command": "python",
"args": ["/path/to/zerodha-mcp/server.py"],
"env": {
"ZERODHA_USER_ID": "YOUR_USER_ID",
"ZERODHA_PASSWORD": "YOUR_PASSWORD",
"ZERODHA_TOTP_KEY": "YOUR_TOTP_SECRET"
}
}
}
For any MCP-compatible client, configure:
python["/path/to/zerodha-mcp/server.py"]ZERODHA_USER_ID = Your client IDZERODHA_PASSWORD = Your passwordZERODHA_TOTP_KEY = Your TOTP secretOnce configured, ask your AI assistant:
zerodha_enctoken.txt and zerodha_console_token.txt (gitignored)MIT
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"zerodha-mcp-server": {
"command": "npx",
"args": []
}
}
}