Stata MCP Server logo

Stata MCP Server

Runs Stata analyses through MCP with persistent sessions for data work, modeling, diagnostics, graphics, and exports.

Install Stata MCP Server

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "stata-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@aliveranme/stata-mcp"
      ],
      "env": {
        "STATA_HOME": "YOUR_VALUE_HERE",
        "STATA_EDITION": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

npx -y @aliveranme/stata-mcp

No response to initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

Stata MCP Server MCP server connects MCP clients to a real Stata runtime through pystata. It exposes 75 tools for loading and transforming data, estimating models, running diagnostics, creating graphs, and exporting files in one persistent session. The stdio server supports StataNow 19 or Stata 18+ with Python 3.10+ on Windows or macOS. Reach for it when an agent needs to execute multi-step Stata workflows while retaining data, estimates, and session state between calls.

Use cases

  • Load and clean Stata datasets through an agent
  • Run regression and panel-data models
  • Check model assumptions and post-estimation results
  • Create graphs and export analysis files
  • Manage multi-step Stata sessions without reloading data

Key features

  • Persistent in-process Stata sessions
  • 75 structured and general-purpose tools
  • Support for common econometric models
  • Data cleaning, reshaping, and validation
  • Graph, table, Excel, and delimited-file exports
  • Background tasks and MCP file resources

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

22/25 checks healthy over the last 112d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 10d ago via OSV.dev · @aliveranme/stata-mcp (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

npm downloads305Package downloads in the last 30 days.
Last commit3mo agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Directory activity17 viewsConfig copies, upvotes, and views on AllMCPs.

How Stata MCP Server works

What Stata MCP Server MCP server does

Stata MCP Server MCP server gives an MCP client access to a locally installed Stata runtime through Python's pystata interface. It supports workflows that begin with loading a dataset and continue through cleaning, exploration, estimation, post-estimation checks, graph creation, and file export. The server includes 75 tools, combining structured wrappers for common operations with general command execution through stata_run.

The server is intended for agents that need to perform actual Stata analysis rather than only generate Stata syntax. A client can load .dta files, import several other formats, declare panel data, fit regression and limited dependent-variable models, inspect results, create predictions, and return exported files as MCP resources.

How it works

Stata is initialized in the server process through pystata, which uses ctypes to load the Stata runtime. The same session is reused across tool calls, so datasets in memory, estimation results, and local macros remain available as an analysis progresses. This supports sequences such as loading data, cleaning variables, estimating a model, running a diagnostic, and exporting a graph without reloading the dataset.

stata_run accepts arbitrary Stata commands, while stata_help provides help for built-in or installed commands. Specialized tools add structured parameters and validation around frequently used operations. Command output is read from Stata's output buffer; large results can be paged with stata_more, and output is subject to a 120,000-character limit. Long-running commands have a 60-second watchdog unless the timeout is explicitly increased.

Setup and configuration

The server requires StataNow 19 or Stata 18 or later with utilities/pystata, plus Python 3.10 or newer. Supported operating systems listed by the project are Windows and macOS. The repository setup script can detect Stata, create a virtual environment, install fastmcp, generate .mcp.json, and check that the server starts.

Set STATA_HOME when Stata is installed outside a path the setup script can detect. Set STATA_EDITION to mp, se, or be. The project also publishes an npm launcher, @aliveranme/stata-mcp, which can be run with npx; this path requires Node.js 18 or newer and uv, or an environment with Python and the required FastMCP package.

Tools and capabilities

Stata MCP Server MCP server groups its tools across these areas:

  • Data loading and management, including .dta, Excel, CSV, SAS, SPSS, dBase, and Parquet imports.
  • Reshaping, merging, appending, collapsing, frames, variable changes, recoding, and validation.
  • Descriptive analysis such as summaries, tabulations, correlations, codebooks, and data listing.
  • Estimation including OLS, logistic, probit, Poisson, panel, IV, multinomial, negative-binomial, quantile, and mixed models.
  • Post-estimation operations including margins, tests, predictions, model storage, Hausman comparisons, and returned results.
  • Graph, Excel, delimited-text, and regression-table exports, with exported files registered as readable resources.
  • Package management, help lookup, snapshots, session status, log reading, paging, and background task control.

Limitations and notes

A working Stata installation and a license capable of running the requested commands are required; the server does not provide Stata itself. The documented operating-system support is limited to Windows and macOS. Some operations have prerequisites: for example, panel estimation requires xtset, and post-estimation tools require a preceding estimation command. stata_etable requires Stata 17 or newer.

The server can run arbitrary commands, but stata_run includes interception for dangerous command prefixes. Long tasks have a maximum background block duration of 3,600 seconds, and normal output can be truncated by the stated character limit. Export success is checked by confirming that the output file was written, while binary files are retrieved through MCP resource operations.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Stata MCP Server

Stata MCP Server is an MCP server that connects an MCP client to a locally installed Stata runtime through pystata. Its main tools load and transform data, execute arbitrary Stata commands, fit statistical models, run diagnostics, create graphs, manage packages, and export files while preserving a persistent Stata session across calls.

Run the repository's setup script after cloning it, or use the published npm launcher with npx. The setup script detects Stata, creates a virtual environment, installs FastMCP, generates MCP configuration, and verifies startup. Set STATA_HOME first if Stata is installed outside a detected location.

It requires StataNow 19 or Stata 18 or newer with utilities/pystata, Python 3.10 or newer, and Windows or macOS. The npm installation route also requires Node.js 18 or newer and uv, unless Python and the required FastMCP package are already available.

Yes, it works with Claude Code through an .mcp.json configuration or the claude mcp add command. After configuration, restarting Claude Code or reloading plugins connects the client to the stdio server.

Yes, it can export graphs, Excel workbooks, delimited files, and regression tables. Exported outputs can be registered as MCP resources and retrieved with resource-read operations; graph and table tools check whether the target file was actually written.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewStata MCP Server AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/stata-mcp-server?style=directory)](https://allmcps.com/mcp/stata-mcp-server)
HTML Embed
<a href="https://allmcps.com/mcp/stata-mcp-server"><img src="https://allmcps.com/api/badge/stata-mcp-server?style=directory" alt="Stata MCP Server on AllMCPs" /></a>