MCPMake

MCPMake

Enables management and execution of Python scripts with automatic LLM-extracted argument schemas and validation. Provides script registry, execution history, and intelligent argument parsing like make but for Python scripts.

Category
访问服务器

README

MCPMake

An MCP (Model Context Protocol) server for managing and running Python scripts with LLM-extracted schemas - like make, but smarter.

Features

  • Automatic Schema Extraction: Uses LLMs (Claude Sonnet 4 or GPT-4.1) to analyze Python scripts and extract argument schemas
  • Script Registry: Store and manage multiple scripts with metadata
  • Input Validation: Validates arguments against JSON Schema before execution
  • Execution History: Tracks all script runs with full output logs
  • Environment Variables: Pass custom env vars per execution
  • Flexible Execution: Custom Python interpreters, timeouts, and output truncation
  • Update & Re-analyze: Refresh script schemas when code changes

Installation

# Clone or navigate to the project directory
cd mcpmake

# Install in development mode
pip install -e .

Configuration

Set up API keys

You'll need an API key for either Anthropic or OpenAI (or both):

export ANTHROPIC_API_KEY="your-key-here"
# or
export OPENAI_API_KEY="your-key-here"

Add to MCP settings

Add the server to your MCP client configuration (e.g., Claude Desktop):

{
  "mcpServers": {
    "mcpmake": {
      "command": "python",
      "args": ["-m", "mcpmake.server"],
      "env": {
        "ANTHROPIC_API_KEY": "your-key-here"
      }
    }
  }
}

Usage

1. Register a Script

# Register a Python script with automatic schema extraction
register_script(
    name="data_processor",
    path="/path/to/script.py",
    description="Processes data files",  # optional, auto-generated if omitted
    python_path="/usr/bin/python3",      # optional
    timeout_seconds=240,                  # optional, default 240
    min_lines=1,                          # optional, default 1
    llm_provider="anthropic"              # optional, "anthropic" or "openai"
)

2. List Scripts

list_scripts()
# Shows all registered scripts with descriptions

3. Get Script Info

get_script_info(name="data_processor")
# Shows detailed schema, path, recent runs, etc.

4. Run a Script

run_script(
    name="data_processor",
    args={
        "input_file": "data.csv",
        "output_dir": "/tmp/output",
        "verbose": true
    },
    env_vars={                    # optional
        "API_KEY": "secret123"
    },
    python_path="/usr/bin/python3",  # optional, overrides default
    timeout=300,                      # optional, overrides default
    output_lines=100                  # optional, default 100
)

5. View Run History

get_run_history(
    name="data_processor",  # optional, shows all scripts if omitted
    limit=10                # optional, default 10
)

6. Update Script Schema

# Re-analyze script after code changes
update_script(
    name="data_processor",
    llm_provider="anthropic"  # optional
)

7. Delete Script

delete_script(name="data_processor")

Data Storage

MCPMake stores data in ~/.mcpmake/:

~/.mcpmake/
├── scripts.json          # Script registry and metadata
├── history.jsonl         # Execution history log
└── outputs/              # Full script outputs
    ├── script1_timestamp.log
    └── script2_timestamp.log

How It Works

  1. Registration: When you register a script, MCPMake:

    • Reads the script file
    • Sends it to an LLM (Claude Sonnet 4 or GPT-4.1)
    • Extracts a JSON Schema describing the script's arguments
    • Extracts a description from docstrings/comments
    • Stores everything in scripts.json
  2. Execution: When you run a script:

    • Validates your arguments against the stored JSON Schema
    • Checks if the script file still exists
    • Builds command-line arguments from your input
    • Runs the script with specified Python interpreter and env vars
    • Captures stdout/stderr with timeout protection
    • Saves full output to a log file
    • Returns truncated output (first N lines)
    • Logs execution details to history
  3. History: All runs are logged with:

    • Timestamp, arguments, exit code
    • Execution time
    • Full output file path
    • Environment variables used

Example Python Scripts

MCPMake works best with scripts that use:

argparse

import argparse

parser = argparse.ArgumentParser(description="Process data files")
parser.add_argument("--input-file", required=True, help="Input CSV file")
parser.add_argument("--output-dir", required=True, help="Output directory")
parser.add_argument("--verbose", action="store_true", help="Verbose output")
args = parser.parse_args()

click

import click

@click.command()
@click.option("--input-file", required=True, help="Input CSV file")
@click.option("--output-dir", required=True, help="Output directory")
@click.option("--verbose", is_flag=True, help="Verbose output")
def main(input_file, output_dir, verbose):
    pass

Simple functions

def main(input_file: str, output_dir: str, verbose: bool = False):
    """
    Process data files.

    Args:
        input_file: Path to input CSV file
        output_dir: Output directory path
        verbose: Enable verbose logging
    """
    pass

Requirements

  • Python 3.10+
  • MCP SDK
  • Anthropic SDK (for Claude)
  • OpenAI SDK (for GPT)
  • jsonschema

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选