Zerodha Kite MCP
MCP server for Zerodha Kite Connect API - India's leading stock broker trading platform. Execute ...
Ask AI about Zerodha Kite MCP
Powered by Claude · Grounded in docs
I know everything about Zerodha Kite MCP. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Zerodha Kite Connect MCP Server
An MCP (Model Context Protocol) server for integrating Zerodha's Kite Connect API with AI assistants like Claude. This server enables AI assistants to execute trades, manage portfolios, and access real-time market data from Indian stock exchanges.
Features
- Trading Operations: Place, modify, and cancel orders
- Portfolio Management: View positions, holdings, and margins
- Market Data: Get real-time quotes and historical data
- Order Management: Track orders and trades
- User Information: Access profile and account details
Prerequisites
- Zerodha Trading Account: You need an active Zerodha trading account
- Kite Connect Developer Account: Register at Kite Connect
- API Credentials: Create an app on Kite Connect to obtain:
- API Key
- API Secret
- 2FA Setup: Enable TOTP-based two-factor authentication on your Zerodha account
Installation
Using Docker (Recommended)
docker pull mcp/zerodha-kite:0.1.0
# or use latest
docker pull mcp/zerodha-kite:latest
From Source
git clone https://github.com/anshuljain90/zerodha-kite-mcp.git
cd zerodha-kite-mcp
npm install
npm run build
Configuration
Environment Variables
Create a .env file with your credentials:
KITE_API_KEY=your_api_key_here
KITE_API_SECRET=your_api_secret_here
KITE_ACCESS_TOKEN=your_access_token_here # Optional, can be generated at runtime
KITE_REDIRECT_URL=http://localhost:3000/redirect
Docker Desktop Integration
- Open Docker Desktop with MCP Toolkit enabled
- Import the Zerodha Kite MCP server
- Configure your API credentials in the settings
- Enable the server and connect it to your AI assistant
Authentication Flow
The Kite Connect API uses OAuth 2.0:
- Generate Login URL: Use your API key to create a login URL
- User Authorization: User logs in and authorizes the app
- Receive Request Token: Get the request token from the redirect
- Exchange for Access Token: Use API secret to get access token
- API Access: Use access token for all API calls
Available Tools
Trading
place_order- Place buy/sell ordersmodify_order- Modify pending orderscancel_order- Cancel pending orders
Portfolio
get_positions- View open positionsget_holdings- View demat holdingsget_margins- Check available margins
Market Data
get_quote- Get real-time quotesget_historical_data- Get historical OHLC dataget_instruments- List tradeable instrumentsget_ltp- Get last traded prices
Order Management
get_orders- View all ordersget_trades- View executed tradesget_order_history- Get order modification history
Account
get_profile- Get user profileget_market_status- Check if markets are open
Usage Examples
Place a Market Order
{
"tool": "place_order",
"arguments": {
"exchange": "NSE",
"tradingsymbol": "RELIANCE",
"transaction_type": "BUY",
"quantity": 10,
"order_type": "MARKET",
"product": "CNC"
}
}
Get Current Holdings
{
"tool": "get_holdings",
"arguments": {}
}
Get Real-time Quote
{
"tool": "get_quote",
"arguments": {
"exchange": "NSE",
"tradingsymbol": "INFY"
}
}
Development
Running Locally
npm run dev
Building
npm run build
Testing
npm test
Linting
npm run lint
Important Notes
- Market Hours: Indian markets operate 9:15 AM - 3:30 PM IST on weekdays
- Product Types:
CNC: Cash and Carry (delivery)MIS: Margin Intraday Square-offNRML: Normal (for F&O)
- Order Types:
MARKET: Market orderLIMIT: Limit orderSL: Stop-loss limitSL-M: Stop-loss market
- Rate Limits: Be mindful of API rate limits
- Security: Never expose API secrets in logs or responses
Docker Build
To build the Docker image locally:
docker build -t zerodha-kite-mcp .
Release Information
- Current Version: 0.1.0
- Release Date: 2025-01-24
- Changelog: See CHANGELOG.md for detailed release notes
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
License
MIT License - see LICENSE file for details
Support
Compliance
This MCP server is for legitimate trading purposes only. Users must comply with SEBI regulations and Zerodha's terms of service. Automated trading may require additional approvals from the exchange.
Disclaimer
This is an unofficial integration. Use at your own risk. The authors are not responsible for any financial losses incurred through the use of this software.
