返回市场
MCP项目编排器

MCP项目编排器

作者:sparesparrow15 星标更新:2025-10-23

项目介绍

MCP项目编排器

CI/CD codecov PyPI version Python 3.9+ License: MIT

一个全面的项目编排工具,用于管理模型上下文协议(MCP)项目、模板、提示和Mermaid图表。

功能

  • 模板管理

    • 项目模板,快速设置项目
    • 组件模板,模块化开发
    • 变量替换和验证
    • 模板发现和版本控制
  • 提示管理

    • 系统和用户提示模板
    • 变量替换
    • 提示分类和版本控制
    • 易于发现和重用提示
  • Mermaid图表生成

    • 流程图生成
    • 序列图生成
    • 类图生成
    • SVG和PNG渲染
    • 图表验证
  • AWS MCP集成

    • AWS服务访问(S3, EC2, Lambda, CloudFormation, IAM)
    • AWS最佳实践执行
    • 成本优化建议
    • 安全性和合规性指导
    • 详情见AWS_MCP.md

安装

pip install mcp-project-orchestrator

对于AWS集成支持:

pip install mcp-project-orchestrator[aws]

或者使用Poetry:

poetry add mcp-project-orchestrator
# 或者带有AWS支持
poetry add mcp-project-orchestrator -E aws

作为Conan依赖项使用(针对ai-servis)

此仓库提供了一个Conan v2包,暴露了Python环境和CLI。在ai-servisconanfile.py中添加:

def requirements(self):
    self.requires("mcp-project-orchestrator/0.1.0@sparesparrow/stable")

然后激活运行环境,使mcp-orchestrator位于PATH上,并且包位于PYTHONPATH上:

conan profile detect --force
conan create . --user=sparesparrow --channel=stable
conan install mcp-project-orchestrator/0.1.0@sparesparrow/stable -g VirtualRunEnv
./conanrun.sh mcp-orchestrator --help

快速开始

项目模板

from mcp_project_orchestrator.templates import TemplateManager

# 初始化模板管理器
manager = TemplateManager("path/to/templates")

# 列出可用模板
templates = manager.list_templates()
print(templates)

# 应用项目模板
manager.apply_template("fastapi-project", {
    "project_name": "my-api",
    "project_description": "My FastAPI project",
    "author_name": "John Doe",
    "author_email": "john@example.com"
})

JSON驱动的项目编排

设置脚本读取config/project_orchestration.json以启用/禁用功能并设置端口和工具选项。

运行设置:

chmod +x scripts/setup_orchestrator.sh
scripts/setup_orchestrator.sh

编辑config/project_orchestration.json以控制搭建:

{
  "enable": {
    "cursorConfigs": true,
    "pythonMcp": true,
    "tsMcp": true,
    "cppMcp": true,
    "mcpClient": true,
    "backgroundAgent": true,
    "githubActions": true,
    "devcontainer": true,
    "awsTerraform": true,
    "webAndMcp": true,
    "cppConan": true,
    "esp32": true,
    "android": true
  }
}
  • 将项目设置为false以跳过生成这些组件。
  • 端口和URL在.cursor/webhooks.cursor/agentsDockerfile EXPOSE 和 compose.yaml中被尊重。

提示管理

from mcp_project_orchestrator.prompts import PromptManager

# 初始化提示管理器
manager = PromptManager("path/to/prompts")

# 列出可用提示
prompts = manager.list_prompts()
print(prompts)

# 渲染带有变量的提示
rendered = manager.render_prompt("system-prompt", {
    "name": "User",
    "project": "MCP"
})
print(rendered)

Mermaid图表

from mcp_project_orchestrator.mermaid import MermaidGenerator, MermaidRenderer

# 初始化生成器
generator = MermaidGenerator()
renderer = MermaidRenderer()

# 生成流程图
flowchart = generator.generate_flowchart(
    nodes=[
        ("A", "Start"),
        ("B", "Process"),
        ("C", "End")
    ],
    edges=[
        ("A", "B", ""),
        ("B", "C", "")
    ]
)

# 渲染为SVG
renderer.render(flowchart, "flowchart.svg")

项目结构

mcp-project-orchestrator/
├── src/
│   └── mcp_project_orchestrator/
│       ├── templates/
│       │   ├── __init__.py
│       │   ├── base.py
│       │   ├── project.py
│       │   ├── component.py
│       │   └── manager.py
│       ├── prompts/
│       │   ├── __init__.py
│       │   ├── template.py
│       │   └── manager.py
│       └── mermaid/
│           ├── __init__.py
│           ├── generator.py
│           └── renderer.py
├── tests/
│   ├── __init__.py
│   ├── conftest.py
│   ├── test_templates.py
│   ├── test_prompts.py
│   └── test_mermaid.py
├── docs/
├── examples/
├── .github/
│   └── workflows/
│       └── ci.yml
├── pyproject.toml
├── Containerfile
└── README.md

开发

  1. 克隆仓库:
git clone https://github.com/yourusername/mcp-project-orchestrator.git
cd mcp-project-orchestrator
  1. 安装依赖:
poetry install
  1. 运行测试:
poetry run pytest
  1. 运行代码检查:
poetry run ruff check .
poetry run mypy src/mcp_project_orchestrator

贡献

  1. 分叉仓库
  2. 创建功能分支
  3. 提交更改
  4. 推送到分支
  5. 创建拉取请求

许可证

该项目采用MIT许可证 - 查看LICENSE文件获取详细信息。

致谢

OpenSSL集成

增强的OpenSSL项目模板和Cursor AI配置。

创建OpenSSL项目

mcp-orchestrator create-openssl-project \
  --project-name my-secure-app \
  --deployment-target fips-government

部署AI配置

mcp-orchestrator deploy-cursor --project-type openssl

可用模板

  • openssl-consumer: 标准OpenSSL应用程序
  • openssl-fips: FIPS 140-3政府部署