Back to MCP directory
publicPublicdnsLocal runtime

remote-mcp-apim-functions-python

使用Azure API Management作为MCP服务器的AI网关,实现远程MCP服务器的安全访问,支持最新的MCP授权规范。

article

README

🚀 使用 Azure API 管理实现远程 MCP 服务器(实验性质)

本项目借助 Azure API Management 作为 AI 网关 来管理 MCP 服务器,实现了最新的 MCP 授权规范,可帮助你深入了解相关流程。

架构图

这是一个了解流程的 序列图

🚀 快速开始

📦 安装指南

将远程 MCP 服务器部署到 Azure

  1. 注册 Microsoft.App 资源提供程序:
    • 若使用 Azure CLI,运行命令:az provider register --namespace Microsoft.App --wait
    • 若使用 Azure PowerShell,先运行命令:Register-AzResourceProvider -ProviderNamespace Microsoft.App,再运行 (Get-AzResourceProvider -ProviderNamespace Microsoft.App).RegistrationState 检查注册是否完成。
  2. 运行以下 azd 命令,以提供 API 管理服务、函数应用(包含代码)以及其他所有必需的 Azure 资源:
azd up

💻 使用示例

MCP 检查工具

  1. 新终端窗口 中,安装并运行 MCP 检查工具:
npx @modelcontextprotocol/inspector
  1. 按下 CTRL 点击以加载 MCP 检查工具的网页应用(例如 http://127.0.0.1:6274/#resources)。
  2. 设置传输类型为 SSE
  3. 将 URL 设置为运行中的 API 管理 SSE 终端点(从 azd 输出中获取,例如:https://<apim-servicename-from-azd-output>.azure-api.net/mcp/sse),然后 连接
  4. 列出工具。点击一个工具并 运行工具
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client