mcpforge

io.github.saagpatel由 GitHub 帳號 saagpatel 發布v0.3.4更新於 Oct 24, 2026

Generate complete, tested FastMCP 3.x MCP servers from one plain-English sentence.

已驗證STDIO僅桌面開發者工具AI 與機器學習

概覽

AI 產生的概覽

用一句自然語言描述就能產生完整且經過測試的 FastMCP 3.x MCP 伺服器,並可驗證、檢查與更新它們。

可以做什麼
mcpforge 把一句英文描述變成完整的 FastMCP 3.x 伺服器專案:工具、Pydantic 輸入驗證、錯誤處理、pytest 測試套件、執行設定與用戶端接入文件。它先規劃工具,再產生程式碼,接著執行語法、安全、lint、匯入與 pytest 檢查。其他工具可驗證、檢查、列出與診斷已產生的伺服器,update 能用自然語言修改現有伺服器。示範模式使用內建錄製執行整條流程,不需要 API 金鑰。
適用情境
適合想快速建立新 MCP 伺服器、不想手寫 MCP 協定樣板程式碼的情況,也適合讓助理在對話中建置、驗證並迭代 MCP 伺服器。面向已有模型供應商金鑰與本機 Python 工作區的開發者。
執行需求
以 stdio 本機程序執行,透過 uvx 從 PyPI 套件 fastmcp-builder 啟動。需要 Python 3.12+ 與 uv。generate、update 和 plan 會呼叫模型供應商,因此需要 API 金鑰:預設為 ANTHROPIC_API_KEY,其他供應商使用 OPENROUTER_API_KEY 或 OPENAI_API_KEY。MCPFORGE_WORKSPACE 設定工作區路徑。模型呼叫與相依套件安裝需要網路存取。
安裝前請注意
generate 和 update 會寫入工作區檔案,並用你自己的金鑰產生模型供應商費用,每次呼叫約 0.05 至 0.30 美元,這只是估算,會隨複雜度與模型而變。validate 會執行產生的測試套件。產生的伺服器由模型產出,執行前應人工審查;登錄中介資料並不證明其安全。金鑰透過 ANTHROPIC_API_KEY 等環境變數傳入。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 mcpforge,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

mcpforge

[PyPI] [Python] [CI] [License: MIT]

One English sentence in. A tested, spec-free FastMCP 3.x server out.

mcpforge turns a plain-English description into a complete FastMCP 3.x MCP server — tools, Pydantic input validation, error handling, a pytest suite, run config, and client setup docs — all wired together and ready to inspect, validate, and install. There's no MCP schema or protocol boilerplate to hand-write: the sentence is the spec. You write it; Claude writes the implementation; mcpforge runs the generated test suite and validators before you ever run it.

⚡ 60-second start

[mcpforge demo: one command to a tested, validated MCP server]

You need Python 3.12+, uv, and an Anthropic API key.

bash
uv tool install fastmcp-builder      # or: pip install fastmcp-builderexport ANTHROPIC_API_KEY="your_anthropic_api_key"
mcpforge generate "A weather server that returns today's forecast for a city" -o weather-server

No key yet? Try the demo. mcpforge demo runs the real plan → generate → validate pipeline against a built-in recording and writes a complete, validated weather server — no API key, no spend. It's the fastest way to see exactly what mcpforge produces:

bash
uvx --from fastmcp-builder mcpforge demo

Bring your own key (BYOK). Generation runs on your Anthropic API key — mcpforge calls the Claude API directly and nothing is proxied through a hosted service. A single generate makes a few model calls (plan → server → tests), so a typical run costs roughly $0.05–$0.30 in API usage on the default model (claude-sonnet-4-6). That figure is an estimate — it scales with server complexity and your chosen model, and is not a live measurement. Everything that doesn't call the model — validate, inspect, list, doctor, and init — is free.

That's the whole loop. mcpforge plans the tools, generates the code, then runs syntax, security, lint, import, and pytest checks against the result — so what lands in ./weather-server/ is already validated:

python
# weather-server/server.py  (excerpt)"""Weather forecast MCP server."""
from fastmcp import FastMCP
mcp = FastMCP("Weather")
# Illustrative lookup — describe a real source and mcpforge wires the call for you._FORECASTS: dict[str, dict] = {    "san francisco": {"high_c": 18, "low_c": 12, "summary": "Foggy"},    "denver": {"high_c": 24, "low_c": 9, "summary": "Clear"},}

@mcp.toolasync def get_forecast(city: str) -> dict:    """Return today's forecast for a city."""    key = city.strip().lower()    if key not in _FORECASTS:        raise ValueError(f"No forecast available for {city!r}")    return {"city": city, **_FORECASTS[key]}

if __name__ == "__main__":    mcp.run(transport="streamable-http")

Every generation also produces test_server.py (a real pytest suite), pyproject.toml, a README.md, and an MCP client config.json — a complete project, not a snippet. Run it with:

bash
cd weather-serveruv run server.py            # start the server (streamable-http)uv run pytest -v            # run the generated testsmcpforge validate .         # re-run the full validation suite anytime

[Generated server: tests pass, then it runs]

The snippet above is an illustrative toy ("weather") for the docs. Real generations match your description — see examples/ for live generated servers (todo, file reader, database query, Slack notifier, TypeScript).

Build, then audit — the MCP toolkit

mcpforge has a sibling: mcp-audit (mcp-audits on PyPI). They're two halves of one workflow — forge a server, then audit what your agents can actually touch before you trust it.

StageToolWhat it does
BuildmcpforgeGenerate a complete, tested MCP server from one sentence.
Auditmcp-auditScan every MCP server wired into your machine and risk-score what each one can reach.
bash
# buildmcpforge generate "A weather server that returns today's forecast for a city" -o weather-server
# audit everything your agents can reach (read-only, no install needed)uvx --from mcp-audits mcp-audit scan --ssrf-check

mcp-audit is read-only by default — it never edits a config and reports env-var key names only, never values. Build with confidence, then verify your blast radius.

Registry-ready metadata lives in server.json with the MCP Registry name io.github.saagpatel/mcpforge and PyPI package fastmcp-builder. Treat that metadata as discovery/provenance context, not as proof that generated servers are safe to run without review.

Use as an MCP server

mcpforge is itself an MCP server: point an MCP client (Claude Code, Claude Desktop, Cursor) at it and your agent can forge, validate, and inspect MCP servers inside a conversation. It runs locally over stdio (it writes files into your workspace and calls your model provider on your own key), so it is not offered as a hosted remote.

bash
uvx fastmcp-builder

Add it to a client config (Claude Code shown). generate, update, and plan call the model provider, so set the key in the server env:

json
{  "mcpServers": {    "mcpforge": {      "command": "uvx",      "args": ["fastmcp-builder"],      "env": { "ANTHROPIC_API_KEY": "<your-key>", "MCPFORGE_WORKSPACE": "/path/to/workspace" }    }  }}

Workspace paths are resolved against MCPFORGE_WORKSPACE and confined to it. Note that generate and update write files and incur model-provider cost (roughly $0.05 to $0.30 per call on your key).

ToolWhat it doesWritesCostKey args
generateGenerate a complete, tested FastMCP 3.x server from a descriptionyes (workspace)API calldescription, language, transport, output_path, dry_run
updateApply a natural-language change to an existing generated serveryes (workspace)API callserver_path, request
planExtract the structured server plan without generating codenoAPI calldescription, transport
validateRun syntax, lint, import, and pytest checks on a generated serverno (executes tests)noneserver_path
inspectSummarize a generated server without executing itnononeserver_path
doctorCheck local prerequisites and provider readinessnononeworkspace_path
list_generated_serversList mcpforge-generated servers in a workspacenononeworkspace_path, recursive

Features

  • Plain-English generation — describe your server in natural language; Claude writes the implementation
  • Complete project scaffold — tools, Pydantic input models, error handling, pyproject.toml, and a pytest suite generated together
  • FastMCP 3.x native — output uses modern FastMCP decorators and transport configuration, not raw MCP protocol boilerplate
  • Validate before running — mcpforge validate runs syntax, security, lint, import, and pytest checks against generated servers
  • Iterate safely — mcpforge update modifies an existing generated server and backs up changed files before writing
  • Discover generated servers — mcpforge list finds mcpforge-generated projects in a workspace
  • Inspect and diagnose — mcpforge inspect summarizes generated server shape, while mcpforge doctor checks local readiness
  • Machine-readable output — status-like commands expose --json for agent workflows
  • OpenAPI curation controls — include/exclude tags, operation allowlists, and operation limits keep generated integrations focused
  • Scaffold without an LLM — mcpforge init creates a minimal FastMCP server skeleton for local iteration
  • MCP server mode — mcpforge-server exposes generation, planning, validation, inspection, doctor, and discovery tools so AI assistants can build safely

More commands

The PyPI distribution is fastmcp-builder; the installed commands are mcpforge and mcpforge-server. Beyond generate:

bash
# See it work with no API key — generate a weather server from a built-in recordingmcpforge demo
# Generate a new MCP servermcpforge generate "A todo list manager with create, read, update, and delete operations"
# Validate an existing generated servermcpforge validate ./my-server
# Modify an existing generated servermcpforge update ./my-server "Add a tool to export todos as CSV"
# Find generated servers in the current workspacemcpforge list . --recursive
# Inspect a generated server without executing itmcpforge inspect ./my-server
# Check local prerequisites and provider readinessmcpforge doctor

Useful generation flags:

  • --dry-run displays the structured plan without writing files.
  • --no-execute writes files but skips dependency installation and generated-code execution. Python still reports static syntax, security, and lint results; imports and generated tests do not run. TypeScript also skips type checking and generated tests, and its MCP response reports validation_mode: "write_only" and tests_status: "not_run". Provider-backed planning and code generation may still make API calls. The legacy tests_ok flag alone does not prove tests ran.
  • --strict treats Python lint errors as hard validation failures; TypeScript has no lint stage.
  • --from-openapi FILE generates from an OpenAPI 3.x spec.
  • --openapi-include-tag TAG, --openapi-exclude-tag TAG, --openapi-operation ID, and --openapi-limit N curate OpenAPI conversion.
  • --language python|typescript chooses the target server language.
  • --auth-profile none|api-key|jwt adds optional Python auth profile metadata and env docs.
  • --middleware-profile logging|timing|rate-limit adds optional Python middleware profiles; repeat it to combine profiles.
  • --provider anthropic|openai|openrouter selects the generation provider. openrouter is the "bring any model" path: set OPENROUTER_API_KEY and pick any OpenRouter model with --model (e.g. --model anthropic/claude-opus-4.8), including free and low-cost ones. Generation quality and structured-output support vary by model — the recommended models are Claude Opus 4.8 (xHigh) and/or GPT 5.5 (High/Extra High). The openai package is a default dependency (included in all installs) because it backs both --provider openai and --provider openrouter; set MCPFORGE_ENABLE_OPENAI_PROVIDER=1 to enable the direct OpenAI provider for use with OPENAI_API_KEY.

Useful status flags:

  • mcpforge list --json
  • mcpforge inspect PATH --json
  • mcpforge validate PATH --json
  • mcpforge doctor --json
  • mcpforge version --json

mcpforge doctor --json always prints the complete JSON report and exits 0 when the report's ok is true, or 1 when it is false, matching ordinary doctor.

For Cloud development, use the portable MCP Forge Cloud workflow skill. It covers prepared startup and credential-free checks, continuing an authorized existing PR, and the tested GitHub connector fallback when configured Git transport is blocked, with remote history and tested contents verified before delivery.

Tech Stack

LayerTechnology
LanguagePython 3.12+
GenerationAnthropic Claude via anthropic SDK; OpenAI and OpenRouter via openai SDK (included by default)
MCP frameworkFastMCP 3.x
CLIClick 8
TemplatesJinja2
ValidationPydantic v2
OutputRich

Development setup

The repository pins Python 3.12.15 in .python-version and requires uv 0.13.0 or later. Set up the locked environment and run the full local check with:

bash
make setupmake check

make check includes validation of examples/todo-server; on macOS it uses the available sandbox-exec boundary. CI disables that wrapper for the example-validation command because GitHub-hosted runners do not provide it.

Architecture

The generate command sends the user's description to Claude with a structured prompt that includes FastMCP 3.x idioms and a tool-schema contract. Claude returns a JSON plan (tool names, signatures, and descriptions) that mcpforge validates against a Pydantic model before rendering through Jinja2 templates into a complete project directory. The generated project is then validated with syntax checks, security scanning, ruff linting, import checks, and pytest execution. The update command reads an existing generated server, asks Claude for a targeted modification, writes backups for changed files, and validates the result.

Status

Stack

The current package version is 0.3.4, published to PyPI as fastmcp-builder. It adds a fastmcp-builder console-script alias and corrects the registry metadata. Version 0.3.3 added mcpforge demo, the OpenRouter provider, and MCP Registry metadata. The project targets Python 3.12+ and FastMCP 3.x. The repository toolchain pins Python 3.12.15 and requires uv 0.13.0 or later.

Known risks

  • Generated code runs during ordinary validation. macOS uses sandbox-exec when available; non-macOS validation runs without that sandbox. Review generated code before use.
  • Python --no-execute performs static syntax, security, and lint checks only; imports and generated tests do not run. Static results are not proof of runtime behavior.
  • The update command currently handles Python servers. TypeScript validation is narrower than the Python validation pipeline and does not use the Python lint or security stages.
  • Provider compatibility and deployment readiness depend on the selected provider and environment. See the provider matrix.

Next steps

Use CHANGELOG.md for release history and the provider matrix for hosted-provider readiness before planning release work.

See CHANGELOG.md for the full version history.

License

MIT

來源:README.md,提交 3a27576

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.3.4最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分