zerodha-mcp-go

MCP.Pizza Chef: sukeesh

Zerodha MCP Server is a Golang-based implementation of the Model Completion Protocol (MCP) that connects Zerodha trading account data with AI models like Claude. It enables secure, real-time access to your Zerodha Kite trading information through the MCP interface, facilitating AI-driven workflows and analysis. Requires Go 1.21+, Zerodha Kite account, and API credentials from Kite Connect developer portal.

Use This MCP server To

Access Zerodha trading data within AI workflows Enable Claude AI to query Zerodha account information Integrate Zerodha trading data into custom AI applications Automate trading data retrieval for analysis Build AI-powered trading assistants using Zerodha data

README

Zerodha MCP Server

Protocol to communicate with your Zerodha data written in Golang

Zerodha MCP Logo

Go

Overview

Zerodha MCP Server provides an implementation of the Claude MCP (Model Completion Protocol) interface for Zerodha trading data. This allows Claude AI to access your Zerodha trading account information directly.

Prerequisites

Installation

Option 1: Using Go Install

go install github.com/sukeesh/zerodha-mcp@latest

Option 2: Build from Source

git clone https://github.com/sukeesh/zerodha-mcp.git
cd zerodha-mcp
go install

The binary will be installed to your GOBIN directory, which should be in your PATH.

Usage with an MCP Client

GPT 4o mini

5ire.as.MCP.Client.mp4

Claude Sonnet 3.7

Claude as MCP Client

Configuration

  1. Get your ZERODHA_API_KEY and ZERODHA_API_SECRET from the Kite Connect developer portal

  2. Set up a redirect URL in the Kite developer portal:

    http://127.0.0.1:5888/auth
    
  3. Configure Claude Desktop:

    • Open Claude Desktop → Settings → Developer → Edit Config
    • Add the following to your claude_desktop_config.json:
{
  "mcpServers": {
    "zerodha": {
      "command": "<path-to-zerodha-mcp-binary>",
      "env": {
       "ZERODHA_API_KEY": "<api_key>",
       "ZERODHA_API_SECRET": "<api_secret>"
      }
    }
  }
}
  1. Restart Claude Desktop. When prompted, authenticate with your Zerodha Kite credentials.

Debugging

The logs for MCP Server are available at ~/Library/Logs/Claude

Known Bugs

When the Claude desktop is shutdown, the underlying MCP Server is not getting killed.

kill -9 $(lsof -t -i:5888)

Available Tools

Category Tool Status Description
Account Information get_user_profile Get basic user profile information
get_user_margins Get all user margins
get_user_segment_margins Get segment-wise user margins
Portfolio & Positions get_kite_holdings Get current holdings in Zerodha Kite account
get_positions Get current day and net positions
get_order_margins Get margin requirements for specific orders
Market Data get_ltp Get Last Traded Price for specific instruments
get_quote Get detailed quotes for specific instruments
get_ohlc Get Open, High, Low, Close quotes
Instruments get_instruments Get list of all available instruments on Zerodha
get_instruments_by_exchange Get instruments filtered by exchange
get_auction_instruments Get instruments available for auction sessions
Mutual Funds get_mf_instruments Get list of all available mutual fund instruments
get_mf_holdings Get list of mutual fund holdings
get_mf_holdings_info Get detailed information about mutual fund holdings
get_mf_orders Get list of all mutual fund orders
get_mf_order_info Get detailed information about specific mutual fund orders
get_mf_sip_info Get information about mutual fund SIPs
get_mf_allotted_isins Get allotted mutual fund ISINs

Usage

After setup, you can interact with your Zerodha account data directly through Claude. For example:

  • "Show me my current portfolio holdings"
  • "What's my current margin availability?"
  • "Give me the latest price for RELIANCE"
  • "Show me my open positions with P&L"

Limitations

  • Only read operations are supported; trading is not yet available
  • Authentication token expires daily and requires re-login

zerodha-mcp-go FAQ

How do I install the Zerodha MCP Server?
Install Go 1.21 or later, then use 'go install' or clone the repo and build from source as per the GitHub instructions.
What prerequisites are needed to use this server?
You need a Zerodha Kite trading account, API credentials from Kite Connect, and Go 1.21+ installed.
Can this server work with AI models other than Claude?
While designed for Claude MCP, it can be adapted for other MCP-compatible LLMs like OpenAI GPT-4 and Anthropic Claude.
How does the server ensure secure access to my trading data?
It uses API credentials from the Kite Connect developer portal, ensuring authenticated and scoped access.
Is the server actively maintained and tested?
Yes, it includes GitHub Actions for continuous integration and is actively maintained on GitHub.
Can I customize the server for additional Zerodha data endpoints?
Yes, since it is open source and written in Go, you can extend it to support more endpoints.
What platforms does the server support?
It runs wherever Go 1.21+ is supported, including Linux, macOS, and Windows.
How do I get API credentials for Zerodha?
Register an app on the Kite Connect developer portal to obtain API key and secret needed for authentication.