Zerodha MCP Integration
Enables interaction with Zerodha's trading platform, allowing users to check account margins, view portfolio holdings, manage positions, get quotes, place orders, access historical data, and handle mutual fund operations including holdings, orders, SIPs, and browsing available funds.
Click on "Deploy 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., "@Zerodha MCP Integration Show me my current holdings on Zerodha"
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.
Zerodha MCP Integration
This project integrates Zerodha's trading platform with Claude AI using the Multi-Cloud Plugin (MCP) framework, allowing you to interact with your Zerodha trading account directly through Claude.
Setup Instructions
Installing via Smithery
To install zerodha-mcp for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @aptro/zerodha-mcp --client claude1. Create a Zerodha Developer Account
Go to Kite Connect and sign up for a developer account
Log in to your account at developers.kite.trade
2. Create a New App
Navigate to the "Apps" section in your Kite Developer dashboard
Click on "Create a new app"
Fill in the required details:
App Name: Choose a descriptive name (e.g., "Claude Zerodha Integration")
App Category: Select "Personal" or appropriate category
Redirect URL: Set to
http://127.0.0.1:5000/zerodha/auth/redirectDescription: Briefly describe your application's purpose
Submit the form to create your app
3. Get API Credentials
After creating your app, you'll receive:
API Key (also called Consumer Key)
API Secret (also called Consumer Secret)
These credentials will be displayed on your app's details page.
4. Configure Environment Variables
Create a
.envfile in the root directory of this projectAdd your API credentials to the file:
KITE_API_KEY=your_api_key_here
KITE_API_SECRET=your_api_secret_hereReplace your_api_key_here and your_api_secret_here with the actual credentials from step 3.
5. Install Dependencies
Make sure you have all required dependencies installed:
uv pip install kiteconnect fastapi uvicorn python-dotenv httpx6. Install MCP config on your Claude desktop app
Install the MCP config on your Claude desktop app:
mcp install main.pyThis command registers the Zerodha plugin with Claude, making all trading functionality available to the AI.
Related MCP server: Trade-MCP
Usage
After setup, you can interact with your Zerodha account via Claude using the following features:
Authentication
Can you please check if I'm logged into my Zerodha account and authenticate if needed?Stocks and General Trading
Check account margins:
What are my current margins on Zerodha?View portfolio holdings:
Show me my current holdings on ZerodhaCheck current positions:
What positions do I currently have open on Zerodha?Get quotes for symbols:
What's the current price of RELIANCE and INFY on NSE?Place an order:
Place a buy order for 10 shares of INFY at market price on NSEGet historical data:
Can you show me the historical price data for SBIN for the last 30 days?
Mutual Funds
View mutual fund holdings:
Show me my mutual fund holdings on ZerodhaGet mutual fund orders:
List all my mutual fund orders on ZerodhaPlace a mutual fund order:
Place a buy order for ₹5000 in the mutual fund with symbol INF090I01239Cancel a mutual fund order:
Cancel my mutual fund order with order ID 123456789View SIP details:
Show all my active SIPs on ZerodhaCreate a new SIP:
Set up a monthly SIP of ₹2000 for the fund with symbol INF090I01239 for 12 installmentsModify an existing SIP:
Change my SIP with ID 987654321 to ₹3000 per monthCancel a SIP:
Cancel my SIP with ID 987654321Browse available mutual funds:
Show me a list of available mutual funds on Zerodha
Authentication Flow
The first time you use any Zerodha functionality, Claude will:
Start a local server on port 5000
Open a browser window for Zerodha login
After successful login, store the access token for future sessions
Your session will remain active until the token expires (typically 24 hours). When the token expires, Claude will automatically initiate the login flow again.
Available MCP Tools
This plugin offers the following MCP tools that Claude can use:
Authentication
check_and_authenticate- Verifies authentication status and initiates login if neededinitiate_login- Starts the Zerodha login flowget_request_token- Retrieves the request token after login
Stock/General Trading
get_holdings- Retrieves portfolio holdingsget_positions- Gets current positionsget_margins- Retrieves account marginsplace_order- Places a trading orderget_quote- Gets quotes for specified symbolsget_historical_data- Retrieves historical price data
Mutual Funds
get_mf_orders- Retrieves mutual fund ordersplace_mf_order- Places a mutual fund ordercancel_mf_order- Cancels a mutual fund orderget_mf_instruments- Gets available mutual fund instrumentsget_mf_holdings- Retrieves mutual fund holdingsget_mf_sips- Gets active SIPsplace_mf_sip- Creates a new SIPmodify_mf_sip- Modifies an existing SIPcancel_mf_sip- Cancels a SIP
Troubleshooting
If you encounter authentication issues, try removing the
.tokensfile and restart the authentication processMake sure your Zerodha credentials in the
.envfile are correctEnsure port 5000 is not being used by another application
For persistent issues, check Zerodha's API status at status.zerodha.com
Security Notes
Your Zerodha API credentials are stored only in your local
.envfileAccess tokens are stored in the
.tokensfile in the project directoryNo credentials are transmitted to Claude or any third parties
All authentication happens directly between you and Zerodha's servers
Available Tools
18 toolscancel_mf_orderC
Cancel a mutual fund order
Args: order_id: Order ID to cancel
Inputs: order_id (required).
cancel_mf_sipC
Cancel a mutual fund SIP
Args: sip_id: SIP ID to cancel
Inputs: sip_id (required).
check_and_authenticateB
Check if Kite is authenticated and initiate authentication if needed. Returns the authentication status and any relevant messages.
Inputs: no named parameters.
get_historical_dataC
Get historical data for an instrument
Args: instrument_token: Instrument token from_date: From date (format: 2024-01-01) to_date: To date (format: 2024-03-13) interval: Candle interval (minute, day, 3minute, etc.)
Inputs: instrument_token (required), from_date (required), to_date (required), interval (required).
get_holdingsB
Get user's holdings/portfolio
Inputs: no named parameters.
get_marginsC
Get account margins
Inputs: no named parameters.
get_mf_holdingsB
Get user's mutual fund holdings
Inputs: no named parameters.
get_mf_instrumentsB
Get all available mutual fund instruments
Inputs: no named parameters.
get_mf_ordersB
Get all mutual fund orders
Inputs: no named parameters.
get_mf_sipsB
Get all mutual fund SIPs
Inputs: no named parameters.
get_positionsC
Get user's positions
Inputs: no named parameters.
get_quoteC
Get quote for symbols
Args: symbols: List of symbols (e.g., ['NSE:INFY', 'BSE:RELIANCE'])
Inputs: symbols (required).
get_request_tokenB
Get the current request token after login redirect
Inputs: no named parameters.
initiate_loginA
Start the Zerodha login flow by opening the login URL in a browser and starting a local server to handle the redirect
Inputs: no named parameters.
modify_mf_sipB
Modify a mutual fund SIP
Args: sip_id: SIP ID to modify amount: New amount per instalment frequency: New frequency (weekly, monthly, or quarterly) instalments: New number of instalments instalment_day: New day of month/week for instalment status: SIP status (active or paused)
Inputs: sip_id (required), amount, frequency, instalments, +2 more.
place_mf_orderC
Place a mutual fund order
Args: tradingsymbol: Trading symbol (e.g., 'INF090I01239') transaction_type: BUY or SELL amount: Amount to invest or redeem tag: Optional tag for the order
Inputs: tradingsymbol (required), transaction_type (required), amount (required), tag.
place_mf_sipB
Place a mutual fund SIP (Systematic Investment Plan)
Args: tradingsymbol: Trading symbol (e.g., 'INF090I01239') amount: Amount per instalment instalments: Number of instalments (minimum 6) frequency: weekly, monthly, or quarterly initial_amount: Optional initial amount instalment_day: Optional day of month/week for instalment (1-31 for monthly, 1-7 for weekly) tag: Optional tag for the SIP
Inputs: tradingsymbol (required), amount (required), instalments (required), frequency (required), +3 more.
place_orderC
Place an order on Zerodha
Args: tradingsymbol: Trading symbol (e.g., 'INFY') exchange: Exchange (NSE, BSE, NFO, etc.) transaction_type: BUY or SELL quantity: Number of shares/units product: Product code (CNC, MIS, NRML) order_type: Order type (MARKET, LIMIT, SL, SL-M) price: Price for LIMIT orders trigger_price: Trigger price for SL orders
Inputs: tradingsymbol (required), exchange (required), transaction_type (required), quantity (required), +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
Every tool has a clearly distinct purpose with no ambiguity. Tools are well-organized into authentication, data retrieval, mutual fund operations, and trading operations, with clear boundaries between categories. For example, get_mf_holdings and get_holdings serve different asset classes, and place_mf_order versus place_order handle different instrument types.
Tool names follow a highly consistent verb_noun pattern throughout, with clear action prefixes (get_, place_, cancel_, modify_, initiate_, check_) followed by specific nouns. All tools use snake_case consistently, and naming conventions are predictable across the entire set, making it easy to understand tool purposes at a glance.
With 18 tools, this server provides comprehensive coverage for Zerodha trading and mutual fund operations without being overwhelming. The count is well-scoped for the domain, covering authentication, market data, portfolio management, mutual fund lifecycle, and order execution—each tool earns its place in supporting complete trading workflows.
The tool surface provides complete CRUD/lifecycle coverage for both trading and mutual fund domains. For mutual funds, it covers order placement, SIP management, holdings, instruments, and cancellation/modification. For trading, it covers order placement, positions, holdings, margins, and historical data. Authentication tools handle the complete login flow, leaving no obvious gaps for agent operations.
Maintenance
Related MCP Connectors
Indian broker accounts for AI agents: positions, holdings, orders, P&L, option chains, 10+ brokers.
Trade Robinhood through natural language in Claude Code.
Connect brokerage accounts to AI assistants: holdings, orders, asset lookup, and approved trading.
Connect Claude, ChatGPT, Codex, Claude Code or another MCP client to your real multi-broker investment portfolio. Fortunest tracks stocks, ETFs and crypto across brokers and exchanges; its MCP server lets your agent read holdings, returns, allocation, risk, trades and tax lots, calculated by Fortunest rather than guessed by the model. Reads run on their own; every change waits for your approval in the Fortunest app, and no tool places an order or moves money. Sign-in is OAuth 2.1 and needs Fortunest Pro (14-day trial, no card). A free demo that needs no account is listed as Fortunest demo.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with the Zerodha trading platform for placing stock orders, viewing portfolio holdings, and managing mutual fund investments. Provides secure OAuth authentication and real-time trading capabilities through Zerodha's official API.1-
- FlicenseNot gradedqualityDmaintenanceEnables trading automation through Zerodha Kite Connect API, allowing users to place buy/sell orders and fetch holdings via MCP tools accessible to Claude Desktop and other MCP-compatible clients.-
- FlicenseNot gradedqualityDmaintenanceEnables 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.1-
- FlicenseNot gradedqualityDmaintenanceEnables AI models to interact with the Zerodha trading platform for portfolio management, trading, and account operations through natural language.3-