Skip to main content
Glama
bridge-mcp-server

bridge-mcp-server

bridge-mcp-server · AI Foundation 生成能力(MCP 生成面)

把系列「AI 生成完整业务系统」的确定性生成能力按 MCP 规范暴露给任意符合 MCP 的壳(Claude Code / Hermes / 自研 app…)消费。目标是需求 → 生成项目目录的统一流程。

只做生成面:菜单 / 参数内省 / 确定性生成 / 结构化返回;治理链(桥 check 漂移、AI 维护契约)不在此暴露(一面一 server,见 DESIGN §3.1/§10)。

能力(六生成工具 + 两资源 + 玩法)

链

工具

说明

单端(②-⑥ 直生成,零注册)

list_templates

单端候选菜单(离线注册表过滤)

get_template_params

clone 底座 → 读 params.json 两区(native/derived/selection)

generate_single

git 地址 + 参数 + target_dir → copier 生成(无协议地址回退 copier.yml 内省)

多端(① 纯 cli 消费桥)

list_combos

组合菜单(units/edges + 合并 selection,经桥 --json)

get_combo_params

参数基线(params 可问 / internal 勿传 / derived 只读 / 共享参数标 shared: true)

generate_multi

combo + 参数 + target_dir → shell-out 桥 generate

  • Resources:templates://catalog(单端注册表)、combos://catalog(桥内省视图)

  • Prompt / Skill:generate_project_guide(MCP 玩法)+ 壳侧 generate-project(canonical,玩法只引用工具不抄知识)

Related MCP server: Minecraft Dev MCP

架构(双路径 × 双链)

单端:git 地址 → clone → 读协议(params.json 两区/回退 copier.yml) → spec 校验 → copier
多端:纯 cli shell-out 桥(generate + 内省 list-combos/show-combo),server 不直读 combos.yaml

设计定稿见 docs/DESIGN.md;阶段落地已随各仓提交完成(P0-P4 收口,跨仓清单见 DESIGN §13)。

目录结构

bridge_mcp/              共享胶水(无 MCP 面):config / git / protocol / bridge_cli / selection
servers/generation/      生成面 MCP server(六工具 + resources + guide + templates.yaml)
servers/governance/      治理面占位(README,未实现)
skills/generate-project/ 壳侧玩法 skill(canonical)
tests/{unit,e2e}         单测 + MCP stdio / 生成 e2e

快速开始

uv sync                                        # 安装依赖(fastmcp / copier 9.17.1)
# 多端工具需要打包好的桥可执行(见 CLAUDE.md 开发前置):
#   cd ~/project/fullstack-bridge && uv sync --dev && uv run pyinstaller bridge.spec --noconfirm
#   mkdir -p ~/.local/bin && cp dist/bridge ~/.local/bin/bridge
BRIDGE_EXE=/home/jeff/.local/bin/bridge uv run python -m servers.generation.server   # stdio 起 server

挂到 Claude Code

claude mcp add bridge-gen --transport stdio \
  -- uv run --directory /home/jeff/project/bridge-mcp-server python -m servers.generation.server
claude mcp list

为什么不够:MCP generate_project_guide 只是「一段内容」,不会自动让模型调工具。要自然语言直接触发工具,靠两层信号——server instructions(已内置:收到生成需求必须调六工具、禁止编造)+ 壳侧 skill(命中即按流程走并调工具)。skill 是 Claude Code 里最可靠的「玩法」载体。

挂载玩法 skill(强化工具触发)

canonical 在仓库 skills/generate-project/SKILL.md。Claude Code 只在本项目目录内自动发现项目级 skill;要在任意目录都能触发,请装到全局:

mkdir -p ~/.claude/skills/generate-project
cp skills/generate-project/SKILL.md ~/.claude/skills/generate-project/
  • 之后说「帮我生成一个 X 项目/系统」即命中 generate-project → 模型会调用 bridge-gen 六工具(菜单/参数/selection 一律以工具返回为准,不脑补)。

  • 仍未触发,先查连接与点名:

    claude mcp list   # bridge-gen 应为 connected;工具形如 mcp__bridge-gen__list_combos
    # 或点名触发:『用 bridge-gen 的工具』 / 『用 generate-project 走一遍』
  • 改玩法只改仓库 canonical(skills/generate-project/),需要时重新同步全局一份即可(内容与 ~/.claude 允许有版本差,canonical 以仓库为准)。

环境变量

变量

用途

默认

BRIDGE_EXE

桥可执行(dist/bridge,多端链)

无(必配,否则多端工具报错)

BRIDGE

PATH 上的 bridge 命令(备选)

—

BRIDGE_MCP_CACHE

单端克隆缓存根

~/.cache/bridge-mcp-server

只认可执行入口,不暴露源码 cli.py(BRIDGE_CLI 已移除)。

测试

uv run pytest tests/unit -q                 # 离线单测(mock 桥/copier)
BRIDGE_EXE=/home/jeff/.local/bin/bridge uv run pytest -q   # 全量(含 MCP stdio + 生成 e2e)

相关仓库

协议(params.json 两区 + gen-params)见 fullstack-param-protocol;桥(组合治理/内省/生成执行)见 fullstack-bridge;底座:react / vue / python-fastapi 模板。

Available Tools

6 tools
generate_multiGenerate MultiC

多端组合生成(shell-out 桥 generate):combo 须在注册表内,params ⊆ 原生参数集。

Inputs: combo (required), params (required), target_dir (required), skip_tasks.

generate_singleGenerate SingleB

单端直生成:clone → 读协议 → spec 校验 → copier copy(零注册,target_dir 须为空/不存在)。

Inputs: params (required), git_url (required), target_dir (required), version, +1 more.

get_combo_paramsGet Combo ParamsC

多端参数基线(经桥 show-combo):params(可问)/ internal(勿传)/ derived(只读)/ selection。

Inputs: combo (required).

get_template_paramsGet Template ParamsD

单端参数内省 = 落参与选择地基:clone 底座读 params.json 两区(native/derived/selection)。

Inputs: git_url (required), version.

list_combosList CombosD

多端菜单(L1/L2 地基):units/edges + 合并 selection(经桥 list-combos)。

Inputs: stack.

list_templatesList TemplatesB

单端候选菜单(L1):离线读注册表过滤,kind/stack/form 可选(子串匹配; 受控值/同义词见 templates://catalog 词表提示)。

Inputs: form, kind, stack.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.8/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: list_templates and list_combos separately list single-end and multi-end options; get_template_params and get_combo_params separately introspect parameters; generate_single and generate_multi separately perform generation. The descriptions reinforce the single vs multi distinction, leaving no ambiguity about which tool to call for a given task.

    Naming Consistency4/5

    All names use snake_case with a consistent verb-first pattern (list_, get_, generate_) and parallel structure for single vs multi (templates/combos, template_params/combo_params). The only minor deviation is that generate_single and generate_multi use mode adjectives rather than nouns, but the set remains highly predictable.

    Tool Count5/5

    Six tools cleanly cover the two modalities (single-end and multi-end) with three operations each (list, get params, generate). This is well-scoped and every tool earns its place without redundancy.

    Completeness4/5

    The surface covers discovery, parameter introspection, and generation for both single and multi templates, forming a complete lifecycle for the bridge's purpose. Minor gaps exist: no standalone validation or preview tool, and list_combos lacks the filtering options that list_templates provides.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      MCP server that exposes RESTForge capabilities to AI agents, enabling them to set up, configure, generate code, and manage RESTForge projects through natural language.
      29
      44 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      A Model Context Protocol server that gives AI assistants native access to Minecraft mod development tools — decompile, remap, search, and analyze Minecraft source code directly from your AI workflow.
      130 npm
      50
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables MCP clients to inspect and operate MCreator workspaces through MCreator's Java APIs, supporting elements, generators, resources, and builds.
      GPL 3.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to generate complete, runnable MCP server projects from natural-language tool descriptions, including schema, implementation, tests, README, and license.
      MIT