mcpField
D
DAG Studio MCP

DAG Studio MCP

Remote
dagstudio.blackswancausallabs.comScience & Education0Updated 4w ago

About DAG Studio MCP

DAG Studio MCP is a server for AI agents analyzing and validating causal directed acyclic graphs. Its tools cover identification, adjustment, simulation, and bias, with responses carrying validation and diagnostic details.

Key features

  1. 01Analyze paths and adjustment sets
  2. 02Parse dagitty DSL
  3. 03Generate R and Python code
  4. 04Check overadjustment
  5. 05Simulate data and compute bias
  6. 06Validate against canonical cases

Use cases

  1. 01Assess confounding and identifiability
  2. 02Check adjustment strategies for bias
  3. 03Generate analysis code from a DAG

MCP support

Exposes DAG construction, analysis, simulation, and validation tools to MCP clients. It can run locally over stdio or as a hosted Streamable HTTP endpoint.

Configuration

Remote servers need no local install. Pick your client, then copy the config or install in one click.

Endpointhttps://dagstudio-mcp.blackswancausallabs.com/mcp
Copy install command
Claude CodeTerminal
Cursor.cursor/mcp.json
VS Code.vscode/mcp.json
Claude Desktopclaude_desktop_config.json
Windsurf~/.codeium/windsurf/mcp_config.json

Run commands in a terminal; paste JSON into the client’s MCP config and restart. Servers that need sign-in will prompt on first connect.

All endpoints
Streamable HTTPhttps://dagstudio-mcp.blackswancausallabs.com/mcpAuth required

Tools

Details

From the project README

dag-studio-mcp

CI License: Apache 2.0

Model Context Protocol (MCP) server for the DAG Studio causal-inference engine. It lets AI agents construct, analyze, and validate causal directed acyclic graphs (DAGs) using the same engine that powers the DAG Studio canvas.

Built and maintained by Black Swan Causal Labs. Listed in the RWE MCP Registry.

Tools

ToolWhat it does
analyze_dagBackdoor paths, minimal sufficient adjustment sets, identifiability
parse_dagittyParse dagitty DSL (raw or R-wrapped) into the structured DAG model
generate_codeR / Python analysis code for a DAG, plus a one-click DAG Studio URL
check_overadjustmentDetect adjustment for mediators, colliders, and descendants of exposure
simulate_dataSimulate data from a DAG under user-specified structural coefficients
compute_biasEmpirical bias of an adjustment strategy against the simulated truth
classify_effect_modificationClassify effect-modifier structure (direct, indirect, proxy, common-cause, pure interaction)
get_canonical_exampleCanonical teaching DAGs (confounding, M-bias, frontdoor, and others)
validate_engineRun the full canonical validation suite and report engine version

Every analytical response carries an engine_version stamp, a concordance attestation, a diagnostics block with severity-coded flags, and citations to the underlying methods literature.

Validation

The engine is validated four ways for coherence: against Pearl (2009) theory, against the reference implementation dagitty (Textor et al. 2016), against DAG Studio's own analytical results, and empirically via compute_bias on simulated data.

  • 35 canonical cases: T01 to T15 (structural identification) and EM01 to EM20 (effect modification), runnable live via validate_engine.
  • A release-gate concordance check runs the engine head-to-head against dagitty (vendored at upstream commit 7a65777) and stamps the attestation surfaced in tool responses.
  • 93 unit and integration tests across the engine bindings, the tool layer, and the auth gate.

Hosted endpoint

The server runs as a Cloudflare Worker (Streamable HTTP):

https://dagstudio-mcp.blackswancausallabs.com/mcp

Access is token-gated during the trial period. Request a token at [email protected]. Tokens are accepted either as a bearer header or as a ?token= query parameter (the query form exists for clients whose connector UI cannot set custom headers, such as the Claude.ai web connector).

Claude Code:

claude mcp add --transport http dag-studio \
  https://dagstudio-mcp.blackswancausallabs.com/mcp \
  --header "Authorization: Bearer <your token>"

Claude.ai web: add a custom connector pointed at https://dagstudio-mcp.blackswancausallabs.com/mcp?token=<your token>.

Repository layout

  • dag-engine.js / dag-engine.d.ts: the analytical engine, a pure ESM module with no runtime dependencies
  • src/tools/: one file per tool, each exporting { InputSchema, OutputSchema, descriptor, handler }
  • src/worker/: Cloudflare Worker transport and the token gate (auth.ts)
  • src/index.ts: stdio entry point for local use
  • ci/: release-gate concordance harness against vendored dagitty
  • tests/: unit and integration tests (npm test)
  • MCP_REQUIREMENTS.md: the v1 specification
  • FDA_GUIDANCE_ALIGNMENT.md: mapping of DAG Studio capabilities onto FDA draft RWE guidance protocol elements

The engine is developed alongside the DAG Studio canvas app and the vendored copy here is synced at release time. This repository is self-contained: clone it, npm install, and everything builds and tests without further setup.

Development

npm install
npm test                  # full suite
npm run dev               # stdio server via tsx
npm run worker:typecheck  # worker bundle typecheck
npm run worker:deploy     # deploy (stamps engine_version from git HEAD first)

For interactive inspection: npx @modelcontextprotocol/inspector.

Protocol status

Built on @modelcontextprotocol/sdk (TypeScript). Current against the finalized MCP specification revision 2025-11-25. Migration to the 2026-07-28 revision is planned once stable SDK support ships.

License

Apache License 2.0 (see LICENSE).

Exception: ci/dagitty-src/ contains the dagitty reference engine (GPL-2.0, Textor et al.), vendored at upstream commit 7a65777 solely as a release-time CI fixture for the concordance check. It retains its own license, is excluded from the published npm package, and is not part of the deployed worker bundle.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.