- Home
- MCP servers
- Kite
Kite
- typescript
4
GitHub Stars
typescript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"linkwithjoydeep-kite-mcp": {
"command": "bun",
"args": [
"run",
"/path/to/kite-mcp/src/index.ts"
],
"env": {
"API_KEY": "YOUR_KITE_API_KEY",
"API_SECRET": "YOUR_KITE_API_SECRET",
"OAUTH_PORT": "50000"
}
}
}
}You install and run a MCP server that connects Zerodha Kite data and trading capabilities to an MCP client, such as Claude Desktop. This server handles authentication, market data, portfolio and order management, and account information, with token persistence to keep you authenticated across sessions.
How to use
You run the MCP server locally and connect your MCP client to it to access Kite data and trading actions. Start by authenticating with Kite to obtain an access token. Then start the MCP server and point your client to the local server configuration. Use the available tools to fetch profile information, positions, holdings, margins, place or cancel orders, fetch market data, and check authentication status.
How to install
Prerequisites: you need a Zerodha Kite Connect App and the latest Bun runtime.
- Install dependencies for the MCP project.
bun install
- Set up environment variables in a .env file with your Kite API credentials.
# Edit .env with your API credentials
- Register your Kite Connect app with a redirect URL that points to your local OAuth server.
http://localhost:50000/zerodha/auth/redirect
- Authenticate with Kite API to obtain a token.
bun run auth
- Start the MCP server.
bun start
- Configure Claude Desktop to connect to the MCP server using the following configuration snippet.
{
"mcpServers": {
"kite": {
"command": "bun",
"args": ["run", "/path/to/kite-mcp/src/index.ts"]
}
}
}
Additional configuration and security
Environment variables to set in your .env file include the Kite API key and secret. The server port for the OAuth flow can be customized with OAUTH_PORT. Tokens are persisted locally to maintain authentication between sessions.
Security notes: tokens are stored locally, OAuth flow uses secure redirect handling, and credentials are never logged.
Troubleshooting
Authentication issues: verify credentials in your environment, ensure the redirect URL is configured correctly in Kite Connect, and confirm the OAuth port is available.
Token expiry: Kite tokens expire roughly every 6 hours. Re-run the authentication flow when needed and monitor authentication status.
Server connection issues: verify your Claude Desktop configuration, ensure the MCP server is running with bun start, and check client logs for errors.
Notes
The MCP server provides tools for portfolio management, market data, order management, and account information through a single local endpoint that your MCP client can query or command.
Overview of project structure and responsibilities
Key components include a configuration manager, token storage, OAuth flow handler, a Kite API wrapper, the MCP server implementation, and individual tool handlers. This design follows a clear separation of concerns to simplify development and testing.
Security and token handling
-
Tokens are persisted locally and refreshed as needed.
-
OAuth flow uses secure redirect handling to protect the authentication process.
-
API credentials are not exposed in logs or external responses.
Available tools
get_profile
Retrieve user profile information including account details and authentication status.
get_positions
Fetch current trading positions from your Kite account.
get_holdings
Retrieve long-term holdings in your Kite account.
get_margins
Obtain account margins and available funds.
get_orders
Get today’s trading orders.
place_order
Place a new trading order with specified parameters.
cancel_order
Cancel an existing trading order.
get_ltp
Retrieve Last Traded Price for instruments.
get_quote
Get detailed market quotes for instruments.
get_instruments
Obtain the list of tradable instruments.
get_auth_status
Check the current authentication status for the Kite connection.