- Home
- MCP servers
- Trade-MCP Server
Trade-MCP Server
- python
0
GitHub Stars
python
Language
6 months ago
First Indexed
3 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": {
"samarjyoti496-trade-mcp": {
"command": "uv",
"args": [
"run",
"--with",
"mcp[cli]",
"mcp",
"run",
"server.py"
],
"env": {
"API_KEY": "YOUR_API_KEY",
"API_SECRET": "YOUR_API_SECRET"
}
}
}
}Trade-MCP exposes Zerodha trading actions as MCP tools you can call from automation clients. It runs a local MCP server that your automation agents can invoke to place buy/sell orders and fetch holdings, using a secure environment for API keys. This makes it easy to automate trading tasks and integrate with Claude Desktop or other MCP-compatible tooling.
How to use
You run the MCP server locally and connect an MCP client to access trading tools. The server exposes actions like placing Zerodha orders and retrieving holdings, so you can automate workflows, build AI-assisted trading scenarios, and orchestrate multiple tools in sequence.
To start, run the MCP server using the standard runtime command, then connect your MCP client to the running server. Once connected, the tools will appear in your client’s tool list and you can invoke them with the required parameters.
How to install
Prerequisites: you need Python and a running MCP runtime. You will also use a Python virtual environment to keep dependencies isolated.
# 1. Install Python if not present
# 2. Create and activate a virtual environment
uv venv
.venv\Scripts\activate # On Windows
# or
source .venv/bin/activate # On Linux/Mac
# 3. Install dependencies
uv pip install -r requirements.txt
# or, if using pyproject.toml:
uv pip install .
# 4. Create environment variables file
# (the following is an example; replace with your actual keys)
API_KEY=your_zerodha_api_key
API_SECRET=your_zerodha_api_secret
Start the MCP server using the standard runtime command:
- uv run --with mcp[cli] mcp run server.py
- or, if MCP CLI is installed in your environment:
- mcp run server.py
Optional: set up an MCP client configuration to connect to the server. If you use Claude Desktop, you can add a server entry that points to the MCP runtime you used to start the server. This enables the tools to appear in Claude’s tool list once the client reconnects.
Additional notes and configuration
Environment variables: API keys and secrets are loaded from a .env file for security. Ensure this file is kept out of version control and contains at least the following values.
API_KEY=your_zerodha_api_key
API_SECRET=your_zerodha_api_secret
Exposed tools: the server provides actions to add two numbers as a placeholder example and real trading actions. The actual trading tools available are:
- add(a: int, b: int): Add two numbers.
- place_zerodha_buy_order(symbol: str, quantity: int): Place a buy order.
- place_zerodha_sell_order(symbol: str, quantity: int): Place a sell order.
- get_zerodha_holdings(): Get all holdings from Zerodha.
Extending: to add a new tool, define a function in server.py and decorate it with @mcp.tool():
@mcp.tool()
def my_tool(...):
...```
## Available tools
### add
Add two numbers. Useful as a simple utility or building block for more complex tooling.
### place\_zerodha\_buy\_order
Place a buy order for a given symbol and quantity via Zerodha Kite Connect.
### place\_zerodha\_sell\_order
Place a sell order for a given symbol and quantity via Zerodha Kite Connect.
### get\_zerodha\_holdings
Retrieve the current holdings from Zerodha.