trading-swarm-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| ALPACA_SECRET | No | Alpaca API secret. Required only if SWARM_MCP_BYOK=1 on swarm-data-mcp. | |
| ALPACA_API_KEY | No | Alpaca API key. Required only if SWARM_MCP_BYOK=1 on swarm-data-mcp. | |
| SWARM_MCP_BYOK | No | Set to '1' to fetch directly from Alpaca/Finnhub instead of the hosted relay (swarm-data-mcp only). Public users should leave unset. | 0 |
| FINNHUB_API_KEY | No | Finnhub API key. Required only if SWARM_MCP_BYOK=1 on swarm-data-mcp. | |
| SWARM_MCP_LOCAL_TOKEN | No | Local development bootstrap token. For operators of this repo, set to the same value as SWARM_MCP_ACCESS_TOKEN to skip token verification against the site. | |
| SWARM_MCP_ACCESS_TOKEN | Yes | Access token issued by https://1.21initiative.com/. Required for all three servers. Every tool call is gated on this token; clients can list tools without it, but calls return ACCESS_REQUIRED. | |
| SWARM_MCP_TELEMETRY_OPT_IN | No | Set to 'opt-in' to enable telemetry. Counters only; no symbols, genomes, prices, or credentials. | 0 |
| SWARM_MCP_TOKEN_VERIFY_URL | No | URL used for access-token verification. Only the token is sent. | https://1.21initiative.com/api/mcp/verify |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Start backtest and strategy evaluations with the guided Quant Swarm Audit workflow: audit.preflight -> audit.quote -> audit.run -> audit.status -> audit.report -> audit.compare. For point checks, use warden.*. Over local stdio, your orders, returns, features, and genomes stay on this machine unless you explicitly opt into mode='hosted'. Promotion verdicts are never issued locally; warden.promotion_verdict runs a free local readiness check (INDETERMINATE_LOCAL). This server never places, cancels, or routes orders.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| warden.validate_orderA | Validate a proposed order against the house floors (max position 25%, gross cap 60%). order: {symbol, notional, side: buy|sell}; current_positions: {symbol: notional}. Per-fund overrides are allowed but the response always reports the deviation from the house floors. Rejections quote the exact floor — the same function gating live capital. |
| warden.audit_featuresA | Audit a feature manifest for lookahead leakage and provenance violations. manifest: [{name, source, value_ts, as_of}]. Flags banned actuals sources (open-meteo.archive etc.), features predating tape start, and unknown features fail closed to tier C. Optional coverage check vs MIN_COVERAGE=0.90 for challenger-selected symbols against the archived snapshot universe. |
| warden.cost_checkA | Convert a claimed gross edge into net-of-cost reality under the pessimistic fill model. Spread + slippage + adverse selection are charged at both entry and exit, always against the position — the same model the gym scores every episode with. |
| warden.validate_genomeA | Validate a genome against the bounded schema and return its canonical genome_hash. The hash is the reproducible strategy identity used as challenger_id in the hosted tournament and in audit_request blocks. |
| warden.explain_sizingA | Step-by-step mirror of the live C# risk engine sizing: ATR sizing, position-notional cap, overnight-gap halving, weekend gross headroom. Reports the house floors and any deviation when per-fund overrides are supplied. |
| warden.promotion_verdictA | Deterministic local promotion-readiness & prerequisite check (free, 0 credits). Always returns verdict=INDETERMINATE_LOCAL because promotion selection machinery (Deflated Sharpe, PBO cap, trials ledger) runs server-side only. Validates genome schema, checks Tier-A/B/C mutation eligibility vs champion_genome, returns readiness_status (READY_FOR_HOSTED_TOURNAMENT | BLOCKED_SCHEMA_INVALID | BLOCKED_TIER_B_C_REQUIRES_TAPE), names missing statistical inputs, and emits an audit_request plus cloud_job spec for tournament.submit. |
| warden.optimize_portfolioA | Computes volatility-targeted dual-momentum, hierarchical risk parity, or shrinkage mean-variance portfolio weights under the house concentration and turnover caps. Residual capital is swept to the defensive cash proxy; never places or routes trades. Pro tool. |
| warden.plan_rebalanceA | Checks the portfolio drawdown circuit breaker, feature drift guard, 3% turnover drift buffer, and bid-ask spread gate. Sequences sell reductions before buy additions with marketable limit collars; never routes trades. |
| warden.prop_challenge_checkA | Checks a proposed trade against TwoStep or OneStep prop-firm drawdown and consistency rules. Evaluates hard and safe daily loss floors, overall drawdown stop, 30-40% single-day consistency cap, 0.55x Target-Lock Taper when >=70% of profit target is banked, and friction-adjusted trade risk. Pure risk/compliance rules — never places orders. |
| warden.defensive_postureA | Classifies portfolio risk posture into Normal, Cautious, Defensive, or CrisisShield. Uses trailing volatility, efficiency ratio, and drawdown stress to compute the recommended risk-scale multiplier (1.00x down to 0.20x), stop-tightening factor (1.00x down to 0.55x), and effective portfolio stop-heat cap. Pure risk governance. |
| audit.backtestA | Runs a complete zero-trust backtest forensic audit in a single call at 0 credits. Evaluates lookahead leakage, Newey-West HAC t-stat, Benjamini-Hochberg q-value, Deflated Sharpe, 1x/2x cost survival, drawdown tails, and top-5 trade concentration locally. |
| audit.backtest_inlineA | Runs a one-shot backtest forensic audit over inline CSV or row arrays with zero server disk I/O. Built for remote HTTP connectors (claude.ai, ChatGPT, web MCP): evaluates Newey-West HAC significance, BH q-value, cost survival, concentration, and PIT leakage up to 250 KB. |
| audit.preflightA | Validates strategy returns, trades, benchmark, cost assumptions, and feature manifests locally at 0 credits. Returns a Coverage & Scope Matrix separating available checks, NOT_TESTED checks, and an outbound data preview. |
| audit.quoteA | Prices a validated preflight manifest before execution. Returns the deterministic execution plan, runtime estimate, exact credit/GBP cost, and an input-bound approval_token. |
| audit.runB | Executes the Quant Swarm Audit and records a reproducible job bundle. Enforces approval_token verification, idempotency_key deduplication, and max_credits spend cap; never charges on preflight refusals. |
| audit.statusA | Polls an audit job by job_id in read-only mode at 0 credits. Returns completion status, overall diagnostic assessment, finding counts by category, and input SHA-256 hash. |
| audit.reportA | Generates the structured JSON audit bundle, reproducibility manifest, and shareable HTML/Markdown reports. Every finding includes category (OBSERVED_PROBLEM | SENSITIVITY_WARNING | INSUFFICIENT_EVIDENCE | PASSED | NOT_TESTED), evidence, impact, next experiment, and limitation. |
| audit.compareA | Compares two completed audit jobs (version A vs version B or before/after remediation). Returns a structured diff of Sharpe, net edge, cost sensitivity, drawdown, trade concentration, and resolved vs new warnings. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| pre_trade_check | The full pre-trade gate sequence (validate_order, cost_check, explain_sizing) with every verdict quoted verbatim; refusals are never softened. |
| audit_my_strategy | Genome audit: validate_genome plus audit_features findings quoted exactly, then the tournament path a promotion claim actually requires. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| Methodology | How the PIT significance verdicts are computed (neutralization, Newey-West inference, scale-free variants, staleness, placebo). |
| Verdict semantics | SIGNIFICANT / NOT_SIGNIFICANT / NOT_JUDGED / UNVERIFIED - exactly what each verdict means and never means. |
| Plans | Free/Pro plan limits and the credit rate card. |
TDQS
Scored across 18 tools
The `audit.*` tools form a clean staged pipeline (preflight → quote → run → status → report → compare), so sequence-adjacent tools are distinguishable by their stage. A few pairs bleed into each other: `audit.backtest` vs `audit.backtest_inline` run the same forensics with different I/O, `warden.validate_genome` is partly subsumed by `warden.promotion_verdict` (which also validates genome schema), and `warden.validate_order` / `warden.explain_sizing` / `warden.prop_challenge_check` all report over risk floors. Descriptions largely resolve these, so an agent can still choose correctly.
Consistent two-namespace dotted convention (`audit.*`, `warden.*`) with lowercase snake_case after the dot, which gives a strong, predictable grouping. The only wobble is verb-vs-noun style: `audit.run`/`warden.validate_order` are verb_noun, while `audit.status`, `audit.quote`, `warden.defensive_posture`, and `warden.promotion_verdict` are noun phrases.
18 tools is on the heavier side but justified by two large sub-domains: an 8-tool audit pipeline and a 10-tool risk/compliance warden. Each tool maps to a distinct operation with little redundancy; the only marginal member is `audit.backtest_inline`, a transport variant of `audit.backtest`.
The audit lifecycle is fully covered end to end (preflight, priced quote, execution with approval token and idempotency, polling, report generation, and job-to-job comparison), and the warden covers order gating, feature leakage, sizing, portfolio construction, rebalance planning, posture, promotion, and prop-firm rules. Gaps are minor but real: no job listing/cancellation, no retrieval of a past job's raw artifacts, and no account/position-state fetch tool, so agents must supply portfolio context themselves.