|
| 1 | +--- |
| 2 | +title: Connect and govern existing MCP server in API Management | Microsoft Docs |
| 3 | +description: Learn how to connect and govern an existing Model Context Protocol (MCP) server in Azure API Management. |
| 4 | +author: dlepow |
| 5 | +ms.service: azure-api-management |
| 6 | +ms.topic: how-to |
| 7 | +ms.date: 07/14/2025 |
| 8 | +ms.author: danlep |
| 9 | +ms.collection: ce-skilling-ai-copilot |
| 10 | +ms.custom: |
| 11 | +--- |
| 12 | + |
| 13 | +# Connect and govern an existing MCP server |
| 14 | + |
| 15 | +[!INCLUDE [api-management-availability-premium-standard-basic-premiumv2-standardv2-basicv2](../../includes/api-management-availability-premium-standard-basic-premiumv2-standardv2-basicv2.md)] |
| 16 | + |
| 17 | +Azure API Management now supports secure integration with external MCP-compatible servers — tool servers hosted outside of API Management — through its built-in [AI gateway](genai-gateway-capabilities.md). This capability adds to existing support for MCP servers [natively exposed in API Management](export-rest-mcp-server.md) from managed REST APIs. Wit this enhancement, organizations can apply consistent governance, security, and observability to all MCP tools, regardless of where they are hosted. |
| 18 | + |
| 19 | +This capability is essential for enterprises building AI agents and copilots that rely on tools distributed across cloud services, open-source runtimes, and internal platforms. With API Management, you can now centralize access, enforce policies, and monitor usage across your entire AI tool ecosystem. |
| 20 | + |
| 21 | +### Example scenarios |
| 22 | + |
| 23 | +- Proxy LangServe or LangChain tool servers through API Management with per-tool authentication and rate limits. |
| 24 | +- Securely expose Logic App–based tools to copilots using IP filtering and OAuth. |
| 25 | +- Centralize tools from Azure Functions and open-source runtimes into Azure API Center. |
| 26 | +- Enable GitHub Copilot, Claude, or ChatGPT to interact securely with tools across your enterprise. |
| 27 | + |
| 28 | + |
| 29 | +## Prerequisites |
| 30 | + |
| 31 | +- An Azure API Management instance with the AI Gateway feature enabled. |
| 32 | +- Access to an external MCP-compatible server (for example, hosted in Azure Logic Apps, Azure Functions, LangServe, or other platforms). |
| 33 | +- Appropriate credentials to the MCP server (OAuth 2.0 client credentials or API keys) for secure access. |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | +## Connect an existing MCP Server |
| 38 | + |
| 39 | +1. Navigate to your Azure API Management instance in the Azure portal. |
| 40 | +2. In the left-hand menu, select **MCP servers** > **+ Create MCP server**. |
| 41 | +2. Choose **Connect existing MCP server**. |
| 42 | +3. Enter the following details: |
| 43 | + - **Base URL** of the external MCP server. |
| 44 | + - **Metadata endpoint** (if available). |
| 45 | + - **Tool schema** describing the server’s capabilities. |
| 46 | + |
| 47 | +## Configure access and security Policies |
| 48 | + |
| 49 | +1. Use **Credential Manager** to configure authentication: |
| 50 | + - Choose between **OAuth 2.0 client credentials** or **API key**. |
| 51 | + - Store secrets securely in **Azure Key Vault**. |
| 52 | +2. Apply inbound policies to: |
| 53 | + - Inject or modify headers, tokens, and query parameters. |
| 54 | + - Validate requests before routing to the external server. |
| 55 | +3. Set **rate limits and quotas** to prevent overuse and ensure fair access. |
| 56 | + |
| 57 | +### Step 4: Enable Monitoring and Logging |
| 58 | + |
| 59 | +1. Enable **Azure Monitor** integration to capture: |
| 60 | + - Diagnostic logs |
| 61 | + - Request/response traces |
| 62 | + - Usage metrics |
| 63 | +2. Connect logs to your observability stack for auditing and analysis. |
| 64 | + |
| 65 | +### Step 5: Validate the Connection |
| 66 | + |
| 67 | +1. Use a compliant LLM agent (e.g., GitHub Copilot, Semantic Kernel, Copilot Studio) or a test client (e.g., Postman, curl) to call the APIM-hosted MCP endpoint. |
| 68 | +2. Ensure the request includes appropriate headers and tokens. |
| 69 | +3. Confirm successful routing and response from the external MCP server. |
| 70 | + |
| 71 | + |
| 72 | +## Summary |
| 73 | + |
| 74 | +With this enhancement, Azure API Management becomes the unified governance layer for both: |
| 75 | +- APIs exposed as MCP servers natively in APIM |
| 76 | +- External MCP servers hosted across various platforms |
| 77 | + |
| 78 | +By integrating with Azure API Center, all your AI tools become discoverable, auditable, and reusable — regardless of their hosting environment. |
| 79 | + |
| 80 | +## Related content |
| 81 | + |
| 82 | +* [Python sample: Secure remote MCP servers using Azure API Management (experimental)](https://github.com/Azure-Samples/remote-mcp-apim-functions-python) |
| 83 | + |
| 84 | +* [MCP client authorization lab](https://github.com/Azure-Samples/AI-Gateway/tree/main/labs/mcp-client-authorization) |
| 85 | + |
| 86 | +* [Use the Azure API Management extension for VS Code to import and manage APIs](visual-studio-code-tutorial.md) |
| 87 | + |
| 88 | +* [Register and discover remote MCP servers in Azure API Center](../api-center/register-discover-mcp-server.md) |
| 89 | + |
0 commit comments