Skip to main content
Glama
mahAnuj

Zerodha Trading MCP Server

by mahAnuj

Zerodha Trading MCP Server

A MCP (Model Context Protocol) server built with FastMCP that interfaces with Zerodha broker APIs to provide stock trading tools and analysis.

Features

  • Authentication with Zerodha

  • Fetch stock prices from Zerodha

  • Analyze price changes

  • Get user portfolio

  • Get buy/sell recommendations

  • Find potential stocks to buy

  • Fetch historical data

Related MCP server: Kite MCP Server

Installation

  1. Clone this repository

  2. Install dependencies:

npm install
  1. Configure Zerodha API credentials:

    • Create a .env file in the root directory

    • Add your Zerodha API credentials:

# Zerodha API Credentials
API_KEY=your_api_key
API_SECRET=your_api_secret
USER_ID=your_user_id
PASSWORD=your_password
PIN=your_pin

# Optional - if you already have an access token
ACCESS_TOKEN=your_access_token

Running the Server

You can run the server in different ways:

Using npm start

npm start

Using FastMCP CLI for testing

npm run dev

This launches the FastMCP CLI for interactively testing the server in the terminal.

Using MCP Inspector for visual testing

npm run inspect

This launches the MCP Inspector web UI for testing the server.

Integrating with Cursor IDE

To integrate this MCP server with Cursor IDE:

  1. Install Cursor IDE from https://cursor.sh/

  2. Open Cursor settings

  3. Navigate to "AI" > "MCP Servers"

  4. 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.

  1. Restart Cursor

  2. 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:

  1. Call the getLoginURL tool to get the Zerodha login URL

  2. Visit the URL and complete the login process

  3. Copy the request token from the redirect URL

  4. Call the generateSession tool with the request token

  5. Now you can use all the other tools that require authentication

Available Tools

  • checkAuthStatus: Check if the Zerodha API client is authenticated

  • getLoginURL: Get the Zerodha login URL for authentication

  • generateSession: Generate a session using the request token obtained after login

  • getProfile: Get user profile information from Zerodha

  • getPortfolio: Get user's stock portfolio (holdings) from Zerodha

  • getPositions: Get user's current day trading positions from Zerodha

  • getStockPrice: Get current market price for given stocks

  • getFavoriteStockPrices: Get current market price for favorite/common stocks

  • analyzePriceChanges: Analyze price changes for given stocks

  • analyzePortfolio: Analyze portfolio for buy/sell recommendations

  • findPotentialBuys: Find potential stocks to buy based on price analysis

  • 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 parameters

  • zerodha.js: Implement additional Zerodha API functions

  • index.js: Add or modify tools

Disclaimer

This server is provided for educational and informational purposes only. It is not intended to provide investment advice. Always conduct your own research before making investment decisions.

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

0Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables 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
  • A
    license
    B
    quality
    D
    maintenance
    Enables 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.
    24
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables 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
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI models to interact with the Zerodha trading platform for portfolio management, trading, and account operations through natural language.
    3

View all related MCP servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mahAnuj/mcp-zerodha'

If you have feedback or need assistance with the MCP directory API, please join our Discord server