Stata

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?

Stata 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

Execute Stata commands from LLM chat
Econometric analysis and statistical computing
tmonk

Maintainer

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

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mcp-stata

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-Stata is a lightweight MCP server that embeds a live Stata session inside your AI chat interface, enabling economists and researchers to execute Stata commands and do-files, inspect datasets, retrieve stored estimation results (r(), e(), s()), manage graphs, and run complete econometric workflows — all through natural language conversation. Built by Thomas Monk at LSE, it supports Stata 17+ (MP, SE, and BE editions) on macOS, Linux, and Windows, with pre-built skills for causal inference, data auditing, publication-quality tables, power analysis, and replication. Researchers who want LLM assistance with econometric analysis without leaving their Stata workflow use this server to bridge the two environments.

Prerequisites

  • Stata 17 or later (MP, SE, or BE edition) licensed and installed on your system
  • Python 3.11 or later
  • uv package manager (strongly recommended for installation)
  • An MCP-compatible client such as Claude Desktop, Claude Code, Cursor, Windsurf, or VS Code
  • Optional: STATA_PATH environment variable if Stata is not on your system PATH
1

Install MCP-Stata using the one-line installer

Use the platform-specific installer script for the fastest setup. This installs the server and all Python dependencies automatically.

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

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

Or install via uvx

Alternatively, use uvx to run the latest published version directly without a separate install step.

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

Configure Claude Desktop

Add MCP-Stata to your Claude Desktop configuration file. On macOS, edit ~/Library/Application Support/Claude/claude_desktop_config.json.

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

Set optional environment variables

If Stata is not on your PATH, set STATA_PATH to the executable location. Other optional variables control temp directory, startup do-files, and logging.

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

Verify connection and start working

Once configured, ask your AI assistant to load the built-in auto dataset and run a simple regression to verify the Stata session is active and the tools are accessible.

Stata Examples

Client configuration

Claude Desktop config for MCP-Stata using uvx with optional STATA_PATH override.

{
  "mcpServers": {
    "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

Example Stata analysis requests once the server is connected.

- "Load the auto dataset and run a regression of price on mpg and weight, then show me the results"
- "Import the CSV at ~/data/wages.csv and give me a codebook summary of all variables"
- "Run a difference-in-differences regression and export the results table as publication-ready LaTeX"
- "Retrieve the stored e() results from my last regression and format them as a coefficient table"
- "Generate a scatter plot of mpg vs price with a fitted line and export it as PNG"
- "Check my do-file analysis.do for deprecated syntax and modernize it"

Troubleshooting Stata

Stata executable not found or 'STATA_PATH is not configured' error

Set the STATA_PATH environment variable in your MCP client config to the absolute path of your Stata executable, e.g. '/usr/local/stata17/stata-mp' on Linux or 'C:\Program Files\Stata17\StataSE-64.exe' on Windows.

Graphs are not returned or export fails

Use the stata_manage_graphs() tool explicitly to list and export graphs after running graph commands. Specify the format as SVG or PNG. On Windows, temporary file permission issues can be resolved by setting MCP_STATA_TEMP to a user-writable directory.

Python version mismatch or uvx fails to resolve mcp-stata

MCP-Stata requires Python 3.11+. Run 'python --version' to check your version. If using uvx, ensure uv itself is up to date: 'pip install --upgrade uv'. You can also add '--python 3.11' to the uvx args to pin the Python version explicitly.

Frequently Asked Questions about Stata

What is Stata?

Stata 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?

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

Which AI clients work with Stata?

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

Is Stata free to use?

Yes, Stata 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": { "mcp-stata": { "command": "npx", "args": ["-y", "mcp-stata"] } } }

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

Read the full setup guide →

Ready to use Stata?

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