Zerodha Kite Connect MCP
Provides tools for interacting with the Zerodha Kite Connect trading platform via its Python SDK, enabling login/session lifecycle management, order placement/modification/cancellation, portfolio and positions, holdings, market quotes, OHLC/LTP, historical data, margin calculations, GTT, mutual fund orders and SIPs, auction operations, and KiteTicker WebSocket management including connect, subscribe, unsubscribe, mode changes, and tick retrieval.
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 Kite Connect MCP
An MCP server that exposes Kite Connect's Python SDK operations as tools. REST methods run in worker threads so synchronous SDK requests do not block the MCP event loop. KiteTicker is controlled through dedicated WebSocket tools.
Setup
Requires Python 3.10 or newer.
cd D:\PRO\Zerodha_MCP
py -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt
Copy-Item .env.example .envSet KITE_API_KEY and KITE_API_SECRET in .env. The default callback is
http://127.0.0.1:5000/login; set KITE_REDIRECT_URL if the redirect URL
registered in the Kite developer console is different. The URL must match
exactly, including host, port, and path. Keep .env private; it is ignored by
Git.
The MCP starts a Flask loopback callback listener on that URL using the flow in
login.py. Call kite_login to get a Zerodha login link. After sign-in, Kite redirects to /login with a
short-lived request_token; the MCP exchanges it for an access token, updates
the running client, and persists the token to .env. The browser page reports
success without displaying the token. If any authenticated SDK tool gets a Kite
TokenException, it returns an authentication_required result with a fresh
login link. Complete login, then retry the original tool. The direct
generate_session and set_access_token tools also persist refreshed tokens.
Start using stdio:
python server.pyExample MCP client configuration:
{
"mcpServers": {
"zerodha-kite-connect": {
"command": "D:\\PRO\\Zerodha_MCP\\.venv\\Scripts\\python.exe",
"args": ["D:\\PRO\\Zerodha_MCP\\server.py"],
"env": {
"KITE_API_KEY": "your-api-key",
"KITE_API_SECRET": "your-api-secret",
"KITE_REDIRECT_URL": "http://127.0.0.1:5000/login"
}
}
}
}Related MCP server: Trade-MCP
Tools
Every REST SDK method has its own tool name. Its SDK keyword parameters are
passed inside an arguments JSON object. Examples include place_order,
orders, order_history, order_trades, positions, holdings, quote,
ohlc, ltp, instruments, historical_data, margin calculations, GTT,
mutual fund orders and SIPs, session login/token lifecycle, and auction tools.
The exact accepted parameters and values are those of the installed
kiteconnect SDK; Kite Connect's own validation and errors are returned.
The ticker_* tools manage the KiteTicker WebSocket: connect, subscribe,
unsubscribe, set mode, check connection, read recent ticks, resubscribe, stop
retries, stop, and close. Call ticker_connect before subscribing. Recent ticks
are kept in a bounded in-memory buffer (up to 5,000) and retrieved with
ticker_read_ticks.
Optional SQLite audit batching
Audit logging is disabled by default. Set MCP_AUDIT_ENABLED=true to queue tool
calls in memory and write them to SQLite with executemany from a background
worker. With the setting false, the server does not open or create a SQLite
database and does not store tool call logs. When enabled, the worker flushes at
the configured batch size, after the interval for partial batches, and on clean
shutdown.
Environment variable | Default | Purpose |
|
| Enable or disable all SQLite audit logging |
|
| SQLite audit database path |
|
| Calls per batch flush |
|
| Max delay for partial batches |
When enabled, the tool_calls table stores UTC time, tool name, JSON arguments
and result, error text, and duration in milliseconds. Credential fields such as
access, refresh, request, and API secret tokens are redacted. Large JSON values
are truncated to keep the audit database bounded per call. Since batching is
in-memory, an abrupt process termination can lose the pending batch.
Notes
This server sends real requests to the authenticated Kite account. Order placement, modification, cancellation, GTT, and mutual fund tools can cause financial transactions.
The registered redirect URL must be reachable on the same machine running this MCP process. Port 5000 must be free when using the default URL.
Kite redirects with a
request_token, not an access code. The callback exchanges it server-side; the API secret and access token are not shown in the browser response.Ticker and REST methods require an active Kite session. The daily session lifecycle and API permissions are controlled by Zerodha.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Open-source MCP server for Zerodha Kite Connect. Portfolio, market data, backtesting, alerts.
MCP server exposing the Backtest360 engine API as tools for AI agents.
Trading MCP server for AI agents, with live market data, account reads and controlled execution.
Create and manage trading strategies, bots, webhooks and signals from any MCP client.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that integrates with Zerodha APIs for automated trading, providing tools for authentication, market data retrieval, order placement, and portfolio management.MIT
- 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 assistants to interact with the Zerodha trading platform for placing stock orders, viewing holdings, and managing mutual fund investments through the MCP protocol.4-