Skip to main content
Glama
MCP Trading for Vietnam Securities Market

MCP Trading for Vietnam Securities Market

mcp-trading

English: Local MCP server (stdio) for trading Vietnamese stocks on DNSE, SSI and TCBS from Claude or any MCP client. Broker API keys stay on your machine (~/.algolab, chmod 600) and requests are signed locally from your own IP. 9 tools: bridge_status, get_broker_accounts, get_broker_balance, get_broker_positions, get_broker_orders, request_broker_otp, submit_broker_otp, place_broker_order, cancel_broker_order. Orders are always two-step (preview → explicit confirm). Link a broker with npx -y mcp-trading link, then add npx -y -p mcp-trading mcp-trading-server to your MCP client. For Vietnamese market data (prices, financials, broker research, macro) use the hosted Algolab MCP. License: MIT.

MCP server chạy trên máy bạn để giao dịch chứng khoán Việt Nam (DNSE · SSI · TCBS) ngay trong Claude Code / Claude Desktop — khoá API nằm nguyên trên máy bạn:

  • Khoá lưu tại ~/.algolab/mcp-broker.json (chmod 600) — không đi qua chat AI, không qua server bên thứ ba.

  • Ký/gọi request local từ chính IP của bạn — không cần relay/VPN (DNSE HMAC V2, TCBS JWT, SSI V3 OAuth).

  • Phạm vi: DNSE · SSI · TCBS đều đầy đủ (đọc + đặt/huỷ lệnh, ký/gửi local). SSI ký lệnh bằng keypair sinh trên máy bạn — dán public key vào iBoard một lần.

  • Lệnh tiền luôn 2 bước: AI chỉ nhận bản xem trước, bạn xác nhận rõ ràng thì lệnh mới được gửi.

Không cần tài khoản npm hay GitHub để dùng — chỉ cần Node.js ≥ 18, chạy bằng npx (gói mcp-trading trên npm).

Cách 1 — cài nhanh bằng npx (khuyên dùng)

Liên kết CTCK (chạy trong terminal của bạn — KHÔNG dán khoá vào chat AI):

npx -y mcp-trading link        # hỏi chọn DNSE / SSI / TCBS rồi nhập khoá
npx -y mcp-trading link dnse   # API Key + Secret (webtrading DNSE → LightSpeed API) + email OTP
npx -y mcp-trading link ssi    # ConsumerID + Secret + tiểu khoản; sinh keypair → dán public key iBoard
npx -y mcp-trading link tcbs   # API Key iFlash (app TCInvest) — tiểu khoản tự phát hiện sau iOTP
npx -y mcp-trading status      # xem trạng thái (không bao giờ in khoá)

Khai báo với Claude Code — thêm vào ~/.claude.json:

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

Restart Claude — nhóm tool bridge_status, get_broker_*, place_broker_order… xuất hiện.

Related MCP server: CzechMedMCP

Cách 2 — cài thẳng từ GitHub

Thay mcp-trading bằng github:algolabx/mcp-trading trong mọi lệnh trên (VD npx -y github:algolabx/mcp-trading link).

Cách 3 — clone repo

git clone https://github.com/algolabx/mcp-trading.git && cd mcp-trading && npm install
node src/cli.js link dnse

~/.claude.json: { "command": "node", "args": ["<đường-dẫn>/mcp-trading/src/index.js"] }.

Tool

Tool

Việc

Cần OTP?

bridge_status

Trạng thái liên kết cả 3 CTCK (không bao giờ in khoá)

—

get_broker_accounts / balance / positions / orders

Đọc tài khoản (tham số broker, mặc định dnse)

DNSE: không · SSI: OTP 1 lần rồi tự refresh · TCBS: iOTP/8h

request_broker_otp / submit_broker_otp

Mở phiên theo từng CTCK

—

place_broker_order / cancel_broker_order

Lệnh thật DNSE/TCBS, 2 bước xem trước → confirm=true

Có

An toàn

  • Không có tool nào nhận hay trả khoá — kênh duy nhất đưa khoá vào là CLI trên terminal của bạn.

  • Request đi thẳng máy bạn → CTCK qua HTTPS; bridge không gọi về bất kỳ máy chủ nào của Algolab.

  • Thu hồi bất kỳ lúc nào: unlink dnse (xoá khỏi máy) và/hoặc thu hồi key tại CTCK (chết toàn cục).

  • Test: npm test (chữ ký HMAC, quyền file 600, chuẩn hoá chiều lệnh).

Nguồn

Bridge này là Tầng C của thiết kế bảo mật "Két Ba Tầng" của Algolab — xem tài liệu tại mcp.algolab.vn/trading. MIT License.

Available Tools

9 tools
bridge_statusA
Read-onlyIdempotent

Trạng thái bridge local: CTCK nào đã liên kết trên máy này, phiên nào còn hạn. Khoá KHÔNG bao giờ hiển thị; liên kết/thu hồi chỉ qua CLI mcp-trading trong terminal.

Inputs: no named parameters.

cancel_broker_orderA
Destructive

Huỷ một lệnh theo order_id (DNSE, SSI, TCBS). Cũng 2 bước: không confirm → preview; confirm=true mới gửi.

Inputs: order_id (required), broker, market, account, +1 more.

get_broker_accountsB
Read-onlyIdempotent

Danh sách tiểu khoản tại một CTCK (gọi thẳng từ máy user).

Inputs: broker.

get_broker_balanceB
Read-onlyIdempotent

Tiền mặt / sức mua của một tiểu khoản.

Inputs: broker, account.

get_broker_ordersC
Read-onlyIdempotent

Sổ lệnh trong ngày của một tiểu khoản.

Inputs: broker, market, account.

get_broker_positionsC
Read-onlyIdempotent

Danh mục đang nắm giữ của một tiểu khoản.

Inputs: broker, market, account.

place_broker_orderA
Destructive

Đặt lệnh THẬT (DNSE, SSI, TCBS — tất cả ký/gửi local). Nghi thức 2 bước bắt buộc: gọi lần đầu KHÔNG kèm confirm → trả preview, chưa gửi gì; đọc lại cho người dùng, CHỜ họ xác nhận rõ ràng rồi mới gọi lại với confirm=true. Không tự ý xác nhận thay.

Inputs: side (required), symbol (required), quantity (required), price, +5 more.

request_broker_otpA

Nhờ CTCK gửi OTP mở phiên. DNSE: OTP email (chỉ cần cho đặt/huỷ lệnh; có Smart OTP thì bỏ qua). SSI: gửi theo 2FA đã đăng ký — cần một lần cho cả đọc, sau đó refresh tự gia hạn. TCBS: không gửi gì — iOTP sinh trong app TCInvest, nộp thẳng submit_broker_otp.

Inputs: email, broker.

submit_broker_otpA
Destructive

Nộp OTP mở phiên. DNSE: trading token 8h (smart_otp=true nếu mã từ app). SSI: mở access+refresh token (đọc dùng được ngay, tự gia hạn). TCBS: JWT 8h + bridge tự phát hiện tiểu khoản.

Inputs: otp, broker, smart_otp, transaction_id.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 9 tools

    Disambiguation5/5

    Each tool targets a distinct operation: placing/canceling orders, retrieving accounts/balance/positions/orders, OTP request/submit, and bridge status. No overlapping purposes; descriptions are clear and mutually exclusive.

    Naming Consistency4/5

    Most tools follow a consistent verb_noun pattern (get_broker_*, place_broker_order, cancel_broker_order, request_broker_otp, submit_broker_otp). The exception is 'bridge_status', which uses noun_verb but still communicates its purpose clearly; overall naming is predictable.

    Tool Count5/5

    9 tools is well-scoped for a trading server covering order lifecycle, account queries, and authentication. Each tool earns its place without redundancy or unnecessary sprawl.

    Completeness4/5

    The set covers core trading workflows: placing, canceling, listing orders, viewing positions/balance/accounts, and OTP-based session management. Minor gaps exist (e.g., no modify order, no market data) but the essential operations for executing and monitoring trades are present.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers