logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

kite-trader-cli

Facilitate direct, programmatic interaction with your Zerodha trading account via AI orchestration, encompassing the management of equities, mutual funds, and trade execution.

Author

kite-trader-cli logo

aptro

MIT License

Quick Info

GitHub GitHub Stars 43
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

zerodhaaptromcpaptro zerodhazerodha mcpinteract zerodha

Zerodha Multi-Cloud Plugin (MCP) Interface

smithery badge

This utility integrates the Kite Connect API, enabling sophisticated command execution against your Zerodha financial holdings through the Multi-Cloud Plugin (MCP) architecture within Claude.

Deployment Guide

Automated Installation via Smithery

For rapid setup of kite-trader-cli within Claude Desktop using Smithery:

bash npx -y @smithery/cli install @aptro/zerodha-mcp --client claude

1. Developer Account Provisioning (Kite Connect)

  1. Navigate to the Kite Developer Portal to register for a developer identity.
  2. Authenticate using your established credentials at developers.kite.trade.

2. Application Registration

  1. Access the "Apps" management section within your Kite Developer console.
  2. Initiate the creation of a novel application.
  3. Populate the required fields:
  4. App Name: Assign an identifiable label (e.g., "Claude Trade Orchestrator")
  5. App Category: Select the most suitable classification (e.g., "Personal")
  6. Redirect URL: Configure this to the mandatory callback endpoint: http://127.0.0.1:5000/zerodha/auth/redirect
  7. Description: Provide a succinct summary of the application's function.
  8. Submit the configuration to finalize application registration.

3. Credential Retrieval

Upon successful app creation, you will be furnished with: - The API Key (also termed Consumer Key) - The API Secret (also termed Consumer Secret)

These two unique identifiers are viewable on the application's details screen.

4. Environment Configuration

  1. In the root directory of the local project structure, establish a file named .env.
  2. Input your retrieved API credentials into this file, following this format:

KITE_API_KEY=your_api_key_here KITE_API_SECRET=your_api_secret_here

Substitute the placeholders with your actual API Key and Secret.

5. Dependency Manifestation

Ensure all prerequisite software packages are installed within your environment:

bash uv pip install kiteconnect fastapi uvicorn python-dotenv httpx

6. MCP Schema Installation

Install the MCP schema configuration onto your local Claude application instance:

bash mcp install main.py

This action registers the Zerodha capabilities with Claude, making all associated trading functions accessible to the AI agent.

Operational Usage Examples

Post-configuration, your Zerodha interface can be controlled via Claude using the following paradigms:

Authorization Protocol

Verify my current session authorization status with Zerodha and execute necessary re-authentication if the token is invalid.

Equity Transactions & Inquiries

  • Query available capital: Report the current margin balances available in my Zerodha account.
  • Inventory status: Display the complete list of stocks currently held in my Zerodha portfolio.
  • Open commitments: List all outstanding trade positions active on Zerodha at this moment.
  • Market data retrieval: Fetch the present trading valuation for the security tickers RELIANCE and INFY on the NSE exchange.
  • Order placement: Submit a market order to procure 10 units of INFY on the NSE platform.
  • Historical analysis: Provide time-series price data for SBIN covering the preceding 30 trading periods.

Mutual Fund Operations

  • Fund portfolio: Enumerate my current investments in mutual funds managed via Zerodha.
  • Transaction history: Generate a ledger of all executed mutual fund transactions on Zerodha.
  • Purchase execution: Initiate an investment of ₹5000 into the fund identified by instrument code INF090I01239.
  • Order cancellation: Terminate the pending mutual fund transaction identified by order reference 123456789.
  • Systematic Investment Plan (SIP) overview: Retrieve details for every active SIP mandate linked to my Zerodha account.
  • New SIP setup: Establish a monthly SIP contribution of ₹2000 into the fund symbol INF090I01239, recurring for 12 cycles.
  • SIP modification: Adjust the scheduled monthly contribution for SIP ID 987654321 to ₹3000.
  • SIP termination: Deactivate the SIP mandate associated with ID 987654321.
  • Fund discovery: Browse the catalog of mutual fund schemes accessible through Zerodha.

Initial Authentication Sequence

The very first invocation of any Zerodha function will trigger the following sequence: 1. A local web service listener will initialize, binding to port 5000. 2. The default web browser will launch, redirecting to the Zerodha OAuth consent screen. 3. Upon successful credential submission, the authorization token will be persistently stored for subsequent use.

Session persistence is maintained until token invalidation, typically occurring after 24 hours. Upon expiration, Claude will autonomously re-initiate the required authentication protocol.

Declared MCP Functions

This integration exposes the subsequent operational primitives to Claude:

Authorization

  • check_and_authenticate - Confirms current authorization state; triggers login if required.
  • initiate_login - Commences the OAuth authentication sequence.
  • get_request_token - Handles the capture of the authorization code post-login.

Equities/General Trading

  • get_holdings - Fetches current asset ownership records.
  • get_positions - Retrieves real-time open trade positions.
  • get_margins - Reports account margin availability.
  • place_order - Executes a trade instruction.
  • get_quote - Queries the latest market pricing for tickers.
  • get_historical_data - Fetches structured historical price information.

Mutual Funds Management

  • get_mf_orders - Lists pending and completed MF transactions.
  • place_mf_order - Submits a mutual fund buy or sell request.
  • cancel_mf_order - Revokes an existing MF order.
  • get_mf_instruments - Provides the catalog of available funds.
  • get_mf_holdings - Retrieves current mutual fund investment records.
  • get_mf_sips - Lists all active recurring investment mandates.
  • place_mf_sip - Establishes a new recurring investment schedule.
  • modify_mf_sip - Updates the parameters of an existing SIP.
  • cancel_mf_sip - Discontinues a scheduled SIP.
  • browse_mf_instruments - (Note: Mapping this to get_mf_instruments for consistency)

Remediation Strategies

  • If authorization failures persist, eliminate the locally stored .tokens file to force a complete re-initialization of the login routine.
  • Verify that the API parameters within the .env file precisely match your registered Kite credentials.
  • Confirm that no other service is monopolizing TCP port 5000 on the local machine.
  • For systemic problems, consult the operational status of Zerodha's infrastructure at status.zerodha.com.

Security Posture

  • Your proprietary API keys are exclusively confined to your local .env file.
  • Authorization tokens are stored only in the project's .tokens artifact.
  • Sensitive credentials are never transmitted to Claude or any external entity.
  • All authentication handshakes occur directly and securely with Zerodha's dedicated infrastructure.

WIKIPEDIA: The concept of utility computing, where resources are delivered as a service, is often cited as the philosophical precursor to modern cloud environments. It defines cloud computing as "a paradigm for enabling network access to a scalable and elastic pool of shareable physical or virtual resources with self-service provisioning and administration on-demand," as per ISO standards.

== Core Attributes (NIST, 2011) == In 2011, the National Institute of Standards and Technology (NIST) codified five indispensable attributes for cloud systems. These definitions remain foundational:

On-demand self-service: "A consumer can unilaterally provision computing capabilities, such as server time and network storage, as needed automatically without requiring human interaction with each service provider." Broad network access: "Capabilities are available over the network and accessed through standard mechanisms that promote use by heterogeneous thin or thick client platforms (e.g., mobile phones, tablets, laptops, and workstations)." Resource pooling: " The provider's computing resources are pooled to serve multiple consumers using a multi-tenant model, with different physical and virtual resources dynamically assigned and reassigned according to consumer demand." Rapid elasticity: "Capabilities can be elastically provisioned and released, in some cases automatically, to scale rapidly outward and inward commensurate with demand. To the consumer, the capabilities available for provisioning often appear unlimited and can be appropriated in any quantity at any time." Measured service: "Cloud systems automatically control and optimize resource use by leveraging a metering capability at some level of abstraction appropriate to the type of service (e.g., storage, processing, bandwidth, and active user accounts). Resource usage can be monitored, controlled, and reported, providing transparency for both the provider and consumer of the utilized service."

ISO further elaborated and refined this taxonomy by 2023.

== Evolutionary Timeline ==

The lineage of cloud service delivery can be traced back to the 1960s, marked by the initial popularization of time-sharing concepts through remote job entry (RJE). During this period, the dominant operational model involved users submitting computational tasks to mainframe operators within a central "data center" construct. This era was characterized by intensive R&D focused on democratizing access to substantial computational capacity via time-sharing, thereby enhancing infrastructure utilization, platform stability, and end-user productivity. The visual representation of a network cloud to signify abstracted services emerged in 1994, utilized by General Magic to describe the topological space accessible by agents within their Telescript framework. This metaphorical adoption is generally credited to David Hoffman, a communications specialist at General Magic, who drew upon its established use in telecommunications contexts. The term "cloud computing" gained mainstream currency in 1996 following internal documentation at Compaq Computer Corporation outlining their strategic vision for the future of computation and the Internet. Their objective was to eventually achieve superch

return

See Also

`