Zerodha Trading MCP Server
Provides integration with Zerodha's trading APIs, enabling authentication, fetching stock prices and historical data, analyzing price changes, retrieving portfolio and positions, and generating buy/sell recommendations.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Zerodha Trading MCP Server
A MCP (Model Context Protocol) server built with FastMCP that gives an AI assistant read-only access to a Zerodha Kite account: holdings, positions, quotes, historical prices and rule-based price signals.
It cannot place, modify or cancel orders. That is enforced in code, not just stated: every Kite call goes through an allowlist, and anything else throws. See GOVERNANCE.md for the controls, where your data goes, and the known gaps.
Features
Authentication with Zerodha
Fetch stock prices from Zerodha
Analyze price changes
Get user portfolio
Rule-based buy/sell signals from fixed thresholds (not advice)
Find potential stocks to buy
Fetch historical data
Related MCP server: Kite MCP Server
Installation
Clone this repository
Install dependencies:
npm installConfigure Zerodha API credentials:
Create a
.envfile in the root directoryAdd your Kite Connect app credentials (see
.env.example):
API_KEY=your_kite_api_key
API_SECRET=your_kite_api_secretThe server never asks for your Zerodha password or PIN. You log in on Zerodha's own page, and the server only receives a short-lived request token.
Running the Server
You can run the server in different ways:
Using npm start
npm startUsing FastMCP CLI for testing
npm run devThis launches the FastMCP CLI for interactively testing the server in the terminal.
Using MCP Inspector for visual testing
npm run inspectThis launches the MCP Inspector web UI for testing the server.
Integrating with Cursor IDE
To integrate this MCP server with Cursor IDE:
Install Cursor IDE from https://cursor.sh/
Open Cursor settings
Navigate to "AI" > "MCP Servers"
Add a new MCP server configuration:
{
"mcpServers": {
"zerodha-trading-mcp": {
"command": "node",
"args": ["path/to/your/project/index.js"],
"env": {
"API_KEY": "your_zerodha_api_key",
"API_SECRET": "your_zerodha_api_secret"
}
}
}
}Replace path/to/your/project with the actual path to your project directory and add your Zerodha API credentials.
Restart Cursor
When using Claude or another AI assistant in Cursor, you should now see your Zerodha trading tools available for the AI to use.
Authentication Flow
Before using the tools that require authentication, you need to:
Call the
getLoginURLtool to get the Zerodha login URLVisit the URL and complete the login process
Copy the request token from the redirect URL
Call the
generateSessiontool with the request tokenNow you can use all the other tools that require authentication
The access token is held in server memory. It is never returned to the AI assistant, and it expires daily.
Available Tools
checkAuthStatus: Check if the Zerodha API client is authenticatedgetLoginURL: Get the Zerodha login URL for authenticationgenerateSession: Generate a session using the request token obtained after logingetProfile: Get user profile information from ZerodhagetPortfolio: Get user's stock portfolio (holdings) from ZerodhagetPositions: Get user's current day trading positions from ZerodhagetStockPrice: Get current market price for given stocksgetFavoriteStockPrices: Get current market price for favorite/common stocksanalyzePriceChanges: Analyze price changes for given stocksanalyzePortfolio: HOLD/SELL/REDUCE flags per holding from fixed rules (profit target, stop loss, allocation cap)findPotentialBuys: Watchlist stocks that have dropped past the buy threshold
Every tool call is written to stderr as one JSON audit line (tool, arguments, outcome, duration), with the request token redacted.
getHistoricalData: Get historical price data for a given instrument
Customizing the Server
You can modify the following files to customize the server:
config.js: Configure favorite stocks, trading parameters, and technical analysis parameterszerodha.js: Implement additional Zerodha API functionsindex.js: Add or modify tools
Disclaimer
This server is provided for educational and informational purposes only. It is not intended to provide investment advice. The signals are fixed thresholds in config.js, not recommendations. Holdings and positions returned by the tools are sent to whichever AI model your MCP client uses. Always conduct your own research before making investment decisions.
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect brokerage accounts to AI assistants: holdings, orders, asset lookup, and approved trading.
Indian broker accounts for AI agents: positions, holdings, orders, P&L, option chains, 10+ brokers.
Connect AI agents to bank accounts, transactions, balances, and investments.
Agentic brokerage access to a US brokerage account: quotes, orders, positions, cash and documents.
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-
- AlicenseBqualityDmaintenanceEnables trading and portfolio management on Zerodha Kite Connect through natural language. Supports placing orders, viewing positions/holdings, accessing real-time market data, and managing GTT orders.24MIT
- 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-