StataBLOCK
A lightweight Model Context Protocol (MCP) server for Stata. Execute commands, inspect data, retrieve stored results (r()/e()), and view graphs in your chat interface. Built for economists who want to integrate LLM assistance into their Stata workflow.
Overview
From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.
mcp-stata is an agentic toolkit for empirical researchers. It gives AI agents native control over a local Stata installation, allowing agents to run do-files, inspect data, check stored results, and export graphs. Contains a skills catalog for workflows researchers use often: auditing data, replication and robustness checks, specification comparisons, publication QA, referee responses, and modernization of legacy code. Featured in News.
If you'd like a fully integrated VS Code extension to run Stata code without leaving your IDE, and also allow AI agent interaction, check out my other project: Stata Workbench.
Built by Thomas Monk, London School of Economics.
This server enables LLMs to:
- Execute Stata code: run any Stata command (e.g.
sysuse auto,regress price mpg). - Inspect data: retrieve dataset summaries and variable codebooks.
- Export graphics: generate and view Stata graphs (histograms, scatterplots).
- Streaming graph caching: automatically cache graphs during command e
581ba21d4c81OBSERVED · 2026-10-07Connect
Built from this server's own package name, version and transport as found in its source — not copied from anyone's documentation, so it cannot drift against a page we do not control. Replace the environment placeholders with a token scoped to the least it needs.
claude mcp add mcp-stata -- None mcp-stata==3.3.0
Trust audit
BLOCKgrade F · trust 57/100 Do not install this without reading the findings. The audit found something that could harm you or your machine.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | WARN |
| L1 | Static analysis of the code | FAIL |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- declared (7 observation(s))
- Network
- declared (5 observation(s))
- Shell
- declared (4 observation(s))
- Dependencies
- not all pinned
- Secrets in source
- none-found
Findings (25)
ok = bool(eval(code, {"__builtins__": {}}, env))".netrc",
"id_rsa",
"id_ed25519",
.agents
.claude-plugin
.codex-plugin
.mcp.json
plugin/.agents/skills
print(f"Dashboard → http://127.0.0.1:{PORT}").envrc.example
if eval(code, {"__builtins__": {}}, env):return hashlib.md5(fingerprint_raw.encode("utf-8")).hexdigest()return hashlib.md5(data).hexdigest()
suffix = hashlib.md5((name or "").encode("utf-8")).hexdigest()[:8]suffix = hashlib.md5((sig or "").encode("utf-8")).hexdigest()[:8]return hashlib.sha1(json.dumps(payload, sort_keys=True).encode("utf-8")).hexdigest()print(f"Token: {channel_info.token}")os.environ.copy() ... curl
"baseUrl": "http://127.0.0.1:53741",
$env:MCP_STATA_TELEMETRY_URL = "http://255.255.255.255/unreachable"
apache-arrow, node-fetch
- README, use curl | bash for installer commands
curl -LsSf https://mcp-stata-install.tdmonk.com/install.sh | bash
Gates applied: no_behavioural_pass.
581ba21d4c81full audit observations/trust-audit/mcp-server/tmonk__stata-2.json · Report an issue / request a re-scanAudit history
Every audit this server has had. A grade with a past is a grade somebody is still checking.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-07 | 581ba21d4c81 | BLOCK | F | 57 | first audit |
Questions
What is the Stata MCP server?
A lightweight Model Context Protocol (MCP) server for Stata. Execute commands, inspect data, retrieve stored results (r()/e()), and view graphs in your chat interface. Built for economists who want to integrate LLM assistance into their Stata workflow.
Is Stata safe to connect to an agent?
No — not without reading the findings first. The audit graded it F (57/100) and found 4 critical or high issues in the source. Each one is listed on this page with the file and line it is on.
What credentials does Stata need?
It reads CF_API_TOKEN from the environment. Give it a token scoped to the least it needs — an agent that can be talked into calling a tool can be talked into calling it with your credentials.
How does Stata run?
It speaks stdio, so it runs as a local process your client starts. It is published on npm as mcp-stata-installer-worker at 3.3.0.
How current is this page?
The grade is for one exact copy of the source (581ba21d4c81), read on 2026-10-07. The repository is watched and re-audited when it changes.