Stata MCP
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
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
Maintainer
Works with
Installation
Manual Installation
npx stata-mcp-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
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)
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 | iexAlternatively, 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-stataConfigure 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=INFOAdd 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"]
}
}
}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.
Stata MCP Alternatives — Similar Data Science & ML Servers
Looking for alternatives to Stata MCP? Here are other popular data science & ml servers you can use with Claude, Cursor, and VS Code.
Ultrarag
★ 5.6kA Low-Code MCP Framework for Building Complex and Innovative RAG Pipelines
RocketRide
★ 3.1k📇 🏠 - MCP server that exposes RocketRide AI pipelines as t
Aix Db
★ 2.1kAix-DB 基于 LangChain/LangGraph 框架,结合 MCP Skills 多智能体协作架构,实现自然语言到数据洞察的端到端转换。
NeMo Data Designer
★ 1.9k🎨 NeMo Data Designer: Generate high-quality synthetic data from scratch or from seed data.
PaperBanana
★ 1.7kOpen source implementation and extension of Google Research’s PaperBanana for automated academic figures, diagrams, and research visuals, expanded to new domains like slide generation.
MiniMax
★ 1.5kBridges MiniMax AI capabilities to the Model Context Protocol, enabling AI agents to perform image understanding, text-to-image generation, and speech synthesis. It provides a standardized interface for accessing MiniMax's core tools via JSON-RPC.
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.
Set Up Stata MCP in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
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.