mcp-toolforge
mcp-toolforge
一个元 MCP 服务器,能够根据自然语言工具描述生成新的 MCP 服务器。
给定项目名称、简短描述,以及一系列自然语言工具描述(例如 "fetches the weather for a string city and returns a string summary"),mcp-toolforge 会生成一个完整、可运行的 MCP 服务器项目——schema、实现、带真实断言的测试、README、LICENSE——即可安装并运行。
flowchart TD
subgraph Client_Layer["AI Client / Claude Desktop"]
A["Client (Claude, Cursor, etc.)"]
end
subgraph Meta_Server["mcp-toolforge (this repo)"]
M["mcp_toolforge.server"]
G["mcp_toolforge.generator"]
end
subgraph Generated["Generated Server Project"]
P["src/<pkg>/__init__.py"]
S["src/<pkg>/server.py"]
T["tests/test_<pkg>.py"]
R["README.md"]
L["LICENSE"]
PP["pyproject.toml"]
end
A -- "MCP stdio JSON-RPC" --> M
M -- "generate_server tool call" --> G
G -- "writes files" --> P
G -- "writes files" --> S
G -- "writes files" --> T
G -- "writes files" --> R
G -- "writes files" --> L
G -- "writes files" --> PP架构
┌─────────────────────┐ ┌──────────────────────────┐
│ AI Client │ stdio │ mcp-toolforge server │
│ (Claude, Cursor) │──JSON──│ (this repo) │
└─────────────────────┘ RPC └────────┬───────────────┘
│ generate_server
│ (name, description,
│ tool_descriptions, dest)
▼
┌────────────────────────────────────┐
│ generator.generate_project() │
│ parses NL → ToolSpec → ServerSpec │
│ renders: pyproject, server.py, │
│ tests, README, LICENSE │
└────────────────────────────────────┘
│
┌─────────────────┴─────────────────┐
│ Example generated servers │
│ • examples/weather_server │
│ • examples/todo_server │
│ • examples/math_server │
└────────────────────────────────────┘Related MCP server: MCP Server Generator
快速入门
安装 mcp-toolforge
pip install -e ".[dev]"自行运行 mcp-toolforge(元服务器)
作为 MCP 服务器(stdio 传输):
{
"mcpServers": {
"mcp-toolforge": {
"command": "python",
"args": ["-m", "mcp_toolforge.server"],
"cwd": "/path/to/mcp-toolforge"
}
}
}或者作为生成独立服务器项目的 CLI:
# Interactive wizard
mcp-toolforge -i
# One-shot
mcp-toolforge \
--name my_server \
--description "A server that does X" \
--tool "fetches the weather for a string city and returns a string summary" \
--dest ./my_server使用 generate_server 工具
当 mcp-toolforge 注册为 MCP 服务器后,AI 代理可以调用:
generate_server(
name="my_server",
description="A server that does X",
tool_descriptions=[
"fetches the weather for a string city and returns a string summary",
"adds a string task and returns a string confirmation"
],
dest="/path/to/output" # optional, defaults to /tmp/mcp-toolforge-gen
)该工具会将完整项目写入 dest/<package_name>/,并返回一个摘要字符串。随后,生成的服务器可以独立安装并注册到你的 MCP 客户端中。
自然语言解析的工作原理
每个工具描述都应遵循以下模式:
<VERB> [a/an] <type> <name> [, <type> <name>] ... and returns <type> <description>示例:
描述 | 工具名 | 参数 |
|
|
|
|
|
|
|
|
|
|
|
|
已识别的参数类型:string、integer、number、boolean、array。如果未检测到带类型的参数,则会推断出一个自由形式的 query: string 参数。
示例
三个示例服务器会生成到 examples/ 目录中:
服务器 | 包名 | 工具 | 描述 |
WeatherServer |
|
| 获取天气信息 |
TodoServer |
|
| 管理待办事项列表 |
MathServer |
|
| 算术工具 |
每个示例都是一个完整可运行的 MCP 服务器,并自带测试:
cd examples/math_server
pip install -e .
pytest开发
# Install with dev dependencies
pip install -e ".[dev]"
# Run all tests
pytest
# Run end-to-end test against the meta-server over stdio
python e2e_test.py
# Regenerate examples
python make_examples.py测试
tests/test_generator.py— 生成器的 16 个测试(解析、schema 推断、文件渲染、项目创建)tests/test_server.py— 元 MCP 服务器的 5 个测试(工具列表、工具调用、错误处理)e2e_test.py— 端到端测试,以真实的 stdio 子进程方式运行元服务器,并通过 MCPClient连接每个示例服务器自带 4 个测试(3 个示例共 12 个)
所有测试均使用真实断言,并验证实际文件输出 / 工具结果。
许可证
MIT — 参见 LICENSE。
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for generating rough-draft project plans from natural-language prompts.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
A full backend your AI coding agent can set up over MCP
Related MCP Servers
- AlicenseBqualityDmaintenanceAn intelligent tool that automates the setup of new Model Context Protocol (MCP) server projects through a conversational interface. It generates project structures, technical specifications, and context-rich documentation to streamline AI-assisted development in TypeScript or Python.103MIT
- AlicenseAqualityCmaintenanceGenerates production-ready MCP servers with dual-mode (MCP + CLI) architecture, tests, and documentation. Includes progressive disclosure tools for AI agents and best practices guidance.735 PyPIApache 2.0
- AlicenseNot gradedqualityDmaintenanceAutomatically generates MCP server tools from OpenAPI specifications, enabling LLMs to interact with any API defined by an OpenAPI spec through natural language.13 npmMIT
- AlicenseNot gradedqualityCmaintenanceGenerates complete, runnable MCP server projects from natural-language tool descriptions, including schema, implementation, tests, README, and license. It enables AI agents to scaffold standalone MCP servers ready to install and run.MIT