Stata Executor MCP

Stata Executor MCP

Enables an agent to execute Stata do scripts or inline commands locally and retrieve structured results including status, error diagnostics, and output text for consumption by the model.

Category
Visit Server

README

Stata 执行器 (Stata Executor)

stata_executor 是一个面向 Agent 的本地 Stata 执行 MCP server,让 Agent 具备运行 do 脚本/内联命令并读取稳定执行结果的能力。

它返回两类信息:一类是稳定的执行事实,另一类是可直接给模型消费的干净实证结果正文。它不负责解释经济学或实证结果。

安装

uv sync

配置

stata_executor 通过 MCP 启动 JSON 的 env 字段注入环境变量:

  • STATA_EXECUTOR_STATA_EXECUTABLE: Stata 可执行文件路径(必填)
  • STATA_EXECUTOR_EDITION: 版本(可选,mp / se / be,默认 mp

示例:

{
  "mcpServers": {
    "stata-executor": {
      "command": "D:/Developments/PythonProject/Stata-Executor-MCP/.venv/Scripts/python.exe",
      "args": ["-m", "stata_executor"],
      "cwd": "D:/Developments/PythonProject/Stata-Executor-MCP",
      "env": {
        "STATA_EXECUTOR_STATA_EXECUTABLE": "D:/Program Files/Stata17/StataMP-64.exe",
        "STATA_EXECUTOR_EDITION": "mp"
      }
    }
  }
}

启动命令:python -m stata_executor

暴露的工具 (Tools)

  • doctor: 检查环境与配置
  • run_do: 执行现有的 .do 文件
  • run_inline: 执行单条或多条 inline 命令

结果结构 (Result Shape)

run_do / run_inline 返回的结构化内容 (structuredContent) 包含以下字段:

  • status: 执行状态 (succeeded, failed)
  • error_kind: 失败时的错误分类(bootstrap_error / input_error / timeout / stata_parse_or_command_error / stata_runtime_error / artifact_collection_error),成功时为 null
  • result_text: 过滤命令回显后的完整结果正文,面向模型直接消费
  • diagnostic_excerpt: 失败时围绕末次命令与错误行的诊断片段
  • artifacts: 本次执行新增或变更的产物绝对路径列表

doctor 返回:

  • ready: 配置与可执行文件是否就绪
  • errors: 未就绪时的错误清单(就绪时为空列表)

执行失败时响应的 isError=true 且仍然返回完整 structuredContent,便于 Agent 基于诊断字段进行恢复。

测试

python -m unittest discover -s tests -v

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured