yagyagoel1/MCP_TRADING_SERVER
If you are the rightful owner of MCP_TRADING_SERVER and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
An MCP server for executing and managing stock trades on Zerodha, providing a programmable interface for trading operations.
placeBuyStockOrder
Place a buy order for a given stock symbol and quantity.
sellStocks
Place a sell order for a given stock symbol and quantity.
getOrders
Fetch all orders from your Zerodha account.
getHoldings
Retrieve all current holdings from your Zerodha account.
cancelOrder
Cancel a specific order by order_id.
add
A sample utility tool to add two integers (demo/test purpose).
MCP Zerodha Trading Server
An MCP (Model Context Protocol) server for executing and managing stock trades on Zerodha. Exposes tools for placing orders, checking holdings, and managing trades through a programmable interface.
๐ฆ Features
โ Trading Operations via Zerodha
All tools are accessible using the MCP protocol through CLI or HTTP transport.
placeBuyStockOrder
Place a buy order for a given stock symbol and quantity.
Input: { "symbol": "TATAMOTORS", "quantity": 10 }
Output: "Order buy placed successfully ..."
sellStocks
Place a sell order for a given stock symbol and quantity.
Input: { "symbol": "RELIANCE", "quantity": 5 }
Output: "Order sell placed successfully ..."
getOrders
Fetch all orders from your Zerodha account.
Output: "Orders fetched successfully ..."
getHoldings
Retrieve all current holdings from your Zerodha account.
Output: "Holdings fetched successfully ..."
cancelOrder
Cancel a specific order by order_id
.
Input: { "order_id": 123456 }
Output: "Cancelled the order successfully ..."
add
A sample utility tool to add two integers (demo/test purpose).
Input: { "a": 5, "b": 10 }
Output: 15
๐ง Backed By
- Zerodha Kite Connect โ For real-time order placement, portfolio insights, and trading actions.
- FastMCP โ Lightweight MCP server framework for tool-based workflows.
๐งช Quick Start
๐งฐ Requirements
- Python 3.11+
- MCP runtime (FastMCP)
- Zerodha trading credentials setup in your environment (handled inside
trade.py
)
๐ฆ Setup
git clone https://github.com/yagyagoel1/MCP_TRADING_SERVER.git
cd MCP_TRADING_SERVER
pip install -r requirements.txt
Make sure your trade.py
file has access to Zerodha API keys and session setup.
๐ Run the Server
CLI Mode (via stdio):
python mcp_trading_server.py
Or with uv
and HTTP:
uv run mcp_trading_server.py --http
๐ค Calling Tools (Example via cURL)
curl -X POST http://localhost:8000/call-tool \
-H "Content-Type: application/json" \
-d '{
"name": "getHoldings",
"arguments": {}
}'
๐ Use Cases
- Place buy/sell orders programmatically.
- Cancel specific open orders via tool call.
- Automate trading via MCP-compatible LLM agents or chat interfaces.
- Integrate with bots or portfolio dashboards.
๐ค Contributing
Feature requests, bug reports, and PRs are welcome! Just open an issue or contact me directly.
๐ License
โ free to use and modify.