suryabonagiri
MCP Serversuryabonagiripublic

kite mcp

一个基于 TypeScript 的 Zerodha Kite Connect API 集成服务,用于自动化交易和投资组合管理。

Repository Info

0
Stars
0
Forks
0
Watchers
0
Issues
TypeScript
Language
MIT License
License

About This Server

一个基于 TypeScript 的 Zerodha Kite Connect API 集成服务,用于自动化交易和投资组合管理。

Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.

Documentation

🚀 Kite Trading API Service

TypeScript Node.js License

A robust, production-ready TypeScript service that integrates with Zerodha's Kite Connect API for automated trading and portfolio management. Built with modern best practices, clean architecture, and comprehensive documentation.

Features

  • OAuth-based authentication with Kite Connect
  • Real-time portfolio tracking
  • Stock price monitoring with alerts
  • Portfolio performance analytics
  • Order placement capabilities
  • RESTful API endpoints

Prerequisites

  • Node.js (v14 or higher)
  • npm (Node Package Manager)
  • Zerodha Kite Connect API credentials
    • API Key
    • API Secret
    • You can obtain these from Kite Connect Developer Portal

Installation

  1. Clone the repository:
git clone <repository-url>
cd kite-mcp
  1. Install dependencies:
npm install
  1. Create a config.json file in the root directory with your Kite credentials:
{
  "apiKey": "your_api_key",
  "apiSecret": "your_api_secret"
}

Running the Service

Start the service using:

npm start

Or for development with auto-reload:

npm run dev

The service will run on port 3000 by default.

Security Notes

  • Keep your config.json file secure and never commit it to version control
  • Add config.json to your .gitignore file
  • For production deployments, consider using a secure configuration management system

API Endpoints

Authentication

Login

  • GET /login
  • Returns a Kite Connect login URL
  • Response: { loginUrl: string }

Callback

  • GET /callback
  • Handles OAuth callback from Kite Connect
  • Query Parameters: request_token
  • Response: { accessToken: string }

Portfolio Management

Get Profile

  • GET /profile
  • Returns user profile information
  • Requires authentication

Get Portfolio Summary

  • GET /portfolio
  • Returns current portfolio summary including:
    • Total value
    • Today's P&L
    • Total P&L
    • Individual holdings

Get Portfolio Performance

  • GET /portfolio/performance
  • Returns detailed portfolio analysis including:
    • Current value
    • Performance metrics (daily, weekly, monthly, yearly)
    • Top gainers and losers

Market Data

Get Stock Quotes

  • GET /quote?symbols=SYMBOL1,SYMBOL2
  • Returns current market quotes for specified symbols
  • Query Parameters: symbols (comma-separated list)

Stock Monitoring

Start Monitoring

  • POST /monitor
  • Sets up price alerts for a stock
  • Request Body:
{
  "symbol": "SYMBOL",
  "abovePrice": number,
  "belowPrice": number
}

Stop Monitoring

  • POST /stop-monitor
  • Stops monitoring a stock
  • Request Body:
{
  "symbol": "SYMBOL"
}

Example API Usage

Getting Stock Quotes

curl "http://localhost:3000/quote?symbols=RELIANCE,TCS,INFY"

Setting Up Price Alerts

curl -X POST -H "Content-Type: application/json" \
  -d '{"symbol":"RELIANCE","abovePrice":2500,"belowPrice":2400}' \
  http://localhost:3000/monitor

Getting Portfolio Summary

curl http://localhost:3000/portfolio

Error Handling

All endpoints return appropriate HTTP status codes:

  • 200: Success
  • 400: Bad Request
  • 401: Unauthorized
  • 404: Not Found
  • 500: Internal Server Error

Error responses include a JSON object with an error message:

{
  "error": "Error message description"
}

CORS Support

The API includes CORS support and accepts requests from any origin (*). The following HTTP methods are allowed:

  • GET
  • POST
  • OPTIONS

Project Structure

├── src/
│   ├── index.ts          # Application entry point
│   ├── controllers/      # Request handlers
│   ├── services/         # Business logic
│   ├── models/          # Data models
│   ├── routes/          # API routes
│   └── utils/           # Helper functions
├── Dockerfile           # Container configuration
├── tsconfig.json        # TypeScript configuration
├── package.json         # Project dependencies
├── .env.example         # Example environment variables
├── .gitignore          # Git ignore rules
├── LICENSE             # MIT License
├── README.md           # Project documentation
└── CONTRIBUTING.md     # Contribution guidelines

Tech Stack

  • Language: TypeScript
  • Runtime: Node.js
  • Authentication: OAuth 2.0
  • API Integration: Zerodha Kite Connect
  • Development Tools:
    • ESLint for code linting
    • Prettier for code formatting
    • Jest for testing
    • Docker for containerization

Code Quality & Best Practices

  • Clean Architecture principles
  • SOLID design patterns
  • Comprehensive error handling
  • API input validation
  • Secure credential management
  • Detailed logging
  • Unit and integration tests
  • TypeScript strict mode
  • Automated CI/CD pipeline ready

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Quick Start

1

Clone the repository

git clone https://github.com/suryabonagiri/kite-mcp
2

Install dependencies

cd kite-mcp
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownersuryabonagiri
Repokite-mcp
LanguageTypeScript
LicenseMIT License
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation