Registry / analytics / mcp-stata

mcp-stata

JSON →
library3.3.0pypypi✓ verified 84d ago

A lightweight Model Context Protocol (MCP) server for Stata, enabling LLM integration with Stata workflows. Execute commands, inspect data, retrieve stored results (r()/e()), and view graphs. Version 3.3.0 requires Python >=3.11.

pip install mcp-stata
INSTALL
IMPORT
SIG · MCP-STATA
M
mcp-stata
analyticspythonv3.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mcp_stata
from mcp_stata import server
import mcp_stata as mcpstata
Direct module import without submodule may fail; use explicit submodule.

Start the MCP server, specifying the Stata executable path via environment variable or argument.

from mcp_stata import server import os stata_path = os.environ.get('STATA_PATH', '/usr/local/stata/stata-se') server.run(stata_path=stata_path)
Debug
Known issues
breakingVersion 3.x changed the import structure: previously `from mcp_stata import run` is now `from mcp_stata import server` and `server.run(...)`.
fix
Update imports: `from mcp_stata import server` and call `server.run(...)`.
affects: >=3.0.0
gotchaStata must be installed and accessible at the path provided. If not found, the server will fail silently or return empty results.
fix
Set the `STATA_PATH` environment variable or pass the correct path to `run()`.
affects: all
deprecatedThe `stata_path` argument in `run()` is deprecated in favor of environment variable `STATA_PATH`.
fix
Use `os.environ['STATA_PATH']` instead of passing the argument.
affects: >=3.2.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'mcp_stata'
Library not installed or installed in wrong Python environment.
fix
Run `pip install mcp-stata` ensuring correct environment (e.g., virtualenv).
Stata executable not found at ...
The path to Stata binary is incorrect or not set.
fix
Set STATA_PATH environment variable to the full path of your Stata executable.
ERROR: Failed to start server: Stata did not respond
Stata license expired or Stata is not properly installed.
fix
Verify Stata installation and license, or run Stata manually to check.
Upgrade
Version history
3.3.0latest on PyPI · released May 10, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
40 hits · last 30 days
node
36
OpenAI (training)
1
Resources
mcp-stata — pip install mcp-stata · libregistry