MCP

Stock-trading MCP Place orders
right inside Claude

Trade Vietnamese stocks right inside Claude — place orders, check balances, review your DNSE · SSI · TCBS portfolio. The bridge runs on your machine: broker keys never leave it, never touch Algolab servers.

npx -y mcp-trading link

Run in your terminal (needs Node.js 18+). npm package mcp-trading · open source: github.com/algolabx/mcp-trading · for market data to analyse with, add the Data MCP.

Connect

3 steps
5 minutes

Keys are typed in the terminal, never pasted into chat.

  1. 1
    Link your broker — open a terminal and run the line for the broker you use. The bridge asks for the API key (hidden input), checks it with the broker, then stores it on your machine.
    npx -y mcp-trading link dnse   # API Key + Secret (LightSpeed OpenAPI) + email OTP
    npx -y mcp-trading link ssi    # ConsumerID + Secret + số tiểu khoản
    npx -y mcp-trading link tcbs   # API Key iFlash — tiểu khoản tự phát hiện
    
    npx -y mcp-trading status      # đã liên kết gì (không in khoá)
  2. 2
    Tell Claude about the bridge — pick one (copy and go):

    Claude Code terminal

    claude mcp add --scope user mcp-trading -- \
      npx -y -p mcp-trading mcp-trading-server

    Type /mcp to check — seeing mcp-trading means you're done.

    Claude Desktop claude_desktop_config.json

    {
      "mcpServers": {
        "mcp-trading": {
          "command": "npx",
          "args": ["-y", "-p", "mcp-trading", "mcp-trading-server"]
        }
      }
    }

    Config loads only at startup — after saving you must Quit and reopen Claude Desktop.

  3. 3Done! Open a new chat and ask “bridge status?”, then “show my DNSE balance and holdings”. Want Claude to analyse the portfolio too? Add the Data MCP — Claude reads what you hold, then looks up valuation, signals and news for each ticker.

Examples

What you can say
to Claude

Just talk — Claude picks the bridge tools. Money orders always ask you first.

Show my DNSE balance and holdings

Available cash, total assets, tickers held and quantities. DNSE account reads need no OTP.

How is my portfolio doing?

Claude pairs the cost basis in your account with live prices from the Data MCP → P/L per ticker and overall.

Evaluate the stocks I hold

With the Data MCP: P/E · P/B valuation, RS/MACD signals, news and broker targets per ticker → the data to decide what to keep or rotate.

I want to trade

Claude asks for an OTP (email / Smart OTP / iOTP) to open an 8-hour trading session — only when you want to trade.

Sell 100 GEL at 30,000

Claude shows a preview (ticker, side, quantity, price, value) — nothing sent yet. Say “go ahead” and only then the order goes out.

Today's orders · Cancel that order

See pending / filled orders; cancelling needs the same 2-step confirmation.

Tools

9 bridge
tools

Read accounts, balances, holdings and orders; place and cancel orders with 2-step confirmation.

bridge_status

Which brokers are linked on this machine and which trading sessions are still open. Never prints keys.

get_broker_accounts

Sub-accounts at the broker (SSI/TCBS ask the broker directly for the exact numbers).

get_broker_balance

Cash, buying power, total assets.

get_broker_positions

Holdings: ticker, quantity, cost basis.

get_broker_orders

Today's order book: pending, filled, cancelled.

request_broker_otp

Ask the broker for an OTP (DNSE: email) or guide you to Smart OTP / iOTP in the app.

submit_broker_otp

Submit the OTP to open a trading session: DNSE 8h trading token · SSI access + refresh · TCBS 8h JWT.

place_broker_order

Real order — 2 steps: preview (nothing sent) → you confirm → only confirm=true goes out.

cancel_broker_order

Cancel an order — same 2-step confirmation as placing.

Supported brokers

DNSE · SSI
TCBS

Each broker has its own API key — get it in the broker's web or app.

DNSE

Key: LightSpeed API Key + Secret (webtrading → Personal info → LightSpeed API; pick Email OTP for layer 2). Account reads need no OTP; orders unlock with Smart OTP or email OTP.

SSI

Key: ConsumerID + Secret + sub-account number (iBoard → API Services). One OTP covers reads and orders, then auto-renews. Orders are signed with a keypair generated on your machine — paste the public key into iBoard once.

TCBS

Key: iFlash API Key (TCInvest app → iFlash Open API). iOTP in the app opens an 8h session; the sub-account is detected automatically.

Safety

Broker keys
never leave your machine

The bridge only talks to brokers, never to Algolab — check it yourself with verify.

  1. 1Keys never leave your machine. Stored at ~/.algolab/mcp-broker.json (mode 600); no tool accepts or returns a key — the only way in is the link command in your terminal.
  2. 2Money orders are always 2 steps. The preview is built locally (no network) → you confirm → only then it goes to the broker. No open OTP session? The bridge blocks it on the spot.
  3. 3Verify it yourself. The bridge only talks to brokers, never calls Algolab: npx -y mcp-trading verify scans every network address in the running code; the source is open to read.
  4. 4Revoke with one command. npx -y mcp-trading unlink dnse removes it from your machine; revoking the key at the broker kills it everywhere. Broker API keys cannot withdraw money.