directa-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@directa-mcpShow me my current portfolio positions and available cash."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
directa-mcp
Server MCP (Python, trasporto stdio) che collega Claude alla Trading API (dAPI) del broker Directa tramite la piattaforma Darwin in esecuzione sul PC.
Lettura (prima versione): stato Darwin, conto, disponibilità, posizioni, ordini, scheda strumento, quotazioni, candele, report di portafoglio, ricerca strumenti.
Scrittura: ordini limite/mercato, modifica, revoca. Disabilitata di default (
DIRECTA_ENABLE_TRADING=false); anche se abilitata richiede un'anteprima e poiconfirm=true, e rispetta i limiti hard-coded inconfig.py.Prezzi: da Yahoo Finance (ritardo ~15 min), perché il datafeed Directa a pagamento non è attivo. Il canale trading Directa è gratuito e funziona.
Dettagli di architettura, protocollo e decisioni: CLAUDE.md.
Requisiti
Windows, Python 3.11+ (testato con 3.12.1)
Conto Directa con Trading API abilitate (sito Directa → icona utente → Servizi e Prodotti → API)
Darwin aperto con l'utente loggato: apre i socket locali 10001/10002/10003
Related MCP server: directa-mcp
Setup
python -m venv .venv
.venv\Scripts\python -m pip install -r requirements.txtVerifica rapida che Darwin risponda (porte e DARWINSTATUS):
.venv\Scripts\python -c "from directa.client import read_port_settings; print(read_port_settings())"Test
.venv\Scripts\python -m pytest -q tests
.venv\Scripts\python smoke_test.py ENItests/ usa risposte reali registrate in tests/fixtures/; smoke_test.py esercita
tutti i tool di lettura contro Darwin reale e Yahoo, senza inviare ordini.
Registrazione in Claude Code
claude mcp add --scope user directa -e DIRECTA_ENABLE_TRADING=false -- "C:\path\to\directa-mcp\.venv\Scripts\python.exe" "C:\path\to\directa-mcp\server.py"Già eseguito su questa macchina (scope utente, stato Connected). Verifica con
claude mcp list e, in una sessione, con /mcp. Se claude non è nel PATH, l'eseguibile
bundlato nell'app desktop è in
%LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude-code\<versione>\claude.exe.
Per abilitare il trading: claude mcp remove directa -s user e ri-aggiungere con
-e DIRECTA_ENABLE_TRADING=true.
Registrazione in Claude Desktop
Aggiungere a %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"directa": {
"command": "C:\\path\\to\\directa-mcp\\.venv\\Scripts\\python.exe",
"args": ["C:\\path\\to\\directa-mcp\\server.py"],
"env": {
"DIRECTA_ENABLE_TRADING": "false",
"DIRECTA_LOG_DIR": "C:\\path\\to\\directa-mcp\\logs",
"DIRECTA_DATA_DIR": "C:\\path\\to\\directa-mcp\\data"
}
}
}
}Uso da script Python
import asyncio
from directa.client import TradingClient
async def main():
async with TradingClient() as t:
print(await t.info_account())
print(await t.info_stocks())
asyncio.run(main())Il modulo directa/ non dipende da mcp e si può usare da strategies/ o da un
report serale schedulato. I log grezzi TX/RX sono in logs/directa_<canale>.log.
Ticker
Directa usa i ticker senza suffisso (ENI, ISP, SWDA); ENI.MI viene normalizzato.
La conversione verso Yahoo (ENI.MI) usa l'anagrafica locale di Darwin
(~/.directa/anag_json/ANAG_TOTALE.json).
This server cannot be deployed
Maintenance
Related MCP Connectors
Agentic brokerage access to a US brokerage account: quotes, orders, positions, cash and documents.
Unified financial infrastructure connecting AI agents directly to trade live/demo brokerage accounts, Web3 non-custodial wallets, real-time market data across equities, ETFs, crypto, forex, options, DeFi swaps, and prediction markets, institutional research feeds, and algorithmic strategy backtesters.
Global stock research, ML forecasts, valuation signals, screeners & portfolio tracking in Claude
Connect your portfolio to Claude, ChatGPT, or Codex to analyze it and make smarter investments.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceConnects Claude AI to Interactive Brokers accounts to enable real-time portfolio tracking, position management, and historical market data retrieval. It also integrates financial news and sentiment analysis from multiple sources, including Finnhub and IB native feeds.MIT
- AlicenseAqualityAmaintenanceMCP server that connects Claude to Directa's Darwin trading API, enabling local account management, portfolio views, and order operations through natural language.182MIT
- FlicenseNot gradedqualityCmaintenanceEnables Claude Code to connect to Interactive Brokers for read-only access to account summaries, market data, positions, and open orders via a Paper Trading environment.-
- AlicenseNot gradedqualityAmaintenanceEnables ChatGPT to interact with a personal Trading 212 Invest account through MCP, providing portfolio summaries, position and order views, flexible order sizing, demo/live separation, and explicit human-confirmed execution for all broker writes.MIT