使用说明
Azure API中心的MCP服务器注册
使用基于Git的工作流(Pull Request)、Copilot SDK和Azure API中心集成的自动MCP(模型上下文协议)服务器注册系统。
🎯 概述
此存储库充当组织内MCP服务器的集中注册表。它提供:
- 📝 基于Git的注册:通过Pull Request提交MCP服务器以供审查和批准
- 🤖 Copilot SDK助手:交互式CLI工具,指导您完成注册过程
- ☁️ Azure API中心集成:PR合并后自动注册到Azure API中心
- 📚 自托管门户:通过Azure API中心门户浏览和发现MCP服务器
- ✅ 治理:具有审计跟踪的内置审批工作流
🏗️ 建筑
┌─────────────────┐
│ Developer │
│ (CLI Tool) │
└────────┬────────┘
│ 1. Input metadata
│ 2. Generate files
│ 3. Create PR
▼
┌─────────────────────────┐
│ GitHub Repository │
│ ├── apis/ │
│ │ └── <mcp-name>/ │
│ │ ├── openapi.json
│ │ ├── metadata.json
│ │ └── README.md │
│ └── .github/workflows/ │
└────────┬────────────────┘
│ 4. PR Merge
│ 5. GitHub Actions
▼
┌─────────────────────────┐
│ Azure API Center │
│ (System of Record) │
└────────┬────────────────┘
│ 6. Portal Access
▼
┌─────────────────────────┐
│ API Center Portal │
│ (Self-hosted) │
└─────────────────────────┘
🚀 快速开始
先决条件
- .NET 10.0 SDK或更高版本
- Git
- 访问此存储库
- (用于部署)带有API中心实例的Azure订阅
安装
- 克隆存储库:
git clone https://github.com/tatatatamami/copilot-agent-mcp-registry.git
cd copilot-agent-mcp-registry
- 构建CLI工具:
dotnet build
注册新的MCP服务器
- 运行注册助手:
dotnet run --project src/McpRegistration.Cli
-
按照交互式提示提供:
- MCP服务器名称(小写,仅限连字符)
- 描述
- 版本(语义版本控制)
- 公司/组织
- 所有者(个人或团队名称)
- 联系邮箱
- 状态(活动、已弃用、计划)
- 生命周期(设计、开发、测试、预览、生产、弃用、退役)
- 身份验证方法(无、api密钥、oauth2、entra id)
- 端点URL
- 文档URL
- 标签
-
该工具将:
- ✅ 验证您的输入
- ✅ 在中生成所需文件
apis/<mcp-name>/ - ✅ 创建一个新的Git分支
- ✅ 提交更改
-
推送分支并创建Pull Request:
git push -u origin mcp-registration/<mcp-name>
-
使用提供的模板在GitHub上创建PR
-
在批准和合并后,GitHub Actions将自动将您的MCP注册到Azure API中心
📁 仓库结构
├── .github/
│ ├── workflows/
│ │ └── register-to-api-center.yml # Automated registration workflow
│ └── PULL_REQUEST_TEMPLATE/
│ └── mcp-registration.md # PR template for reviews
├── apis/
│ └── <mcp-name>/ # One directory per MCP server
│ ├── openapi.json # OpenAPI 3.0 specification
│ ├── metadata.json # Metadata for API Center
│ └── README.md # Documentation
├── catalog/
│ └── index.yaml # Optional: catalog index
├── src/
│ ├── McpRegistration.Cli/ # Interactive CLI tool
│ └── McpRegistration.Core/ # Core libraries
│ ├── Models/ # Data models
│ └── Services/ # Business logic
└── README.md # This file
📋 元数据模式
每个MCP服务器都需要以下元数据:
必填字段
| 字段 | 类型 | 描述 | 示例 |
|---|---|---|---|
name |
string | MCP服务器名称(小写,连字符) | my-awesome-mcp |
description |
string | 简要说明 | Provides data analysis capabilities |
version |
string | 语义版本 | 1.0.0 |
company |
string | 所属组织 | Contoso Ltd |
owner |
string | 所有者名称 | Platform Team |
status |
string | 当前状态 | active, deprecated, planned |
lifecycle |
string | 开发阶段 | production, development等等。 |
authMethod |
string | 身份验证类型 | api-key, oauth2, entra-id, none |
可选字段
| 字段 | 类型 | 描述 |
|---|---|---|
contactEmail |
string | 联系人电子邮件地址 |
endpointUrl |
string | MCP服务器端点 |
documentationUrl |
string | 文档链接 |
tags |
array | 分类标签 |
customProperties |
object | 其他元数据 |
🔐 身份验证方法
API密钥(api-key)
使用Bearer令牌的标准API密钥身份验证。适用于大多数内部服务。
OAuth 2.0(oauth2)
用于委派访问的OAuth 2.0流。需要用户授权时使用。
微软Entra ID(entra-id)
Entra ID(以前称为Azure AD)身份验证。建议用于具有现有Azure/Microsoft 365集成的企业场景。
没有(none)
无需身份验证。 仅用于开发/内部环境。
🔄 生命周期阶段
| 阶段 | 描述 | 何时使用 |
|---|---|---|
design |
API正在设计 | 初始规划阶段 |
development |
正在积极开发中 | 默认为新MCP |
testing |
测试/QA阶段 | 生产发布前 |
preview |
公开预览/测试版 | 生产使用受限 |
production |
一般可用 | 稳定,生产就绪 |
deprecated |
标记为退役 | 支持但不建议 |
retired |
不再可用 | 关闭 |
⚙️ GitHub操作设置
必需的秘密
在GitHub存储库设置中配置这些机密:
| 机密 | 描述 |
|---|---|
AZURE_CLIENT_ID |
服务主体客户端ID |
AZURE_TENANT_ID |
Azure AD租户ID |
AZURE_SUBSCRIPTION_ID |
Azure订阅ID |
AZURE_API_CENTER_NAME |
API中心实例名称 |
AZURE_RESOURCE_GROUP |
资源组名称 |
Azure安装程序
- 创建Azure API中心实例:
az apic create \
--resource-group <resource-group> \
--name <api-center-name> \
--location <region>
- 为GitHub操作创建服务主体:
az ad sp create-for-rbac \
--name "GitHub-Actions-API-Center" \
--role "API Management Service Contributor" \
--scopes /subscriptions/<subscription-id>/resourceGroups/<resource-group> \
--sdk-auth
- 为OIDC配置联合凭据(推荐):
az ad app federated-credential create \
--id <app-id> \
--parameters credential.json
📊 自营API中心门户
要设置用于浏览已注册API的自托管门户:
-
遵循Microsoft学习指南: 自助API中心门户
-
配置门户以指向API中心实例
-
部署到Azure应用服务或您首选的托管平台
该门户提供:
- 🔍 搜索和发现已注册的MCP
- 📖 API文档查看器
- 🏷️ 按元数据(公司、生命周期、标签)过滤
- 📋 OpenAPI规范查看器
🛠️ 发展
构建解决方案
dotnet build
运行测试(如果可用)
dotnet test
在本地运行CLI
cd src/McpRegistration.Cli
dotnet run
📚 参考文献
🤝 贡献
- 创建要素分支
- 进行更改
- 提交拉取请求
- 确保所有检查均已通过
对于MCP服务器注册,请使用CLI工具并遵循标准注册流程。
📄 许可证
此项目根据MIT许可证获得许可-有关详细信息,请参阅许可证文件。
🆘 支持
如有疑问或问题:
- 检查现有文档
- 搜索已关闭的问题
- 创建具有详细描述的新问题
- 联系平台团队
系统的记录:Azure API中心是所有注册MCP服务器的权威来源。此存储库用作注册接口和审计跟踪。