MCP网关服务

通过API管理将REST API作为MCP服务器暴露的解决方案,部署在Azure容器应用和容器注册表中。

  • by gopkumr
  • Bicep
  • 本地部署
  • 更新于
在 GitHub 查看 gopkumr/restapi-mcp-apim

使用说明

通过API管理将REST API公开为MCP服务器

此项目包含用于将模型上下文协议(MCP)网关应用程序部署到具有Azure容器注册表的Azure容器应用程序的二头肌模板和配置。然后通过APIM管理暴露MCP

建筑

该解决方案部署了:

  • Azure容器注册表:容器映像的私有注册表
  • Azure容器应用程序环境:使用日志分析的托管环境
  • Weather REST API容器应用程序:REST API服务的可扩展容器
  • MCP服务器容器应用程序:MCP服务器服务的可扩展容器
  • API发布:将API和MCP服务器发布到API管理。
  • 日志分析工作区:集中记录和监控

快速开始

先决条件

  • Azure订阅
  • Azure CLI或Azure开发者CLI(azd)
  • Docker(用于构建镜像)
  • .NET 9.0 SDK(用于本地开发)

PowerShell部署脚本

# Full deployment with build and publish
.\deploy.ps1 -ResourceGroupName "org-mcpgateway-dev-rg" -ApimName "org-mcp-poc-apim-dev" -ApimResourceGroupName "org-apim-rg" -ServiceNamePrefix "org-mcp-gateway" -Location "australiaeast"

# Infrastructure only (skip build and container updates)
.\deploy.ps1 -ResourceGroupName "org-mcpgateway-dev-rg" -ApimName "org-mcp-poc-apim-dev" -ApimResourceGroupName "org-apim-rg" -ServiceNamePrefix "org-mcp-gateway" -Location "australiaeast"
 -SkipBuild