stata
MCP server for stata do file
claude mcp add --transport stdio mkprevo-stata-mcp-server node dist/index.js \ --env STATA_PATH="Path to Stata executable (e.g., /Applications/Stata/StataBE.app/Contents/MacOS/StataBE)" \ --env STATA_WORKSPACE="Stata working directory (e.g., /Users/username/Documents/Stata)"
How to use
This MCP server provides a Stata-focused integration that lets Claude Desktop manage and run Stata .do files. Core capabilities include file management (listing, reading, and writing .do files with optional automatic backups), editing and augmenting Do files (adding variables, analyses, or custom sections), and automation features such as generating Do file templates with AI and executing Do files or selected line ranges directly in Stata on macOS. You can also run only specific lines from a Do file, with automatic temporary Do file creation and cleanup after results are returned. To use it, connect Claude Desktop to the Stata MCP server and issue natural language prompts like reading a file, listing files, inserting an analysis block, or running a subset of lines. The server translates these prompts into Do file operations or Stata executions via the underlying Stata executable and logs outputs for review.
How to install
Prerequisites:
- macOS machine with Stata installed (StataBE path required)
- Node.js and npm installed
- Claude Desktop installed and configured to communicate with MCP servers
Installation steps:
- Clone the repository or set up your project directory
git clone https://github.com/your-org/stata-mcp-server.git
cd stata-mcp-server
- Install dependencies
npm install
- Build the TypeScript sources (if applicable)
npm run build
- Start the MCP server locally to test
npm run start
- Verify with a test call from Claude Desktop or directly via the provided test command
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | node dist/index.js
Environment setup:
- Ensure STATA_PATH points to the Stata executable
- Ensure STATA_WORKSPACE points to a writable directory for Do file work and backups
Optional production considerations:
- Configure backup locations and retention in your environment
- Set appropriate file permissions for Do files and working directories
Additional notes
Tips and common considerations:
- Make sure Claude Desktop is restarted after enabling or reconfiguring the MCP server for changes to take effect.
- The server creates automatic backups when Do files are modified; ensure you have write access to the workspace and backup directory.
- If Stata fails to run, verify the Stata path (STATA_PATH) and that the Stata license is valid on the machine.
- Use the select-and-run feature to execute only portions of a Do file; this helps test analyses incrementally and ensures reproducibility.
- Check logs for troubleshooting: server logs and Stata execution logs can be found in the configured working directory or as specified by your runtime setup.
Related MCP Servers
zen
Selfhosted notes app. Single golang binary, notes stored as markdown within SQLite, full-text search, very low resource usage
MCP -Deepseek_R1
A Model Context Protocol (MCP) server implementation connecting Claude Desktop with DeepSeek's language models (R1/V3)
mcp-fhir
A Model Context Protocol implementation for FHIR
mcp
Inkdrop Model Context Protocol Server
mcp-appium-gestures
This is a Model Context Protocol (MCP) server providing resources and tools for Appium mobile gestures using Actions API..
dubco -npm
The (Unofficial) dubco-mcp-server enables AI assistants to manage Dub.co short links via the Model Context Protocol. It provides three MCP tools: create_link for generating new short URLs, update_link for modifying existing links, and delete_link for removing short links.