Skip to content

Use in Claude Code

We are very excited to write this document about Claude Code with Stata-MCP. At my daily research, Claude Code is one of the tools I use most often.

If you have not installed it, you can visit Claude Code to install it.

Requirements:
- Stata 17+
- uv or python 3.11+
- Claude Code

Quickly Start

First, check whether Stata-MCP is compatible with your device by verifying each requirement.

uvx stata-mcp --usable

Then, create your project. We suggest creating all the projects in the same directory. For example, we use ~/Documents/StataProjects as the project directory.

cd ~/Documents/StataProjects
claude mcp add stata-mcp --env STATA_MCP_CWD=$(pwd) --scope project -- uvx --directory $(pwd) stata-mcp

Advice: Please make sure the directory without any special characters like whitespace, emoji or Chinese characters.

Now the project has been created successfully. The project structure is as follows:

my_first_project/            # Project directory
├── stata-mcp-folder/        # All the files generated by Stata-MCP
│   ├── stata-mcp-dofile/    # do-files
│   ├── stata-mcp-log/       # log files
│   ├── stata-mcp-result/    # Some command (like `outreg2`) results saved here
│   └── stata-mcp-tmp/       # Temporary files, like data info description
│   └── .gitignore           # git ignore file
└── CLAUDE.md                # The global instructions to limit the project