PMFlow/backend/app/services/mcp_config/catalog.py

88 lines
3.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from __future__ import annotations
from .schemas import McpFieldSpec, McpTemplateSpec
def build_template_catalog() -> list[McpTemplateSpec]:
return [
McpTemplateSpec(
id="microsoft_learn",
name="Microsoft Learn MCP",
description="官方远程 MCP,无需 Token,可直接接入 Microsoft Learn 文档检索。",
transport="streamable_http",
execution_mode="backend_direct",
icon="book-open",
recommended=True,
docs_url="https://github.com/MicrosoftDocs/mcp",
fields=[],
command_hint="保存后由 PMFlow 后端直接连接远程 MCP,不要求客户机器安装额外 MCP host。",
verify_hint="重新校验时,PMFlow 会从后端执行 MCP 握手与 tools/list 探测。",
),
McpTemplateSpec(
id="github",
name="GitHub MCP",
description="官方 GitHub MCP,面向仓库、Issue、PR 等开发资产。",
transport="stdio",
execution_mode="local_bridge",
icon="github",
docs_url="https://github.com/modelcontextprotocol/servers",
fields=[
McpFieldSpec(
key="token_env_var_name",
label="本地 Token 环境变量名",
field_type="text",
required=True,
placeholder="GITHUB_PAT",
description="PMFlow 只保存环境变量名,不保存明文 Token。",
default_value="GITHUB_PAT",
),
],
command_hint="需要 PMFlow Local Bridge 或兼容 MCP host 在客户本机承载 stdio server。",
verify_hint="确认本机 bridge/host 已接入后,再回到这里做手动确认。",
),
McpTemplateSpec(
id="filesystem",
name="Filesystem MCP",
description="官方 reference server,面向受控目录的本地文件访问。",
transport="stdio",
execution_mode="local_bridge",
icon="folder-open",
docs_url="https://github.com/modelcontextprotocol/servers",
fields=[
McpFieldSpec(
key="allowed_paths",
label="允许目录",
field_type="path_list",
required=True,
placeholder="/absolute/path/one",
description="每行一个绝对路径,只暴露给 MCP 允许访问的目录。",
default_value=[],
),
],
command_hint="需要 PMFlow Local Bridge 或兼容 MCP host 在客户本机启动 filesystem server。",
verify_hint="确认本机 bridge/host 已接入并暴露目录后,再回到这里做手动确认。",
),
McpTemplateSpec(
id="playwright",
name="Playwright MCP",
description="官方 Playwright MCP,适合浏览器自动化和页面抓取。",
transport="stdio",
execution_mode="local_bridge",
icon="monitor-play",
docs_url="https://playwright.dev/java/agents/network-and-security",
fields=[
McpFieldSpec(
key="output_dir",
label="输出目录",
field_type="text",
required=False,
placeholder="~/.pmflow/mcp/playwright-output",
description="用于保存 Playwright MCP 输出工件的目录。",
default_value="~/.pmflow/mcp/playwright-output",
),
],
command_hint="需要 PMFlow Local Bridge 或兼容 MCP host 在客户本机启动 Playwright MCP。",
verify_hint="确认本机 bridge/host 已接入并能产出浏览器工件后,再回到这里做手动确认。",
),
]