API管理与MCP集成工具

该工具通过Azure API Management将现有REST API作为MCP服务器公开,使AI代理能够发现和调用API,无需重写业务逻辑。

  • by odaibert
  • Jupyter Notebook
  • 本地部署
  • 更新于
在 GitHub 查看 odaibert/api-modernization-with-mcp

使用说明

接口模块❤️ MCP——为AI代理时代实现API现代化

“你的API正在成为工具。你的用户正在成为代理。你的平台需要适应。”

此存储库演示了如何使用 Azure API管理 作为 安全的企业级控制平面 为了 模型上下文协议(MCP) --使AI代理能够发现和调用您的API,而无需重写业务逻辑。

以…的风格建造 Azure示例/AI网关 存储库,以及通过二头肌部署真实Azure基础设施的动手Jupyter笔记本。

🚀 实验室

实验室 描述 状态
将REST API公开为MCP服务器 以现有的REST API(产品目录)为例,通过APIM将其公开为MCP服务器,使其可被AI代理发现和调用 ✅ 准备好了

为什么选择MCP+Azure API管理?

这 模型上下文协议 是一个开放标准,它将API转化为 工具 AI代理可以发现、理解和调用。Azure API管理将企业治理引入这一新范式:

  • 🔐 安全 -OAuth 2.0、Microsoft Entra ID、API密钥、JWT验证
  • 📊 监控 --Azure Monitor、应用程序洞察、实时分析
  • 🔍 发现 -将MCP工具发布到Azure API中心以实现组织范围的可见性
  • ⚙️ 政策 --MCP流量的速率限制、缓存、转换
  • 🌐 统一管理 --管理MCP以及REST、GraphQL和WebSocket API

仓库结构

api-modernization-with-mcp/
+-- labs/
|   +-- expose-rest-api-as-mcp/      # Lab notebook, Bicep templates, and README
|       +-- expose-rest-api-as-mcp.ipynb
|       +-- main.bicep
|       +-- README.md
+-- modules/                          # Reusable Bicep modules
|   +-- apim/
|   +-- apim-streamable-mcp/
|   +-- cognitive-services/
+-- shared/                           # Shared code (MCP servers, utilities)
|   +-- mcp-servers/
|   |   +-- product-catalog/
|   +-- utils.py
+-- requirements.txt

先决条件

入门指南

# Clone the repository
git clone https://github.com/odaibert/api-modernization-with-mcp.git
cd api-modernization-with-mcp

# Open in VS Code
code .

# Navigate to a lab and open the notebook
# labs/expose-rest-api-as-mcp/expose-rest-api-as-mcp.ipynb

每个实验笔记本都是独立的——点击 全部运行 提供基础设施、部署服务和端到端测试。

参考文献

贡献

该项目欢迎各方提供意见和建议。

许可证

该项目根据MIT许可证获得许可。