1. Conduid
  2. AI
  3. Stata
MCP server · AI

Stata

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.

Unclaimed AGPL-3.0 last commit 6 months ago econometricsstatamcpeconomicsllmmcp-serverai
67Good

Scored 1 hours ago · breakdown

About Stata

Stata is an MCP server published by tmonk in the AI category: 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. Conduid read 20 tools from its source: stata_compare_specs, stata_control, stata_discover_tests, stata_doctor, stata_estimation_plan, stata_get_help and 14 more. It is published to PyPI as mcp-stata and runs with uvx.

The repository has 92 stars and 21 forks, is licensed AGPL-3.0, and its last commit was on 12 May 2026. The latest release is v3.3.0 (10 May 2026): Bug Fixes mcp: Omit duplicate structured tool JSON by default (#55, e8e1a53) Chores Sync toolkit_catalog_data and lockfile to 3.2.8 (7b8fedd) Features… It follows v3.2.9 (10 May 2026), and the 5 most recent releases go back to v3.2.6 (10 May 2026). It passes 4 of the 6 static checks Conduid ran on the repository; it does not pass No dynamic code execution and Scoped permissions. Its topics include econometrics, stata and economics.

Install

Claude Code
claude mcp add stata -- uvx --refresh --refresh-package mcp-stata --from mcp-stata@latest mcp-stata
Run
uvx --refresh --refresh-package mcp-stata --from mcp-stata@latest mcp-stata
uvx
uvx mcp-stata
pip
pip install mcp-stata
From source
git clone https://github.com/tmonk/mcp-stata

Tools (20)

stata_compare_specsRun multiple estimation commands and compare their stored result summaries.
ParameterTypeDescription
alternative_commands *array
as_jsonboolean
base_command *string
session_idstring
stata_controlInterrupt a session or cancel a background task.
ParameterTypeDescription
action *stringThe control action to perform: - "break": Sends a BREAK signal to the specified Stata session. - "cancel": Terminates the execution of a background task.
as_jsonboolean
id *stringEither the `session_id` (for "break") or the `task_id` (for "cancel").
stata_discover_testsList all discoverable test files under path without running them.
ParameterTypeDescription
path *string
stata_doctorRun a deterministic environment and smoke-test diagnostic for mcp-stata.
ParameterTypeDescription
as_jsonboolean
session_idstring
stata_estimation_planBuild a structured estimation plan and recommended Stata command.
ParameterTypeDescription
as_jsonboolean
cluster_varstring
controlsarray
dependent_var *string
estimatorstring
fixed_effectsarray
independent_vars *array
session_idstring
stata_get_helpReturns help for a Stata command.
ParameterTypeDescription
as_jsonboolean
formatstring
legacy_textboolean
merge_paragraphsbooleanIf True, merges fixed-width split paragraphs.
plain_textbooleanIf True, returns plain text instead of Markdown.
session_idstringThe ID of the Stata session.
topic *stringThe command or topic to get help for.
stata_get_resultsReturns coherent structured result state across r()/e()/s(), with optional MATA snapshot.
ParameterTypeDescription
as_jsonboolean
include_formattingboolean
include_mataboolean
include_matricesboolean
matrix_max_colsinteger
matrix_max_rowsinteger
session_idstring
stata_get_test_resultsReturn full structured results from the last test run for a session.
ParameterTypeDescription
session_idstring
stata_inspect_dataInspect the active dataset (describe, codebook, summarize, search, get data) or code (lint).
ParameterTypeDescription
action *stringThe inspection action to perform: - "describe": Returns dataset structure and variable types. - "codebook": Detailed description of a specific variable's contents. - "summary": Descriptive statistics (mean, sd, etc.) for variables. - "search": Finds variables matching a name or label pattern. - "list": Returns a structured list of all variables in the dataset. - "get": Retrieves raw data observations from the dataset. - "lint": Performs static analysis on a .do or .ado file.
as_jsonboolean
compress_numericboolean
countintegerNumber of observations to retrieve for the "get" action.
include_missingboolean
indentinteger(For "lint") Required indentation size (default 4).
legacy_textboolean
linemaxinteger(For "lint") Maximum line length (default 80).
pathstring(For "lint") Absolute path to the file to check.
querystringSearch term for the "search" action or variable name for "codebook".
session_idstringThe ID of the Stata session to inspect.
startinteger0-indexed starting observation for the "get" action.
strip_smclbooleanIf True, removes Stata SMCL tags from text-like outputs.
variablesarrayOptional list of variables to include in the "summary" action.
stata_load_dataLoads a dataset into a Stata session.
ParameterTypeDescription
allow_unsafe_pathsboolean
as_jsonbooleanIf True, returns a structured JSON response envelope.
clearbooleanIf True (default), clears any existing data in memory before loading.
max_output_linesintegerOptional limit on the number of output lines to return.
rawbooleanIf True, returns only the raw Stata output or error message.
session_idstringThe ID of the Stata session to load data into.
source *stringPath to the dataset file or a valid Stata sysuse/webuse name.
strip_smclbooleanIf True, removes Stata SMCL tags from the output for readability.
stata_manage_graphsManage Stata graphs (list, export).
ParameterTypeDescription
action *stringThe graph management action: - "list": Returns a JSON list of all graphs currently in memory. - "export": Saves a specific graph to a file. - "export_all": Exports all graphs in memory to files.
as_jsonboolean
formatstringThe file format for export (svg, pdf, png). Defaults to "svg".
graph_namestringThe name of the specific graph to export (used with "export").
session_idstringThe ID of the Stata session to manage graphs from.
stata_manage_sessionManage Stata sessions (create, stop, list, profile, UI channel, detect).
ParameterTypeDescription
action *stringThe management action to perform: - "create": Initializes a new Stata session. - "stop": Terminates an existing Stata session. - "list": Returns a JSON list of all active sessions. - "set_profile": Executes initialization code for a session. - "history_diff": Returns tracked session state changes. - "history_stats": Returns retained history window metadata. - "get_ui_channel": Retrieves connection details for the UI proxy. - "detect": Returns metadata about the Stata installation and environment.
as_jsonboolean
codestringStata code to execute when using the "set_profile" action.
include_packagesbooleanIf True (for "detect"), lists all user-installed packages.
session_idstringUnique identifier for the Stata session (defaults to "default").
since_commandintegerOptional command index for "history_diff". If omitted, compares to the last diff checkpoint for this session.
stata_project_reproducibility_reportSummarize project reproducibility signals, environment state, and recent task history.
ParameterTypeDescription
as_jsonboolean
project_rootstring
session_idstring
stata_publication_checkReview active estimation results and graphs for publication readiness.
ParameterTypeDescription
as_jsonboolean
graph_namesarray
session_idstring
stata_read_logRead or search Stata log files.
ParameterTypeDescription
afterintegerNumber of lines after a match to include as context.
as_jsonboolean
beforeintegerNumber of lines before a match to include as context.
case_sensitivebooleanIf True, performs a case-sensitive search.
max_bytesintegerMaximum number of bytes to read from the log (defaults to 256kb).
max_matchesintegerLimit on the number of search results returned.
offsetintegerStarting byte position for the read operation.
pathstringOptional absolute path to the log file on disk.
querystringSearch string or regular expression to find within the log file.
regexbooleanIf True, treats the `query` as a regular expression.
tail_linesintegerIf > 0, returns the last N lines of the log, overriding offset.
task_idstringOptional ID of a background task to read the log for (alternative to path).
stata_research_auditRun a compact structured dataset audit for empirical research workflows.
ParameterTypeDescription
as_jsonboolean
candidate_id_varsarray
include_publication_checksboolean
key_variablesarray
session_idstring
stata_runExecutes Stata code or a .do file.
ParameterTypeDescription
allow_unsafe_pathsboolean
as_jsonbooleanIf True, returns a structured JSON response envelope.
backgroundbooleanIf True, runs the operation in the background. Requires immediate follow-up with stata_task_status(wait=True).
code *stringThe Stata command string or the absolute path to a .do file.
cwdstringOptional working directory for the Stata process during execution.
echobooleanIf True, includes the original command in the captured output.
exclude_patternstringOptional regex to omit matching lines from the output.
filter_patternstringOptional regex to include only matching lines in the output.
is_filebooleanIf True, the `code` parameter is treated as a path to a script file.
max_output_linesintegerOptional limit for the number of lines returned in synchronous mode.
rawbooleanIf True, returns only the raw text output or error message.
read_onlyboolean
session_idstringThe ID of the Stata session to use (defaults to "default").
strip_smclbooleanIf True, removes Stata SMCL tags from the output for readability.
tracebooleanIf True, enables Stata trace mode for debugging.
stata_run_testRun a single test_*.do file.
ParameterTypeDescription
path *stringPath to the test file.
session_idstringOptional ID of an existing session to run the test in. If omitted, a fresh session is used.
stata_run_testsDiscover and run all test_*.do files under path.
ParameterTypeDescription
junit_xml_pathstringOptional path to save results in JUnit XML format.
max_workersintegerMaximum number of parallel workers (default 4).
parallelbooleanIf True, run tests in parallel using multiple sessions.
path *stringDirectory path to search for tests.
session_idstringOptional ID of an existing session to run tests in. If omitted, fresh sessions are used for each test.
stata_task_statusReturn task status for background executions.
ParameterTypeDescription
as_jsonboolean
poll_intervalnumberDelay between checks (in seconds) when waiting for completion.
tail_linesintegerLines of log to include in the response. Set based on how much output you expect: 0 if you plan to call stata_read_log separately, 20-50 for quick spot-checks, 100+ for verbose scripts where you want the full tail inline.
task_id *stringThe unique identifier of the background task to query.
timeoutnumberMaximum seconds to wait. Set based on expected runtime: short commands ~30s, typical do-files ~120s, large dataset jobs ~600s. If uncertain, use a moderate value and loop on status='timeout' rather than setting an artificially high ceiling.
waitbooleanIf True, the call will block until the task finishes or the timeout is reached.

Security checks

Static checks derived from the repository 10 days ago. Heuristics on the source, not an audit.

  • ✓README presentThe repository's README runs to about 2.7K words.
  • ✓License declaredThe repository declares the AGPL-3.0 license.
  • ✓Tests presentA test suite exists in the repository.
  • ✓Dependencies pinnedDependency versions are pinned by uv.lock.
  • !No dynamic code executionScanned 28 source files and found 4 calls to eval or shell execution, in src/mcp_stata/stata_client.py:4602, src/mcp_stata/stata_client.py:686 and src/mcp_stata/stata_client.py:1029 among others. Review how tool inputs reach them before granting credentials.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

What the source scan found

Transport
stdiosrc/mcp_stata/server.py:2697
Starts other programs
5 callssrc/mcp_stata/discovery.py:709, src/mcp_stata/stata_client.py:686, src/mcp_stata/stata_client.py:1029
Outbound network calls
4 callsworker/dashboard/server.py:99, worker/dashboard/server.py:127, worker/src/index.js:58
Writes or deletes files
15 callssrc/mcp_stata/discovery.py:580, src/mcp_stata/stata_client.py:383, src/mcp_stata/stata_client.py:3071
Lockfile
uv.lock

Pattern matches on the source text of 28 files: places to read, not proof of what the code does at run time.

Releases

v3.3.0v3.3.0 · 10 May 2026v3.3.0 (2026-05-10) _This release is published under the AGPL-3.0-or-later License._ Bug Fixes mcp: Omit duplicate structured tool JSON by default (#55, `e8e1a53`) Chores Sync toolkit_catalog_data and lockfile to 3.2.8 (`7b8fedd`) Features…
v3.2.9v3.2.9 · 10 May 2026v3.2.9 (2026-05-10) _This release is published under the AGPL-3.0-or-later License._ Bug Fixes Compact FastMCP unstructured tool JSON (#54, `33cff51`) Detailed Changes: v3.2.8...v3.2.9
v3.2.8v3.2.8 · 10 May 2026v3.2.8 (2026-05-10) _This release is published under the AGPL-3.0-or-later License._ Bug Fixes installer: Complete Windows bootstrap symlink fixes for PR #52 (`70a77a6`) Chores Add automated benchmark test script with duration tracking and…
v3.2.7v3.2.7 · 10 May 2026v3.2.7 (2026-05-10) _This release is published under the AGPL-3.0-or-later License._ Bug Fixes Update module docstring and maintain lazy import for StataClient (`2ea1027`) Detailed Changes: v3.2.6...v3.2.7
v3.2.6v3.2.6 · 10 May 2026v3.2.6 (2026-05-10) _This release is published under the AGPL-3.0-or-later License._ Bug Fixes Robust Stata installation fingerprinting for reliable discovery caching (`532207c`) Stabilize test environments, prevent accidental symlink…

README

The repository's README runs to about 2.7K words, fetched a month ago. The original in the repository is authoritative.

Read full README
Questions

About Stata

How do I install Stata?

In Claude Code, run claude mcp add stata -- uvx --refresh --refresh-package mcp-stata --from mcp-stata@latest mcp-stata. Other MCP clients take the command after "--" in their server configuration.

Is Stata safe to use with an AI agent?

Its trust score is 67 out of 100 (good). It passes 4 of the 6 static checks Conduid ran on the repository; it does not pass No dynamic code execution and Scoped permissions. Conduid's scan of 28 source files found that it serves MCP over stdio, starts other programs (5 calls), makes outbound network calls (4 calls) and writes or deletes files (15 calls). Its dependencies are pinned by uv.lock. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Stata still maintained?

The last commit was 6 months ago and 13 open issues. That's long enough that you should check whether the maintainer is responding to issues before depending on it.

What tools does Stata provide?

Conduid read 20 tools from the source: stata_compare_specs, stata_control, stata_discover_tests, stata_doctor, stata_estimation_plan, stata_get_help, stata_get_results, stata_get_test_results and 12 more. 20 of them publish their parameters, listed under Tools above.

What license is Stata released under?

The repository declares the AGPL-3.0 license. That applies to the latest release, v3.3.0, as well.