zerodha-mcpserver

zerodha-mcpserver

3.3

This is a Cloudflare Worker that serves as an MCP server for interacting with the Zerodha Kite Connect API, providing a comprehensive interface for trading and portfolio management.

The Zerodha Kite Connect MCP Server is designed to facilitate seamless interaction with the Zerodha Kite Connect API through a Cloudflare Worker. It offers a robust interface for managing trading activities and portfolios, including authentication, session management, and order handling. The server supports MCP-compatible responses, making it easy to integrate with MCP clients like Claude Desktop. Users can manage their holdings, positions, and GTT orders, as well as retrieve historical market data. The server ensures secure handling of API credentials and access tokens, leveraging Cloudflare's environment variables and KV namespace for storage. Deployment involves setting up a Cloudflare account, configuring API credentials, and deploying the worker using Wrangler.

Features

  • Zerodha authentication and session management
  • Portfolio management (holdings, positions)
  • GTT (Good Till Triggered) orders
  • Historical data retrieval
  • MCP-compatible responses for seamless integration with Claude Desktop and other MCP clients

Usage with Different Platforms

Claude Desktop

Once deployed, you can add the worker as an MCP server in Claude Desktop:

1. Go to Settings > MCP Servers
2. Add a new server with your worker URL (e.g., `https://zerodha-mcp.your-subdomain.workers.dev`)
3. Claude will automatically discover the available methods

JavaScript

// Example of using the MCP worker in JavaScript
const loginUrl = await zerodhaWorker.getLoginUrl();
console.log('Please login at:', loginUrl);

// Authentication flow
window.location.href = loginUrl;
// After redirect back with request_token in URL...
const urlParams = new URLSearchParams(window.location.search);
const requestToken = urlParams.get('request_token');

// Get holdings after authentication
const holdingsResponse = await zerodhaWorker.getHoldings();
const holdings = JSON.parse(holdingsResponse.content[0].text);
console.log('Your holdings:', holdings);

// Get historical data
const historicalData = await zerodhaWorker.getHistoricalData(
  '5633',           // instrument_token (NSE:INFY)
  'minute',         // interval
  '2023-01-01 09:15:00', // from
  '2023-01-01 09:30:00', // to
  false,            // continuous
  false             // oi
);
console.log('Historical data:', JSON.parse(historicalData.content[0].text));

Related MCP Servers

View all finance servers →