Skip to main content
Glama

mcp-toolforge

自然言語のツール記述から新しいMCPサーバーを生成するメタMCPサーバーです。

プロジェクト名、短い説明、自然言語のツール記述のリスト(例: "fetches the weather for a string city and returns a string summary")を指定すると、mcp-toolforge は完全で実行可能なMCPサーバープロジェクト(スキーマ、実装、実アサーション付きテスト、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>

例:

説明

ツール名

パラメーター

fetches the weather for a string city and returns a string summary

fetch

city: string

adds a string task and returns a string confirmation

add

task: string

multiplies two numbers given a number a and number b and returns a number product

multiply

a: number, b: number

lists all todos and returns an array of todo items

list

query: string(フォールバック)

認識されるパラメーター型: string、integer、number、boolean、array。型指定のパラメーターが検出されない場合は、自由形式の query: string パラメーターが推測されます。

例

examples/ には3つのサンプルサーバーが生成されます:

サーバー

パッケージ

ツール

説明

WeatherServer

weather_server

fetch, forecast

天気情報を取得します

TodoServer

todo_server

add, list, remove

TODOリストを管理します

MathServer

math_server

add, multiply, compute

算術ツール

各サンプルは、独自のテスト付きの完全に動作する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テスト(パース、スキーマ推論、ファイルレンダリング、プロジェクト作成)

  • tests/test_server.py — メタMCPサーバーの5テスト(ツール一覧、ツール呼び出し、エラー処理)

  • e2e_test.py — メタサーバーを実際のstdioサブプロセスとして実行し、MCPの Client に接続するエンドツーエンドテスト

  • 各サンプルサーバーには4つのテストが同梱されています(3つのサンプルで合計12テスト)

すべてのテストは実際のアサーションを使用し、実際のファイル出力/ツール結果を検証します。

ライセンス

MIT — LICENSE を参照してください。

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    An 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.
    10
    3
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Generates production-ready MCP servers with dual-mode (MCP + CLI) architecture, tests, and documentation. Includes progressive disclosure tools for AI agents and best practices guidance.
    7
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Automatically generates MCP server tools from OpenAPI specifications, enabling LLMs to interact with any API defined by an OpenAPI spec through natural language.
    13 npm
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Generates 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