Skip to content
Back to search

kite-mcp-server

Zerodha Kite MCP server

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/zerodha--kite-mcp-server/badge.svg)](/listings/zerodha--kite-mcp-server)

HTML

<a href="/listings/zerodha--kite-mcp-server"><img src="/api/listings/zerodha--kite-mcp-server/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Hosted Version (Recommended)

The easiest way to get started is with our hosted version at `mcp.kite.trade`. Both `/mcp` and `/sse` endpoints are available - no installation or API keys required on your end.

**Quick Setup:** Add the following to your MCP configuration:

https://mcp.kite.trade/mcp

**Recommended:** Use the new HTTP mode (`/mcp` endpoint) for better performance and reliability. You can use [mcp-remote](https://github.com/modelcontextprotocol/mcp-remote) to connect to the hosted server.

For self-hosting with your own API keys, follow the installation steps below.

Prerequisites

- **For hosted version (recommended)**: Nothing! Just use `https://mcp.kite.trade/mcp` - **For self-hosting**: Go 1.21 or later - **For self-hosting**: Valid Kite Connect API credentials

Getting started

git clone https://github.com/zerodha/kite-mcp-server
cd kite-mcp-server

Configuration

Create a `.env` file with your Kite Connect credentials:

KITE_API_KEY=your_api_key
KITE_API_SECRET=your_api_secret
APP_MODE=http
APP_PORT=8080
APP_HOST=localhost
PUBLIC_BASE_URL=http://localhost:8080

You can also use the provided `justfile` to initialize the config.

just init-env

Running the Server

# Build and run
go build -o kite-mcp-server
./kite-mcp-server

# Or run directly
go run main.go

The server will start and serve a status page at `http://localhost:8080/`

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 323 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Kite MCP Server
  2. A Model Context Protocol (MCP) server that provides AI assistants with secure access to the Kite Connect trading API. This server enables AI agents to retrieve market data, manage portfolios, and execute trades through a standardized interface.
  3. ## TL;DR for Traders
  4. Want to use AI with your Kite trading account? Just add `https://mcp.kite.trade/mcp` to your AI client configuration. No installation or API keys required - it's hosted and ready to use.
  5. ## Features
  6. - **Portfolio Management**: View holdings, positions, margins, and mutual fund investments
  7. - **Order Management**: Place, modify, and cancel orders with full order history
  8. - **GTT Orders**: Good Till Triggered order management
  9. - **Market Data Access**: Real-time quotes, historical data, OHLC data
  10. - **Pagination Support**: Automatic pagination for large datasets (holdings, orders, trades)
  11. - **Comprehensive Coverage**: Implements most Kite Connect API endpoints
  12. - **Multiple Deployment Modes**: stdio, HTTP, SSE, and hybrid mode (production)
  13. - **Built-in Documentation**: Auto-served documentation at runtime
  14. ## Quick Start
  15. ### Hosted Version (Recommended)
  16. The easiest way to get started is with our hosted version at `mcp.kite.trade`. Both `/mcp` and `/sse` endpoints are available - no installation or API keys required on your end.
  17. **Quick Setup:** Add the following to your MCP configuration:
  18. ```
  19. https://mcp.kite.trade/mcp
  20. ```
  21. **Recommended:** Use the new HTTP mode (`/mcp` endpoint) for better performance and reliability. You can use [mcp-remote](https://github.com/modelcontextprotocol/mcp-remote) to connect to the hosted server.
  22. For self-hosting with your own API keys, follow the installation steps below.
  23. ### Prerequisites
  24. - **For hosted version (recommended)**: Nothing! Just use `https://mcp.kite.trade/mcp`
  25. - **For self-hosting**: Go 1.21 or later
  26. - **For self-hosting**: Valid Kite Connect API credentials
  27. ### Getting started
  28. ```bash
  29. git clone https://github.com/zerodha/kite-mcp-server
  30. cd kite-mcp-server
  31. ```
  32. ### Configuration
  33. Create a `.env` file with your Kite Connect credentials:
  34. ```env
  35. KITE_API_KEY=your_api_key
  36. KITE_API_SECRET=your_api_secret
  37. APP_MODE=http
  38. APP_PORT=8080
  39. APP_HOST=localhost
  40. PUBLIC_BASE_URL=http://localhost:8080
  41. ```
  42. You can also use the provided `justfile` to initialize the config.
  43. ```bash
  44. just init-env
  45. ```
  46. ### Running the Server
  47. ```bash
  48. # Build and run
  49. go build -o kite-mcp-server
  50. ./kite-mcp-server
  51. # Or run directly
  52. go run main.go
  53. ```
  54. The server will start and serve a status page at `http://localhost:8080/`
  55. ## Client Integration
  56. ### Setup Guide
  57. - [Claude Desktop (Hosted Mode)](#claude-desktop-http-mode) - Recommended
  58. - [Claude Desktop (HTTP Mode)](#claude-desktop-http-mode) - Recommended
  59. - [Claude Desktop (SSE Mode)](#claude-desktop-sse-mode)
  60. - [Claude Desktop (stdio Mode)](#claude-desktop-stdio-mode)
  61. - [Other MCP Clients](#other-mcp-clients)
  62. ### Claude Desktop (Hosted Mode)
  63. For the hosted version, add to your Claude Desktop configuration (`~/.config/Claude/claude_desktop_config.json`):
  64. ```json
  65. {
  66. "mcpServers": {
  67. "kite": {
  68. "command": "npx",
  69. "args": ["mcp-remote", "https://mcp.kite.trade/mcp"]
  70. }
  71. }
  72. }
  73. ```
  74. ### Claude Desktop (HTTP Mode)
  75. Add to your Claude Desktop configuration (`~/.config/Claude/claude_desktop_config.json`):
  76. ```json
  77. {
  78. "mcpServers": {
  79. "kite": {
  80. "command": "npx",
  81. "args": ["mcp-remote", "http://localhost:8080/mcp", "--allow-http"],
  82. "env": {
  83. "APP_MODE": "http",
  84. "KITE_API_KEY": "your_api_key",
  85. "KITE_API_SECRET": "your_api_secret"
  86. }
  87. }
  88. }
  89. }
  90. ```
  91. ### Claude Desktop (SSE Mode)
  92. Add to your Claude Desktop configuration (`~/.config/Claude/claude_desktop_config.json`):
  93. ```json
  94. {
  95. "mcpServers": {
  96. "kite": {
  97. "command": "npx",
  98. "args": ["mcp-remote", "http://localhost:8080/sse", "--allow-http"],
  99. "env": {
  100. "APP_MODE": "sse",
  101. "KITE_API_KEY": "your_api_key",
  102. "KITE_API_SECRET": "your_api_secret"
  103. }
  104. }
  105. }
  106. }
  107. ```
  108. ### Claude Desktop (stdio Mode)
  109. For self-hosted installations, you must first build the binary:
  110. ```bash
  111. go build -o kite-mcp-server
  112. ```
  113. Then add to your Claude Desktop configuration (`~/.config/Claude/claude_desktop_config.json`):
  114. ```json
  115. {
  116. "mcpServers": {
  117. "kite": {
  118. "command": "/full/path/to/your/kite-mcp-server",
  119. "env": {
  120. "APP_MODE": "stdio",
  121. "KITE_API_KEY": "your_api_key",
  122. "KITE_API_SECRET": "your_api_secret"
  123. }
  124. }
  125. }
  126. }
  127. ```
  128. **Important**: Use the full absolute path to your built binary. For example:
  129. - `/home/username/kite-mcp-server/kite-mcp-server` (Linux)
  130. - `/Users/username/kite-mcp-server/kite-mcp-server` (macOS)
  131. - `C:\Users\username\kite-mcp-server\kite-mcp-server.exe` (Windows)
  132. ### Other MCP Clients
  133. For other MCP-compatible clients, use the hosted endpoint `https://mcp.kite.trade/mcp` with [mcp-remote](https://github.com/modelcontextprotocol/mcp-remote) or configure your client to connect directly to the HTTP endpoint.
  134. ## Available Tools
  135. ### Setup & Authentication
  136. - `login` - Login to Kite API and generate authorization link
  137. ### Market Data
  138. - `get_quotes` - Get real-time market quotes
  139. - `get_ltp` - Get last traded price
  140. - `get_ohlc` - Get OHLC data
  141. - `get_historical_data` - Historical price data
  142. - `search_instruments` - Search trading instruments
  143. ### Portfolio & Account
  144. - `get_profile` - User profile information
  145. - `get_margins` - Account margins
  146. - `get_holdings` - Portfolio holdings
  147. - `get_positions` - Current positions
  148. - `get_mf_holdings` - Mutual fund holdings
  149. ### Orders & Trading
  150. - `place_order` - Place new orders
  151. - `modify_order` - Modify existing orders
  152. - `cancel_order` - Cancel orders
  153. - `get_orders` - List all orders
  154. - `get_trades` - Trading history
  155. - `get_order_history` - Order execution history
  156. - `get_order_trades` - Get trades for a specific order
  157. ### GTT Orders
  158. - `get_gtts` - List GTT orders
  159. - `place_gtt_order` - Create GTT orders
  160. - `modify_gtt_order` - Modify GTT orders
  161. - `delete_gtt_order` - Delete GTT orders
  162. ## API Coverage
  163. This server implements the majority of Kite Connect API endpoints and also provides additional tools.
  164. ## Development
  165. ### Development Environment
  166. This project includes a Nix flake for consistent development environments:
  167. ```bash
  168. # Enter development shell
  169. nix develop
  170. # Or with direnv
  171. direnv allow
  172. ```
  173. ### Using Just Commands
  174. Install [Just](https://github.com/casey/just) for convenient development commands:
  175. ```bash
  176. just build # Build the project
  177. just run # Run the server
  178. just test # Run tests
  179. just lint # Format and lint code
  180. just coverage # Generate coverage report
  181. ```
  182. ### Running Tests
  183. **Requirements:**
  184. - Go 1.23+ with `GOEXPERIMENT=synctest` (required for timing-dependent tests)
  185. ```bash
  186. # Run all tests
  187. just test
  188. # With coverage
  189. just coverage
  190. # With race detector
  191. just test-race
  192. # Direct go command (if you prefer)
  193. CGO_ENABLED=0 GOEXPERIMENT=synctest go test -v ./...
  194. ```
  195. #### Synctest Integration
  196. This project requires Go's `synctest` package for time-dependent tests (session expiry, clock skew tolerance). All timing tests use `synctest.Run()` for:
  197. - **Fast execution**: Time-dependent tests complete in milliseconds instead of minutes
  198. - **Deterministic timing**: No flaky timing-based test failures
  199. - **Controlled time**: Tests can advance time without actual delays
  200. The justfile automatically includes `GOEXPERIMENT=synctest` in all test commands.
  201. ## Configuration Options
  202. | Environment Variable | Default | Description |
  203. | -------------------- | ----------- | ---------------------------------------------------------- |
  204. | `KITE_API_KEY` | Required | Your Kite Connect API key |
  205. | `KITE_API_SECRET` | Required | Your Kite Connect API secret |
  206. | `APP_MODE` | `http` | Server mode: `stdio`, `http`, `sse`, or `hybrid` |
  207. | `APP_PORT` | `8080` | Server port (HTTP/SSE/hybrid modes) |
  208. | `APP_HOST` | `localhost` | Server host / bind address (HTTP/SSE/hybrid modes) |
  209. | `PUBLIC_BASE_URL` | derived | Public base URL used for browser-facing auth links |
  210. | `EXCLUDED_TOOLS` | _(empty)_ | Comma-separated list of tools to exclude from registration |
  211. **Note:** In production, we use hybrid mode which supports both `/sse` and `/mcp` endpoints, making both HTTP and SSE protocols available for different client needs.
  212. ### Tool Exclusion
  213. You can exclude specific tools by setting the `EXCLUDED_TOOLS` environment variable with a comma-separated list of tool names. This is useful for creating read-only instances.
  214. **Example:**
  215. ```env
  216. EXCLUDED_TOOLS=place_order,modify_order,cancel_order
  217. ```
  218. The hosted version at `mcp.kite.trade` excludes potentially destructive trading operations for security. For accessing the other operations you can generate your own API keys and run the server locally.
  219. ## Contributing
  220. 1. Fork the repository
  221. 2. Create a feature branch
  222. 3. Make your changes
  223. 4. Add tests for new functionality
  224. 5. Run `just lint` and `just test`
  225. 6. Submit a pull request
  226. ## License
  227. This project is licensed under the MIT License - see the LICENSE file for details.
  228. ## Support
  229. For bugs and general suggestions, please use GitHub Discussions.
  230. For Kite Connect API documentation, visit: https://kite.trade/docs/connect/

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.