Skip to main content
Glama
STATA-MCP Repro

STATA-MCP Repro

by taewat07

STATA-MCP

Project-local, reproducible Stata execution for humans and AI agents. Every managed analysis stays beside its source project and produces immutable, readable do-files, logs, results, graphs, and provenance.

Why this exists

Existing Stata MCP servers prove that agents can call Stata. STATA-MCP Repro adds the controls required for real research: explicit project ownership, deterministic planning gates, immutable run identity, process-tree cancellation, typed results, graph provenance, safe migration, and one shared human/agent ledger.

Core guarantees:

  • startup never creates a workspace;

  • no forced stata-mcp-folder and no copied central archive;

  • one .stata-mcp.toml selects a human-readable project-relative artifact directory;

  • run names are descriptive and collision-safe;

  • completed runs are immutable and every artifact is SHA-256 bound to its run;

  • medical and other material analyses require a reviewed, approved plan;

  • dashboard listens only on 127.0.0.1 with an expiring bearer token;

  • humans and agents create the same canonical run records.

Related MCP server: Stata MCP Server

Start

Prerequisites: Python 3.11–3.13, a separately licensed Stata installation, and uv.

git clone https://github.com/taewat07/STATA-MCP-AGENT.git
cd STATA-MCP-AGENT
uv tool install .
stata-mcp install --all
cd "/path/to/research-project"
stata-mcp project init --artifact-dir "analysis/stata" --name "Readable study name"
stata-mcp doctor

Restart the AI client after installation. Use stata-planner to inspect and approve a material analysis, then stata-analyst to execute it. Humans can inspect the same ledger with:

stata-mcp dashboard --project .

The command prints the loopback URL and a short-lived token. The VS Code client connects to this service; it never starts or stops the MCP server.

Documentation

Read the installation guide, architecture, human and agent workflows, provenance contract, and security model. Legacy users should follow the copy-first migration guide.

Contributions follow CONTRIBUTING.md, the Code of Conduct, and the public security policy.

Status and attribution

Pre-release 0.1.x; APIs may change under the documented two-release deprecation policy. Derived from SepineTam's MCP-for-Stata 1.21.3; see THIRD_PARTY_NOTICES.md. Not affiliated with or endorsed by StataCorp LLC. Licensed AGPL-3.0-or-later.

Available Tools

22 tools
append_dofileD

Deprecated: create an immutable child run with run_prepare.

Inputs: content (required), run_name (required), original_dofile_path (required), intent, +3 more. Returns: ok, run, data, error, +1 more

artifact_readA

Read one bounded text or image artifact belonging to a run.

Inputs: run_id (required), relative_path (required), max_bytes, project_path. Returns: ok, run, data, error, +1 more

data_inspectB

Inspect dataset metadata, missingness, labels, and bounded previews.

Inputs: data_path (required), variables, preview_rows, project_path. Returns: ok, run, data, error, +1 more

get_data_infoC

Deprecated: use data_inspect.

Inputs: data_path (required), head, vars_list, project_path. Returns: ok, run, data, error, +1 more

graph_getB

List run graphs or read one bounded, verified graph payload.

Inputs: run_id (required), max_bytes, project_path, relative_path. Returns: ok, run, data, error, +1 more

helpB

Deprecated: use stata_help.

Inputs: command (required), project_path. Returns: ok, run, data, error, +1 more

load_figureC

Deprecated: use artifact_read.

Inputs: figure_path (required), max_bytes, project_path. Returns: ok, run, data, error, +1 more

mk_dirD

Removed: initialize a project once; server owns artifact directories.

Inputs: path (required). Returns: ok, run, data, error, +1 more

plan_approveB

Freeze a ready analysis plan with explicit approval evidence.

Inputs: plan_id (required), approved_by (required), approval_statement (required), expected_plan_sha256 (required), +1 more. Returns: ok, run, data, error, +1 more

plan_prepareC

Create or update a privacy-safe draft analysis plan.

Inputs: draft (required), plan_id, project_path, dataset_profile, +1 more. Returns: ok, run, data, error, +1 more

project_initC

Initialize one project with a human-readable relative artifact path.

Inputs: artifact_dir (required), project_name, project_path. Returns: ok, run, data, error, +1 more

project_statusC

Inspect selected project, Stata, backend, and capabilities.

Inputs: project_path. Returns: ok, run, data, error, +1 more

read_fileD

Deprecated: use artifact_read.

Inputs: file_path (required), max_bytes, project_path. Returns: ok, run, data, error, +1 more

read_logC

Deprecated: use artifact_read.

Inputs: file_path (required), max_bytes, project_path. Returns: ok, run, data, error, +1 more

results_getB

Return typed structured results bound to one finalized run.

Inputs: run_id (required), project_path. Returns: ok, run, data, error, +1 more

run_controlB

Request cancellation of one active background run.

Inputs: action (required), run_id (required), project_path. Returns: ok, run, data, error, +1 more

run_executeB

Execute one prepared run synchronously or in the background.

Inputs: run_id (required), background, project_path, timeout_seconds. Returns: ok, run, data, error, +1 more

run_prepareA

Create an immutable, descriptively named run without executing it.

Inputs: intent (required), run_name (required), dofile_content (required), plan_id, +5 more. Returns: ok, run, data, error, +1 more

run_statusB

Read durable lifecycle state and provenance paths for one run.

Inputs: run_id (required), project_path. Returns: ok, run, data, error, +1 more

stata_doC

Deprecated: prepare and execute a project-local run.

Inputs: dofile_path (required), intent, plan_id, run_name, +3 more. Returns: ok, run, data, error, +1 more

stata_helpB

Retrieve Stata command documentation through licensed local Stata.

Inputs: command (required), project_path. Returns: ok, run, data, error, +1 more

write_dofileC

Deprecated: use run_prepare.

Inputs: content (required), run_name (required), intent, plan_id, +2 more. Returns: ok, run, data, error, +1 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.5/5.0

    Scored across 22 tools

    Disambiguation4/5

    Active tools have distinct purposes across planning, project management, run lifecycle, data inspection, and output retrieval. Deprecated tools are clearly labeled with redirecting messages, so misselection is unlikely despite some overlap in names.

    Naming Consistency3/5

    All tools use snake_case, but there is a clear split: active tools favor object_verb naming (e.g., run_prepare, data_inspect) while deprecated tools use verb_object naming (e.g., write_dofile, read_file). This mixed pattern reduces readability, though deprecated markers mitigate confusion.

    Tool Count3/5

    The total of 22 tools is heavy, and 9 of them are deprecated, artificially inflating the surface. The active 13 tools form a well-scoped set, but the obsolete entries should be removed to bring the count into an ideal range.

    Completeness4/5

    The active tool chain covers the full reproducibility lifecycle: plan preparation and approval, project initialization, run preparation/execution/monitoring, and artifact retrieval. Minor gaps like lack of list operations for runs or projects are workable.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides a bridge between Stata statistical software and code editors like VS Code and Cursor, enabling users to run Stata commands directly from the editor, view output in real-time, and get AI-powered assistance with Stata coding.
      532
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Connects AI agents to a local Stata installation, enabling execution of Stata code, data inspection, graph generation, and result verification through natural language interactions.
      987 PyPI
      92
      AGPL 3.0
    • A
      license
      A
      quality
      C
      maintenance
      Enables LLM/agent applications to execute Stata code, load and inspect data, obtain structured regression results and graphs, and manage background tasks through the Model Context Protocol.
      10
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to invoke a local Stata installation, including a Windows Stata build under Wine on Linux and macOS, for regression analysis, econometrics, paper replication, and empirical research with command guards, resource monitoring, and automatic log capture.
      4
      2
      AGPL 3.0