What DAG Studio MCP does
DAG Studio MCP MCP server exposes the analytical engine behind the DAG Studio canvas through Model Context Protocol. It works with causal directed acyclic graphs and supports both structural reasoning and simulation-based checks. An agent can inspect a graph, identify whether a target effect is identifiable, examine adjustment choices, and produce analysis code for R or Python.
The tool set covers common causal-inference workflows. analyze_dag reports backdoor paths, minimal sufficient adjustment sets, and identifiability. check_overadjustment flags adjustment for mediators, colliders, and descendants of the exposure. classify_effect_modification distinguishes direct, indirect, proxy, common-cause, and pure-interaction structures.
How it works
Graphs may be supplied through the structured DAG model or parsed from dagitty DSL with parse_dagitty. The parser accepts raw dagitty input and R-wrapped forms. get_canonical_example provides teaching graphs, including confounding, M-bias, and frontdoor examples.
For quantitative checks, simulate_data generates data from a DAG using structural coefficients supplied by the caller. compute_bias then compares an adjustment strategy with the simulated truth to produce an empirical bias assessment. generate_code returns R or Python analysis code and a URL for opening the graph in DAG Studio.
Analytical responses include an engine_version stamp, a concordance attestation, severity-coded diagnostics, and citations to the underlying methods literature. The engine is checked against Pearl's causal theory, the dagitty reference implementation, DAG Studio results, and simulation-based bias calculations. validate_engine runs the canonical validation suite and reports the engine version.
Setup and configuration
DAG Studio MCP MCP server can run locally from the repository or through the hosted Streamable HTTP endpoint at https://dagstudio-mcp.blackswancausallabs.com/mcp. Local development uses the repository's stdio entry point. The documented setup is to clone the repository, run npm install, and use npm run dev for the stdio server. npm test runs the full test suite.
The hosted endpoint is token-gated during the trial period. A token is requested from the contact address provided by the project. Clients can send it as an Authorization: Bearer header or as a token query parameter. The query form is available for connector interfaces that cannot set custom headers. Claude Code connects with the HTTP transport and bearer header; Claude.ai web uses a custom connector with the query parameter.
Tools and capabilities
- Analyze backdoor paths, adjustment sets, and identifiability.
- Parse raw or R-wrapped dagitty DSL.
- Generate R or Python code and a DAG Studio URL.
- Detect overadjustment involving mediators, colliders, or exposure descendants.
- Simulate data and calculate empirical adjustment bias.
- Classify effect-modifier structures.
- Retrieve canonical examples and run engine validation.
Limitations and notes
The hosted service requires an access token during the stated trial period. The repository contains a vendored dagitty reference engine for release-time concordance checks; that fixture has its own GPL-2.0 license and is excluded from the published npm package and deployed worker bundle. The main project is licensed under Apache License 2.0.
The implementation uses the TypeScript MCP SDK and is current against the MCP specification revision dated 2025-11-25. Migration to the later 2026-07-28 revision is planned when stable SDK support is available.