Skip to main content
Glama
utkarshagar2121

KiteMCP

πŸ“ˆ KiteMCP – Zerodha Trading via MCP

KiteMCP is a command-based Zerodha trading system built using the KiteConnect API, Bun, and the Model Context Protocol (MCP). It allows real-time stock buy/sell operations through MCP command calls from a local server, currently integrated with Claude or any compatible tool interface.


πŸš€ Features

  • πŸ”„ Buy and sell stocks programmatically via commands

  • πŸ›  Modular MCP tool structure (buy-stock, sell-stock)

  • πŸ” Secure API key handling via .env

  • βœ… Schema validation using Zod

  • βš™οΈ Fast runtime with Bun and TypeScript

  • πŸ§ͺ Local test environment with log outputs


Related MCP server: Zerodha Trading MCP

πŸ”§ Setup Instructions

1. Clone the Repository

git clone https://github.com/your-username/zerodha-trade
cd zerodha-trade

2. Install Dependencies (using Bun)

bun install

3. Configure Environment Variables

Create a .env file in the root:

KITE_API_KEY=your_api_key
KITE_API_SECRET=your_api_secret
ACCESS_TOKEN=your_access_token

4. Start the MCP Server

bun index.ts

πŸ“Έ Screenshots

Claude AI making transaction

Zerodha server

πŸ“₯ Example Command Usage

Send the following JSON to the server via terminal or Claude:

{
  "id": "1",
  "action": "call_tool",
  "tool": "buy-stock",
  "arguments": {
    "symbol": "RELIANCE",
    "exchange": "NSE",
    "quantity": 10,
    "price": 2800
  }
}

βœ… Input Validation

All tool inputs are validated using Zod for:

  • Required fields: symbol, exchange, quantity

  • Type and range checks

  • Custom error messages on invalid input


πŸ§ͺ Example Output

{
  "status": "success",
  "message": "Buy order placed for RELIANCE at β‚Ή2800"
}

πŸ›‘οΈ Security Notes

  • Do not expose your .env file in production

  • Add rate limiting and request authentication if going public

  • Store order logs securely


πŸ“Œ Future Enhancements

  • 🌐 Deploy on cloud with webhook interface

  • πŸ“Š Add portfolio view and PnL tracking

  • πŸ”” Telegram/email alerts for order confirmations

  • 🧠 Auto-trading with strategy modules


πŸ‘¨β€πŸ’» Author

Utkarsh Agarwal
GitHub β€’ LinkedIn


πŸ“œ License

MIT License Β© 2025 Utkarsh Agarwal

-
security - not tested
F
license - not found
-
quality - not tested

Resources

Looking for Admin?

Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access the admin panel.

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/utkarshagar2121/KiteMCP'

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