Dhan MCP Server
Enables AI assistants to manage orders, portfolios, and market data via Dhan's trading APIs.
README
Dhan MCP Server
An MCP (Model Context Protocol) server that exposes Dhan trading APIs as tools, enabling AI assistants to manage orders, view portfolios, fetch market data, and more.
Prerequisites
- Node.js 18+
- A Dhan account with API access
- Access token from Dhan's developer portal
Setup
1. Get your Dhan API credentials
- Log in to Dhan Web
- Go to Profile → DhanHQ Trading APIs
- Generate an Access Token and note your Client ID
2. Install and build
npm install
npm run build
3. Configure environment
Copy .env.example to .env and fill in your credentials:
cp .env.example .env
DHAN_ACCESS_TOKEN=your_jwt_access_token_here
DHAN_CLIENT_ID=your_dhan_client_id_here
Usage
Run directly
DHAN_ACCESS_TOKEN=<token> DHAN_CLIENT_ID=<clientId> node dist/index.js
Configure with Claude Desktop
Add to your Claude Desktop config.json:
{
"mcpServers": {
"dhan": {
"command": "node",
"args": ["/path/to/dhan-mcp-server/dist/index.js"],
"env": {
"DHAN_ACCESS_TOKEN": "your_access_token",
"DHAN_CLIENT_ID": "your_client_id"
}
}
}
}
Available Tools
Orders
| Tool | Description |
|---|---|
place_order |
Place a new order (equity, F&O, currency, commodity) |
place_slice_order |
Place a large order split into smaller chunks automatically |
get_orders |
Get all orders for today |
get_order_by_id |
Get a specific order by ID |
get_order_by_correlation_id |
Get order by client correlation ID |
modify_order |
Modify a pending order |
cancel_order |
Cancel a pending order |
Trades
| Tool | Description |
|---|---|
get_trades |
Get all executed trades for today |
get_trades_by_order_id |
Get trades for a specific order |
Portfolio
| Tool | Description |
|---|---|
get_holdings |
View equity holdings from previous sessions |
get_positions |
View open positions for today |
convert_position |
Convert position between product types (e.g. INTRADAY → CNC) |
Funds & Margin
| Tool | Description |
|---|---|
get_fund_limits |
View available margin, used margin, collateral |
calculate_margin |
Calculate margin required for a potential order |
Market Data
| Tool | Description |
|---|---|
get_market_quote_ticker |
Real-time LTP for given securities |
get_market_quote_ohlc |
OHLC data for given securities |
get_market_quote_full |
Full market depth (bid/ask, volume, OI) |
get_option_chain |
Complete option chain for an underlying |
get_expiry_list |
Available expiry dates for an underlying |
get_historical_candle |
Historical daily OHLCV candles |
get_intraday_candle |
Intraday OHLCV candles (1/5/15/25/60 min) |
Statements
| Tool | Description |
|---|---|
get_ledger_report |
Account ledger for a date range |
get_trade_history |
Historical trade records |
Profile & Auth
| Tool | Description |
|---|---|
get_profile |
User profile information |
renew_token |
Renew the access token |
EDIS
| Tool | Description |
|---|---|
generate_edis_form |
Generate EDIS slip for selling holdings |
get_edis_inquiry |
Check EDIS status for an ISIN |
Exchange Segments
| Segment | Description |
|---|---|
NSE_EQ |
NSE Equity |
NSE_FNO |
NSE Futures & Options |
NSE_CURRENCY |
NSE Currency Derivatives |
BSE_EQ |
BSE Equity |
BSE_FNO |
BSE Futures & Options |
BSE_CURRENCY |
BSE Currency Derivatives |
MCX_COMM |
MCX Commodity |
Product Types
| Type | Description |
|---|---|
CNC |
Cash and Carry (delivery) |
INTRADAY |
Intraday MIS |
MARGIN |
Margin |
MTF |
Margin Trading Facility |
CO |
Cover Order |
BO |
Bracket Order |
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.