Stata MCP

v1.0.0Data Science & MLstable

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 workflo

aieconometricseconomicsllmmcp
Share:
65
Stars
0
Downloads
0
Weekly
0/5

What is Stata MCP?

Stata MCP is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to 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 i...

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 workflo

This server falls under the Data Science & ML category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • A lightweight Model Context Protocol (MCP) server for Stata.

Use Cases

Stata integration for economic analysis
Statistical computing and econometric workflows
tmonk

Maintainer

LicenseAGPL 3.0
Languagepython
Versionv1.0.0
UpdatedMay 19, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx stata-mcp-server

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Stata MCP

mcp-stata is a lightweight MCP server that bridges AI assistants directly to a locally installed Stata instance, enabling economists and researchers to execute Stata commands, run .do files, inspect datasets, retrieve stored r(), e(), and s() results, and view exported graphs — all from their chat interface. Built for real econometric workflows, it supports async background jobs for long-running regressions, a local HTTP API for data browsing, and domain-specific skill workflows for publication QA, replication checks, and legacy code modernization.

Prerequisites

  • Stata 17 or later (MP, SE, or BE edition) installed and licensed locally
  • Python 3.11+ and the uv package manager installed
  • An MCP-compatible client: Claude Desktop, Cursor, Windsurf, or VS Code
  • macOS, Linux, or Windows (installer scripts available for all platforms)
1

Install mcp-stata using the platform installer

The quickest way is the official installer script which handles Python environment setup and PATH configuration. Append --agent claude (or cursor, windsurf) to auto-configure your IDE.

# macOS/Linux
curl -LsSf https://mcp-stata-install.tdmonk.com/install.sh | bash -- --agent claude

# Windows (PowerShell)
irm https://mcp-stata-install.tdmonk.com/install.ps1 | iex
2

Alternatively, install via uvx

If you already have uv installed, you can run mcp-stata directly without a separate install step. This always pulls the latest version.

uvx --refresh --refresh-package mcp-stata --from mcp-stata@latest mcp-stata
3

Configure environment variables if needed

If mcp-stata cannot auto-discover your Stata executable, set STATA_PATH. Other optional variables control temp directories, startup do-files, and log verbosity.

# Add to your shell profile or MCP server env block
export STATA_PATH=/usr/local/stata17/stata-mp
export MCP_STATA_LOGLEVEL=INFO
4

Add to your MCP client configuration

Register mcp-stata in your client's config file. Claude Desktop reads claude_desktop_config.json; the server is launched via uvx on demand.

{
  "mcpServers": {
    "mcp-stata": {
      "command": "uvx",
      "args": ["--refresh", "--refresh-package", "mcp-stata",
               "--from", "mcp-stata@latest", "mcp-stata"]
    }
  }
}
5

Verify the connection

Restart Claude Desktop and ask it to run a simple Stata command. The server will launch a Stata session on first use.

Stata MCP Examples

Client configuration

Complete claude_desktop_config.json entry for mcp-stata with an optional STATA_PATH override.

{
  "mcpServers": {
    "mcp-stata": {
      "command": "uvx",
      "args": ["--refresh", "--refresh-package", "mcp-stata",
               "--from", "mcp-stata@latest", "mcp-stata"],
      "env": {
        "STATA_PATH": "/usr/local/stata17/stata-mp"
      }
    }
  }
}

Prompts to try

Once connected, these prompts exercise mcp-stata's core capabilities.

- "Load the auto dataset and run a regression of price on mpg and weight."
- "Show me the r() and e() results from the last regression."
- "Audit my dataset for missing values and variable coding issues."
- "Export the last graph as an SVG file."
- "Run this long estimation in the background and tell me when it's done."

Troubleshooting Stata MCP

mcp-stata cannot find the Stata executable

Set the STATA_PATH environment variable to the full path of your Stata binary (e.g., /usr/local/stata17/stata-mp on Linux, or C:\Program Files\Stata17\StataMP-64.exe on Windows) in your MCP server env block.

Permission errors writing temporary files

Set MCP_STATA_TEMP to a directory where your user has write access, such as /tmp/mcp-stata or a path within your home directory.

Session state lost after running 'clear all'

By default, mcp-stata auto-reloads startup do-files after a clear all command. To disable this behavior, set MCP_STATA_NO_RELOAD_ON_CLEAR=1 in your environment.

Frequently Asked Questions about Stata MCP

What is Stata MCP?

Stata MCP is a Model Context Protocol (MCP) server that 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 workflo It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Stata MCP?

Follow the installation instructions on the Stata MCP GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Stata MCP?

Stata MCP works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Stata MCP free to use?

Yes, Stata MCP is open source and available under the AGPL 3.0 license. You can use it freely in both personal and commercial projects.

Browse More Data Science & ML MCP Servers

Explore all data science & ml servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "stata-mcp-server": { "command": "npx", "args": ["-y", "stata-mcp-server"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Stata MCP?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides