Version: 2.3.6
Documentation — Installation, deployment, usage across the API, CLI, and MCP interfaces, the A2A agent server, and the trading configuration schema are maintained in the official documentation.
Emerald Exchange is a unified Finance MCP Server providing fully abstracted exchange backends for equities, crypto, and derivatives trading. All trading feature is tool-driven via MCP, with built-in financial hardening controls (OS-5.1).
Key Features:
- 5 Exchange Backends: Paper (default), Alpaca (FREE), CCXT (100+ exchanges), Freqtrade
- 6 MCP Tool Domains: market-data, orders, portfolio, risk, signals, strategy
- Financial Hardening: Paper-first default, Kelly criterion position sizing, circuit breakers, kill switch
- Config-Driven: All settings via
~/.config/agent-connectors/config.json
flowchart TB
A["Agent / IDE"] --> B["emerald-exchange MCP"]
B --> C["Risk Guard (OS-5.1)"]
C --> D{"Exchange Router"}
D --> E["Paper Backend (Default)"]
D --> F["Alpaca Backend (FREE)"]
D --> G["CCXT Backend (Binance/Coinbase/Kraken)"]
D --> H["Freqtrade Backend"]
style B fill:#10B981,stroke:#065F46,color:#fff
style C fill:#EF4444,stroke:#991B1B,color:#fff
style E fill:#6366F1,stroke:#4338CA,color:#fff
Auto-generated from the live MCP server — do not edit by hand.
| MCP Tool | Toggle Env Var | Description |
|---|---|---|
ee_prediction_markets |
PREDICTION_MARKETTOOL |
Prediction Markets operations. |
emerald_crypto |
CRYPTOTOOL |
Crypto-native analytics and arbitrage. CONCEPT:EX-AHE.harness.ee-14 |
emerald_debate |
DEBATETOOL |
Multi-agent trading debate engine. CONCEPT:EX-AHE.harness.ee-13 |
emerald_derivatives |
DERIVATIVESTOOL |
SABR volatility surface + vol-arb. CONCEPT:AU-AHE.assimilation.decision-distillation |
emerald_fundamentals |
FUNDAMENTALSTOOL |
SEC EDGAR fundamentals operations. CONCEPT:EX-AHE.harness.ee-26. |
emerald_ingest_snapshot |
KG_INGESTTOOL |
Ingest a live trading snapshot into medulla as typed nodes. |
emerald_market_data |
MARKET_DATATOOL |
Market data operations. CONCEPT:EX-AHE.harness.ee-7 |
emerald_market_making |
MARKET_MAKINGTOOL |
Market-making controller, fee model, and forensic screener. CONCEPT:EX-AHE.harness.ee-22 |
emerald_orders |
ORDERTOOL |
Order management with pre-trade risk validation. CONCEPT:EX-AHE.harness.ee-8 |
emerald_portfolio |
PORTFOLIOTOOL |
Portfolio management operations. CONCEPT:EX-AHE.harness.ee-9 |
emerald_risk |
RISKTOOL |
Risk management and monitoring. CONCEPT:AU-AHE.assimilation.skill-workflow-ingest |
emerald_signals |
SIGNALTOOL |
Signal generation and fusion. Routes to scion-sdk finance domain. CONCEPT:EX-AHE.harness.ee-11 |
emerald_statarb |
STATARBTOOL |
OU statistical-arbitrage signal + dynamic-beta hedge. CONCEPT:EX-AHE.harness.ee-29 |
emerald_strategy |
STRATEGYTOOL |
Strategy lifecycle management. CONCEPT:AU-AHE.assimilation.trading-ecosystem-spec |
emerald_wallet_intel |
WALLET_INTELTOOL |
Polymarket wallet-intelligence operations. CONCEPT:EX-AHE.harness.ee-27. |
9 per-operation tools — one per public API method (click to expand)
| MCP Tool | Toggle Env Var | Description |
|---|---|---|
emerald_cancel_order |
PAPER_BACKENDTOOL |
Invoke the cancel_order operation. |
emerald_connect |
PAPER_BACKENDTOOL |
Invoke the connect operation. |
emerald_disconnect |
PAPER_BACKENDTOOL |
Invoke the disconnect operation. |
emerald_get_account |
PAPER_BACKENDTOOL |
Invoke the get_account operation. |
emerald_get_historical |
PAPER_BACKENDTOOL |
Invoke the get_historical operation. |
emerald_get_order_status |
PAPER_BACKENDTOOL |
Invoke the get_order_status operation. |
emerald_get_positions |
PAPER_BACKENDTOOL |
Invoke the get_positions operation. |
emerald_get_quote |
PAPER_BACKENDTOOL |
Invoke the get_quote operation. |
emerald_submit_order |
PAPER_BACKENDTOOL |
Invoke the submit_order operation. |
15 action-routed tool(s) · 9 verbose 1:1 tool(s). Each is enabled unless its <DOMAIN>TOOL toggle is set false; MCP_TOOL_MODE selects the surface (intent default — the six verb-tools, granular set loaded on demand · condensed action-routed · verbose 1:1 · both). Auto-generated — do not edit.
| Backend | Assets | Paper | Live | Free |
|---|---|---|---|---|
| Paper | All | ✅ | — | ✅ |
| Alpaca | Equities, Crypto | ✅ | ✅ | ✅ |
| CCXT (Binance) | Crypto | ✅ | ✅ | ✅ |
| CCXT (Coinbase) | Crypto | ✅ | ✅ | ✅ |
| CCXT (Kraken) | Crypto | ✅ | ✅ | ✅ |
| Freqtrade | Crypto | ✅ | ✅ | ✅ |
| Prediction Markets (Kalshi/Polymarket) | Events/Weather | ✅ | ✅ | ✅ |
| Control | Default |
|---|---|
| Trading Mode | Paper (must explicitly opt into live) |
| Max Position Size | 2% of portfolio (Kelly criterion) |
| Max Portfolio Drawdown | 10% auto-halt |
| Max Daily Loss | 3% auto-halt |
| Regime Shift Detection | KS-test auto-halt |
| Human Approval for Live | Required |
| Kill Switch | emerald_orders(action="halt") |
Install the slim
[mcp]extra. The examples below installemerald-exchange[mcp]— the MCP-server extra that pulls only the FastMCP / FastAPI tooling (scion-sdk). It deliberately excludes the heavy agent-orchestration runtime (pydantic-ai,dspy,llama-index,tree-sitterand the agent frontends), souvx/container installs stay smaller and faster — note the mandatorymedulla[full]engine is still present either way, since it is a base dependency ofscion-sdkitself, not gated behind an extra. Use the full[agent]extra only when the operator need the integrated Pydantic AI agent (see Installation). Add trading-backend extras ([alpaca],[crypto],[prediction_markets], …) on top as needed.
{
"mcpServers": {
"emerald-exchange": {
"command": "uvx",
"args": ["--from", "emerald-exchange[mcp]", "emerald-exchange-mcp"],
"env": {}
}
}
}emerald-exchange-mcp --transport streamable-http --port 8100All trading settings are configured via ~/.config/agent-connectors/config.json:
{
"trading": {
"default_mode": "paper",
"default_exchange": "alpaca",
"exchanges": {
"alpaca": {
"enabled": true,
"api_key_env": "ALPACA_API_KEY",
"api_secret_env": "ALPACA_SECRET_KEY",
"base_url": "https://paper-api.alpaca.markets"
}
},
"risk_limits": {
"max_position_pct": 0.02,
"max_portfolio_drawdown_pct": 0.10,
"max_daily_loss_pct": 0.03,
"require_human_approval_live": true
}
}
}emerald-exchange can run as a local stdio process or container, or behind a remote
network boundary. The
Deployment guide carries
the detailed transport contract.
- Local container — launch a reviewed immutable image as a least-privilege stdio child with no listener or published port.
- Remote URL — connect through an operator-supplied authenticated HTTPS
ingress. Keep its URL, outbound identity references, trust profile, and exact
MCP_ALLOWED_HOSTSinAgentConfig.
This MCP server supports dynamic toolset selection and visibility filtering at runtime. This allows the operator to restrict the set of exposed tools to prevent blowing up the LLM's context window.
The operator can configure tool filtering via multiple input channels:
- CLI Arguments: Pass
--toolsor--toolsets(or their disabled counterparts--disabled-toolsand--disabled-toolsets) during startup. - Environment Variables: Define standard environment variables:
MCP_ENABLED_TOOLS/MCP_DISABLED_TOOLSMCP_ENABLED_TAGS/MCP_DISABLED_TAGS
- HTTP SSE Request Headers: Pass custom headers during transport initialization:
x-mcp-enabled-tools/x-mcp-disabled-toolsx-mcp-enabled-tags/x-mcp-disabled-tags
- HTTP SSE Request Query Parameters: Append query parameters directly to the operator's transport connection URL:
?tools=tool1,tool2?tags=tag1
When query strings or parameters are provided, an LLM-free Knowledge Graph resolution layer (using DynamicToolOrchestrator) matches query intents against known tool tags, names, or descriptions, with safe fallback and automated 24-hour background cache refreshing.
Pick the extra that matches what the operator want to run, then layer trading-backend extras on top:
| Extra | Installs | Use when |
|---|---|---|
emerald-exchange[mcp] |
Slim MCP server (scion-sdk — FastMCP/FastAPI; still carries the mandatory medulla[full] base engine) + paper backend |
The operator only run the MCP server (smallest install / image) |
emerald-exchange[agent] |
Full agent runtime (scion-sdk — Pydantic AI/DSPy orchestration + medulla[full]) |
The operator run the integrated agent |
emerald-exchange[all] |
Everything (mcp + agent + every trading backend) |
Development / full surface |
pip install "emerald-exchange[mcp]" # MCP server only (slim deps)
pip install "emerald-exchange[agent]" # Full agent runtime (Pydantic AI + engine)
pip install "emerald-exchange[mcp,alpaca]" # + Alpaca equities
pip install "emerald-exchange[mcp,crypto]" # + CCXT crypto
pip install "emerald-exchange[mcp,prediction_markets]" # + Kalshi & Polymarket
pip install "emerald-exchange[all]" # EverythingAlpaca operators can stream live quotes and raw minute bars into an SDK
StreamBus with AlpacaBackend.stock_stream(bus, symbols, feed=..., license_tag=...).
Subscribe to market.<symbol>.quotes and market.<symbol>.bars before running
the returned stream's blocking run() in a dedicated thread; call stop() from
another thread to shut it down. Updated bars use the same identity and set
updated to true. Feed and licensing labels remain explicit. The live stream
does not backfill gaps after reconnect; reconcile with stock history as needed.
For historical one-minute IEX or SIP bars, set session_scope to
alpaca_calendar to label bars using the Alpaca exchange calendar. Labels
distinguish pre-market, regular, post-market, and outside-session minutes;
half-days and holidays follow the returned calendar and Alpaca's schedule.
Other feeds and wider bars refuse this classification. The default remains
feed_native, which makes no session claim.
To use company profile, income statement, earnings and logo sources alongside
Alpaca, configure fmp_api_key_env in the Alpaca exchange settings to name the
environment variable containing a Financial Modeling Prep API key. The key is
sent in a request header, not the URL. Each source requires an operator-provided
license tag; the operator must ensure their FMP subscription permits the intended
use. The returned snapshot is bounded and does not claim complete historical
coverage or real-time availability. Logo data is returned only when FMP names
the expected symbol image and does not mark it as a default image.
Multi-asset source snapshots use FMP_API_KEY for FX, DATABENTO_API_KEY
for commodity spot or a specific outright futures contract, and ATTOM_API_KEY
for property valuations. Set the keys in the server environment. The declared
sources accept a tenant, source identity and operator-supplied license tag. FX
preserves base/quote direction; commodity requests return at most one trade
with its matching instrument definition for a range of at most one day. Fixed
futures contracts carry the provider expiry and an explicit no-roll policy.
ATTOM uses a property ID and reports its valuation date and age against the
chosen max_age_days. Sources are delta observations, not complete histories.
Twelve Data provides a separate XAU/USD gold spot source; its timestamp is
the last one-minute candle timestamp, not an individual trade time. Provider
subscriptions may charge for requests; access and permitted use depend
on the operator's agreements. Offline fixtures are not evidence of live rights.
One multi-stage docker/Dockerfile builds two right-sized images, selected by --target:
| Image tag | Build target | Contents | Entrypoint |
|---|---|---|---|
knucklessg1/emerald-exchange:mcp |
--target mcp |
emerald-exchange[mcp] — slim: no pydantic-ai/dspy/llama-index/tree-sitter agent-orchestration stack (the mandatory medulla[full] engine is still present — it's a base dependency of scion-sdk) |
emerald-exchange-mcp |
knucklessg1/emerald-exchange:2.3.6 |
--target agent (default) |
emerald-exchange[agent] — full agent runtime (scion-sdk) + medulla[full] |
emerald-exchange-agent |
docker build --target mcp -t knucklessg1/emerald-exchange:mcp docker/ # slim MCP server
docker build --target agent -t knucklessg1/emerald-exchange:2.3.6 docker/ # full agent
docker compose -f docker/mcp.compose.yml up -d # run the slim :mcp server
docker compose -f docker/compose.yml up -d # full stackBoth [mcp] and [agent] carry the medulla engine through the required
Scion SDK core dependency (medulla[full]) — it is a mandatory base
dependency of scion-sdk, not gated behind an extra. The [mcp] extra keeps
the server slim/connector-focused (no agent-orchestration stack); [agent]
also enables Pydantic AI/DSPy model orchestration. Local deployments can use
the bundled engine. For production — or to share one knowledge graph across multiple
agents — run medulla as its own dedicated database service and point the
runtime at it instead of embedding it. Deployment recipes (single-node + Raft HA),
connection configuration, and the full database architecture (with diagrams) are
documented in the
medulla deployment guide.
The complete documentation is published as the official documentation site and is the recommended reference for installation, deployment, and day-to-day operation.
| Page | Contents |
|---|---|
| Installation | pip, source, extras, prebuilt Docker image |
| Deployment | run the MCP and agent servers, Compose, Caddy + Technitium, env config |
| Usage | the MCP tools, the Python API, the cockpit CLI |
| Overview | enterprise features, tool surface, architecture |
| Configuration Schema | the trading config block and backend matrix |
| Concepts | concept registry (CONCEPT:EE-*) |
AGENTS.md is the canonical contributor/agent guidance.
This package can be provisioned for you — skill-guided — by the agent-os-genesis
universal skill (its single-package deploy mode): it picks your install method, seeds
secrets to OpenBao/Vault (or .env), trusts your enterprise CA, registers the MCP
server, and verifies it — the same machinery that stands up the whole Agent OS, narrowed
to just this package. Ask your agent to "deploy emerald-exchange with agent-os-genesis".
| Install mode | Command |
|---|---|
| Bare-metal, prod (PyPI) | uvx emerald-exchange-mcp · or uv tool install emerald-exchange |
| Bare-metal, dev (editable) | uv pip install -e ".[all]" · or pip install -e ".[all]" |
| Container, prod | deploy knucklessg1/emerald-exchange:2.3.6 via docker-compose / swarm / podman / podman-compose / kubernetes |
| Container, dev (editable) | deploy docker/compose.dev.yml (source-mounted at /src; edits live on restart) |
Secrets are read-existing + seeded via vault_sync — you are only prompted for what's missing.
For a tiny/single-node-prod profile scoped to just this package (no whole-homelab
genesis), the deployment skill runs the equivalent
install-mode/secrets/doctor/registration/observability/rollback sequence. Ask the operator's
agent to "deploy emerald-exchange with deployment".
| Install mode | Command |
|---|---|
| Installed package | uv tool install "emerald-exchange[mcp]", then run emerald-exchange-mcp |
| Editable source | uv pip install -e ".[agent]", then run emerald-exchange-mcp |
| Immutable container | deploy knucklessg1/emerald-exchange:2.3.6 through the operator-selected orchestrator |
Either path: the repository embeds no deployment profile, credential value,
certificate path, or environment-specific endpoint. Runtime secrets, TLS trust
material, and endpoints come from AgentConfig / the configured secret provider
(OpenBao or .env), never from a committed file.
| Variable | Example | Description |
|---|---|---|
ATTOM_API_KEY |
secret-injected | ATTOM property valuation API key. |
DATABENTO_API_KEY |
secret-injected | Databento historical market data API key. |
FMP_API_KEY |
secret-injected | Financial Modeling Prep FX API key. |
TWELVE_DATA_API_KEY |
secret-injected | Twelve Data gold spot API key. |
BINANCE_API_KEY |
secret-injected | Per-exchange credentials are resolved at runtime from the trading config's *_env keys; only the scion-sdk-inherited Binance pair is read statically. Other exchanges (Alpaca, Coinbase, ...) supply credentials via operator config. |
BINANCE_SECRET_KEY |
secret-injected | |
CRYPTOTOOL |
True |
crypto market tools |
DEBATETOOL |
True |
multi-agent debate tools |
DERIVATIVESTOOL |
True |
options/futures derivatives tools |
FUNDAMENTALSTOOL |
True |
SEC/EDGAR fundamentals tools |
MARKET_DATATOOL |
True |
market-data tools |
MARKET_MAKINGTOOL |
True |
market-making tools |
ORDERTOOL |
True |
order placement/management tools |
PORTFOLIOTOOL |
True |
portfolio tools |
PREDICTION_MARKETTOOL |
True |
prediction-market tools |
RISKTOOL |
True |
risk tools |
SIGNALTOOL |
True |
signal tools |
STATARBTOOL |
True |
statistical-arbitrage tools |
STRATEGYTOOL |
True |
strategy tools |
WALLET_INTELTOOL |
True |
Polymarket wallet-intelligence tools |
KG_INGESTTOOL |
True |
knowledge-graph ingest tools |
EDGAR_IDENTITY |
Your Name your.email@example.com |
SEC EDGAR identity ("Name email") |
EDGAR_USER_AGENT |
Your Name your.email@example.com |
legacy fallback for EDGAR_IDENTITY |
POLY_TRADES_PATH |
/path/to/poly_trades.parquet |
Polymarket trade dataset for wallet-intel |
EMERALD_STAGE_APPROVAL_TOKEN |
secret-injected | human approval token to promote execution stage |
MEDULLA_SOCKET |
/run/medulla.sock |
UDS path to the medulla engine |
GRAPH_SERVICE_SOCKET |
/run/medulla.sock |
alternate UDS path env var |
MEDULLA_TCP |
127.0.0.1:50051 |
host:port for a TCP engine endpoint |
| Variable | Example | Description |
|---|---|---|
TRANSPORT |
stdio |
MCP transport: stdio | streamable-http | sse |
HOST |
127.0.0.1 |
Loopback bind host (set an authenticated ingress explicitly) |
PORT |
8000 |
Bind port (HTTP transports) |
MCP_TOOL_MODE |
intent |
Tool surface: intent | condensed | verbose | both |
MCP_ENABLED_TOOLS |
— | Comma-separated tool allow-list |
MCP_DISABLED_TOOLS |
— | Comma-separated tool deny-list |
MCP_ENABLED_TAGS |
— | Comma-separated tag allow-list |
MCP_DISABLED_TAGS |
— | Comma-separated tag deny-list |
EUNOMIA_TYPE |
none |
Authorization mode: none | embedded | remote |
EUNOMIA_POLICY_FILE |
mcp_policies.json |
Embedded Eunomia policy file |
EUNOMIA_REMOTE_URL |
— | Remote Eunomia authorization server URL |
ENABLE_OTEL |
False |
Enable OpenTelemetry export |
OTEL_EXPORTER_OTLP_ENDPOINT |
— | OTLP collector endpoint |
MCP_CLIENT_AUTH |
— | Outbound MCP child auth: oidc-client-credentials | basic | none |
OIDC_CLIENT_ID |
— | OIDC client id (service-account auth) |
OIDC_CLIENT_SECRET_REF |
secret://identity/oidc-client-secret |
Runtime secret reference for the OIDC service account |
MCP_BASIC_AUTH_USERNAME |
— | HTTP Basic username (MCP_CLIENT_AUTH=basic) |
MCP_BASIC_AUTH_PASSWORD_REF |
secret://identity/mcp-basic-password |
Runtime secret reference for HTTP Basic auth (MCP_CLIENT_AUTH=basic) |
DEBUG |
False |
Verbose logging |
PYTHONUNBUFFERED |
1 |
Unbuffered stdout (recommended in containers) |
MCP_URL |
http://localhost:8000/mcp |
URL of the MCP server the agent connects to |
PROVIDER |
— | Operator-configured LLM provider for the agent |
MODEL_ID |
— | Operator-configured model id for the agent |
ENABLE_WEB_UI |
True |
Serve the AG-UI web interface |
24 package + 24 inherited variable(s). Auto-generated from .env.example + the shared scion-sdk set — do not edit.
This package ships a compact canonical skill surface with specialist procedures
kept as referenced workflows. The current MCP tools, skill metadata,
connector_manifest.yml, ontology, mappings, shapes, fixtures, migrations,
tool-schema fingerprints, and certification metadata form one versioned
capability contract. Validate them together; do not rely on stale tool names or
historical per-task skill wrappers.
Runtime endpoints, credentials, certificate trust, tenant identity, retention, and observability policy are deployment inputs and are never packaged values. See Configuration, trust, and privacy before enabling a network transport, connector ingestion, Arbora delegation, or trace export.