home / mcp / zerodha mcp server
Provides Zerodha trading actions via MCP to interact with Kite Connect accounts through Claude.
Configuration
View docs{
"mcpServers": {
"aptro-zerodha-mcp": {
"command": "mcp",
"args": [
"install",
"main.py"
],
"env": {
"KITE_API_KEY": "your_api_key_here",
"KITE_API_SECRET": "your_api_secret_here"
}
}
}
}This MCP (Multi-Cloud Plugin) lets you access Zerodha trading capabilities directly from Claude. You install a local plugin that talks to Zerodha’s Kite Connect API and exposes trading actions to your Claude conversations, so you can check margins, view holdings, place orders, and manage mutual funds from a single AI interface.
Once you have the MCP configured, you can interact with Zerodha through Claude to perform common trading tasks. Authentication starts the first time you use Zerodha features, opening a local login flow and storing tokens for future sessions. Your session remains valid until the access token expires, at which point Claude will re-run the login flow automatically.
Practical actions you can perform include checking account margins, viewing portfolio holdings, checking current positions, getting live quotes for symbols, placing orders, and retrieving historical price data. You can also manage mutual funds by listing orders, placing or canceling SIPs, and viewing holdings. Each action maps to a specific tool available to Claude, so you can issue natural-language requests like “What are my margins on Zerodha?” or “Show my current holdings.”.
A typical authentication flow begins by opening a local server on port 5000 to start Zerodha login, after which the access token is saved for subsequent uses. The token cadence follows Zerodha’s authorization lifecycle, renewing as needed without manual re-authentication on every run.
mcp install main.pyPrerequisites you need before installing the MCP include Python and common development tooling. Ensure you have Python installed and access to terminal/command line to run the MCP install command shown above.
Configuration and environment variables to connect Zerodha are stored locally. You will create a .env file in your project root and add your Kite API credentials.
Important environment variables shown in the setup are:
- KITE_API_KEY: your Kite API key (Consumer Key)
- KITE_API_SECRET: your Kite API secret (Consumer Secret)
These credentials are stored in your local environment and are not transmitted to Claude or third parties.
Troubleshooting tips include verifying your .env values, ensuring port 5000 is free, and restarting the authentication flow if you encounter issues. If authentication fails, you can remove the .tokens file and re-run the login process.
Your Zerodha API credentials are stored only in your local .env file. Access tokens are kept in the .tokens file within your project directory. No credentials are sent to Claude or any external service; all authentication occurs directly with Zerodha.
Verifies authentication status and initiates login if needed
Starts the Zerodha login flow
Retrieves the request token after login
Retrieves portfolio holdings
Gets current positions
Retrieves account margins
Places a trading order
Gets quotes for specified symbols
Retrieves historical price data
Retrieves mutual fund orders
Places a mutual fund order
Cancels a mutual fund order
Gets available mutual fund instruments
Retrieves mutual fund holdings
Gets active SIPs
Creates a new SIP
Modifies an existing SIP
Cancels a SIP