directa-mcp

directa-mcp

MCP server that connects Claude to Directa's Darwin trading API, enabling local account management, portfolio views, and order operations through natural language.

Category
访问服务器

README

directa-mcp

MCP server exposing Directa SIM's Darwin API (dAPI) to any MCP client — positions, balance, orders, historical data.

simoneb.github.io/directa-mcp carries the config for the current release, ready to copy, and a one-click extension for Claude Desktop.

Darwin listens on 127.0.0.1 only while it is running and logged in, so this is a local stdio server: your client starts it on the same machine. Hosts that only accept remote HTTP servers cannot run it (ChatGPT web and desktop among them; use Codex CLI there). There are no API keys — the authentication is Darwin being logged in.

Prerequisites

  1. An active Directa account, with Darwin installed (needs a Java JRE) and logged in.
  2. API access enabled: sign the disclaimer on directatrading.com, then check Sviluppatori > Dev kit in Darwin.
  3. For candles and ticks only: the real-time data entitlement. Without it those tools fail with 1032, and get_darwin_status reports it as datafeed_enabled.

Install

Pick a tag from the releases — the latest unless you have a reason — and substitute it for <TAG>. uvx fetches and runs the server in an isolated environment; only uv is needed.

{
  "mcpServers": {
    "directa": {
      "command": "uvx",
      "args": [
        "--from",
        "https://github.com/simoneb/directa-mcp/archive/refs/tags/<TAG>.tar.gz",
        "directa-mcp"
      ],
      "env": {
        "DIRECTA_ENABLE_ORDERS": "false"
      }
    }
  }
}
Client File
Claude Desktop %APPDATA%\Claude\claude_desktop_config.json, or ~/Library/Application Support/Claude/
Cursor ~/.cursor/mcp.json, or .cursor/mcp.json per project
Windsurf ~/.codeium/windsurf/mcp_config.json
Gemini CLI ~/.gemini/settings.json, or .gemini/settings.json per project

VS Code keys it under servers and wants "type": "stdio", in .vscode/mcp.json. Codex CLI takes TOML in ~/.codex/config.toml:

[mcp_servers.directa]
command = "uvx"
args = ["--from", "https://github.com/simoneb/directa-mcp/archive/refs/tags/<TAG>.tar.gz", "directa-mcp"]

[mcp_servers.directa.env]
DIRECTA_ENABLE_ORDERS = "false"

Or let the client write it: claude mcp add, codex mcp add, code --add-mcp.

Pin a tag, not a branch — otherwise every start pulls the tip of master. Prefer the archive URL over git+https://…: the git form needs a git on PATH, and some clients hand the server too small an environment to find one.

Tools

Tool
check_connection Are Darwin's ports up; running/starting/stopped. Needs no login
get_darwin_status Connection state, release, whether the datafeed is enabled
get_account_balance Liquidity, open P&L, equity
get_availability Buying power, with and without margin
get_positions, get_position Open positions, as Darwin reports them
get_portfolio_overview Positions with derived price and value, totals, and a reconciliation check
get_orders The day's orders with decoded state; pending_only for the live ones
preview_limit_order What an order would cost, without placing it
place_limit_order, modify_order, cancel_order, cancel_all_orders Real orders. Need the gate below
start_darwin Launches dGO so you can log in. Needs DIRECTA_AUTOSTART=true
get_daily_candles, get_intraday_candles, get_candle_data_range, get_tick_data OHLC candles and ticks. Need the datafeed entitlement

Symbols use Directa's formats: ENI.MI for Borsa Italiana stocks, bare tickers for ETFs (VWCE), M.<number> for bonds. Read one back from get_positions rather than guessing.

Each tool carries the protocol's annotations (readOnlyHint and friends), so a client can group them by permission and only ask for approval where it matters. The twelve reading tools are marked read-only; the six that put a command on the wire are not — including preview_limit_order, which places nothing but does send ACQAZ.

The order gate

Order tools work only with DIRECTA_ENABLE_ORDERS=true. Otherwise they send nothing and return success: false with blocked: true.

There is no simulated mode. The dAPI has no command that accepts an order without sending it to market, and Directa provides no test account, so any library offering one for this API is fabricating the responses. The flag is a safety catch, not a mode selector: it lives in the process configuration, so the model cannot turn it on — only you can. With it on, orders are real, with real money.

Starting Darwin

With DIRECTA_AUTOSTART=true the server exposes start_darwin, which launches dGO; Darwin itself has no installed executable. For it to get past dGO's tile grid, set AutoSelezione to "Darwin 2" in dGO's Preferenze — the server writes no settings of its own.

Darwin then asks for an OTP, so the tool does not wait: it returns once dGO is up and you finish the login, after which check_connection reports running. It launches only from stopped, since Directa allows one session at a time, and never closes Darwin. For the same OTP reason this server cannot run unattended.

Two data traps

INFOACCOUNT field names do not describe their contents. gain_euro is the open P&L; open_profit_loss is the portfolio's carrying cost. Reading it as a gain overstates it by nearly an order of magnitude.

Bonds are quoted as a percentage of nominal. 20,000 nominal at 95.0 is worth €19,000, not €1,900,000 — the naive quantity × price is wrong by 100×. get_portfolio_overview handles this and reconciles its own totals against Darwin's; if reconciliation.reconciled is false, don't present the numbers as fact.

Implementation

The client is one dependency-light file, src/directa_mcp/dapi.py. Every command and response format it uses, and the surprises behind them, are in docs/PROTOCOL.md. The project began on the community library directa-api-python, dropped after live testing — see docs/UPSTREAM.md.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选