Dhan Broker MCP Trades

by mayankthole

192 downloads
Not rated
GitHub

About

Dhan Broker MCP Trades is a server that connects AI models with the Dhan brokerage system through the Model Context Protocol, enabling automated trading operations such as order placement, portfolio analysis, and fund management.

Details

Author
mayankthole
Downloads
192
Categories
Other

- Order placement and management via MCP tools
- Super orders with targets and stop-losses
- Portfolio analysis and P&L calculation
- Fund management capabilities
- After-market order execution for market open

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Dhan Broker MCP Trades
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "dhan broker mcp trades": {
            "after-market-order": {
                "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
                "args": [
                    "/Users/mayankthole/Desktop/Dhan Broker MCP trades/after_market_order_tool.py"
                ]
            },
            "fund-balance": {
                "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
                "args": [
                    "/Users/mayankthole/Desktop/Dhan Broker MCP trades/fund_balance_tool.py"
                ]
            },
            "holdings-positions": {
                "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
                "args": [
                    "/Users/mayankthole/Desktop/Dhan Broker MCP trades/holdings_positions_tool.py"
                ]
            },
            "margin-calculator": {
                "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
                "args": [
                    "/Users/mayankthole/Desktop/Dhan Broker MCP trades/margin_calculator_tool.py"
                ]
            },
            "order-book": {
                "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
                "args": [
                    "/Users/mayankthole/Desktop/Dhan Broker MCP trades/order_book_tool.py"
                ]
            },
            "order-placement": {
                "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
                "args": [
                    "/Users/mayankthole/Desktop/Dhan Broker MCP trades/order_placement_tool.py"
                ]
            },
            "portfolio-server": {
                "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
                "args": [
                    "/Users/mayankthole/Desktop/Dhan Broker MCP trades/portfolio_server.py"
                ]
            },
            "super-order": {
                "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
                "args": [
                    "/Users/mayankthole/Desktop/Dhan Broker MCP trades/super-order.py"
                ]
            }
        }
    }
}

McpServers

{
    "after-market-order": {
        "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
        "args": [
            "/Users/mayankthole/Desktop/Dhan Broker MCP trades/after_market_order_tool.py"
        ]
    },
    "fund-balance": {
        "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
        "args": [
            "/Users/mayankthole/Desktop/Dhan Broker MCP trades/fund_balance_tool.py"
        ]
    },
    "holdings-positions": {
        "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
        "args": [
            "/Users/mayankthole/Desktop/Dhan Broker MCP trades/holdings_positions_tool.py"
        ]
    },
    "margin-calculator": {
        "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
        "args": [
            "/Users/mayankthole/Desktop/Dhan Broker MCP trades/margin_calculator_tool.py"
        ]
    },
    "order-book": {
        "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
        "args": [
            "/Users/mayankthole/Desktop/Dhan Broker MCP trades/order_book_tool.py"
        ]
    },
    "order-placement": {
        "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
        "args": [
            "/Users/mayankthole/Desktop/Dhan Broker MCP trades/order_placement_tool.py"
        ]
    },
    "portfolio-server": {
        "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
        "args": [
            "/Users/mayankthole/Desktop/Dhan Broker MCP trades/portfolio_server.py"
        ]
    },
    "super-order": {
        "command": "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3",
        "args": [
            "/Users/mayankthole/Desktop/Dhan Broker MCP trades/super-order.py"
        ]
    }
}

Real Use Cases
What makes this so powerful? Here are some examples of what you can do:

- [ ] Buy 10 shares of HDFC at market price
- [ ] Place a super order to buy Reliance with 2% target and 1% stop-loss
- [ ] Show me my current holdings and calculate total P&L
- [ ] Buy all PSU bank stocks or Short private banking sector
- [ ] Buy companies where promoters are increasing stake
- [ ] Place after-market orders for IT stocks to execute at market open

Tech Behind It
I built this using Python with MCP (Model Context Protocol), which lets me connect AI models with external systems through a standardized interface. Each tool handles a specific aspect of trading:

Order placement and management
Super orders with targets and stop-losses
Portfolio analysis
Fund management

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.