Skip to content

Commit 008ff9c

Browse files
author
gitName
committed
wip
1 parent 0cbef60 commit 008ff9c

File tree

2 files changed

+63
-15
lines changed

2 files changed

+63
-15
lines changed

articles/api-management/mcp-server-overview.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ ms.custom:
1414

1515
[!INCLUDE [api-management-availability-premium-standard-basic-premiumv2-standardv2-basicv2](../../includes/api-management-availability-premium-standard-basic-premiumv2-standardv2-basicv2.md)]
1616

17-
This article introduces features in Azure API Management that you can use to manage Model Context Protocol (MCP) servers. MCP servers allow AI agents to access external data sources, such as databases or APIs, through a standardized protocol.
17+
This article introduces features in Azure API Management that you can use to manage Model Context Protocol (MCP) servers. MCP servers allow large language models (LLMs) and AI agents to access external data sources, such as databases or APIs, through a standardized protocol.
1818

19-
Use API Management to securely expose and govern API operations as tools for large language models (LLMs) and AI agents like GitHub Copilot, ChatGPT, Claude, and more. API Management provides centralized control over MCP server authentication, authorization, and monitoring. It simplifies the management of MCP servers while helping to mitigate common security risks and ensuring scalability.
19+
With the proliferation of AI agents and large language models (LLMs), management of MCP servers is becoming increasingly important:
2020

21+
* Agents need secure, governed access to tools and resources
22+
* Developers want to reuse existing APIs as agent tools
23+
* Enterprises need observability, control, and scaling
24+
25+
Use API Management to securely expose and govern API operations as tools for LLMs and AI agents like GitHub Copilot, ChatGPT, Claude, and more. API Management provides centralized control over MCP server authentication, authorization, and monitoring. It simplifies the management of MCP servers while helping to mitigate common security risks and ensuring observability, control, and scalability.
2126

2227
## MCP concepts and architecture
2328

@@ -85,7 +90,7 @@ Configure policies such as the following::
8590

8691
## Secure access to the MCP server
8792

88-
You can secure either or both inbound access to the MCP server (from an MCP client to API Management) and outbound access (from API Management to the MCP server backend). For information and examples, see [Secure access to MCP servers](secure-mcp-servers.md).
93+
You can secure either or both inbound access to the MCP server (from an MCP client to API Management) and outbound access (from API Management to the MCP server backend). For more information and examples, see [Secure access to MCP servers](secure-mcp-servers.md).
8994

9095
## Monitoring
9196

@@ -103,9 +108,11 @@ For more information, see [Monitor API Management](monitor-api-management.md).
103108

104109
## Discover MCP servers
105110

106-
Use [Azure API Center](../api-center/register-discover-mcp-server.md) to register and discover MCP servers in your organization. Azure API Center provides a centralized location for managing MCP servers, including those exposed in API Management and those hosted outside of API Management.
111+
Use [Azure API Center](../api-center/register-discover-mcp-server.md) to register and discover MCP servers in your organization.
107112

113+
* Azure API Center provides a centralized location for managing MCP servers, including those exposed in API Management and those hosted outside of API Management.
108114

115+
* Deploy the [API Center portal](../api-center/set-up-api-center-portal.md) to enable your users to discover and interact with MCP servers through a private, enterprise-ready MCP server registry.
109116

110117
## Availability
111118

@@ -115,7 +122,7 @@ MCP servers in API Management are available in the following service tiers:
115122
* **v2 tiers**: Basic v2, Standard v2, Premium v2
116123

117124
> [!NOTE]
118-
> * In the classic tiers, you must join the [AI Gateway Early update group](configure-service-update-settings.md) to access MCP server features, and access the portal at a feature-specific URL.
125+
> * In the classic tiers, you must join the [AI Gateway Early update group](configure-service-update-settings.md) to access MCP server features.
119126
> * MCP servers aren't currently supported in [workspaces](workspaces-overview.md).
120127
121128
## Related content
@@ -130,4 +137,6 @@ MCP servers in API Management are available in the following service tiers:
130137

131138
* [Expose and govern existing MCP server](expose-existing-mcp-server.md)
132139

133-
* [Secure access to MCP servers](secure-mcp-servers.md)
140+
* [Secure access to MCP servers](secure-mcp-servers.md)
141+
142+
* Visit [https://mcp.azure.com](https://mcp.azure.com) for a live example of an MCP server registry created using Azure API Center.

articles/api-management/secure-mcp-servers.md

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,40 @@ With [MCP server support in API Management](mcp-server-overview.md), you can ex
1919

2020
You can secure either or both inbound access to the MCP server (from an MCP client to API Management) and outbound access (from API Management to the MCP server backend).
2121

22-
### Secure inbound access
22+
## Secure inbound access
2323

24-
One option to secure inbound access is to configure a policy to validate a JSON web token (JWT) generated using an identity provider in the incoming requests. This ensures that only authorized clients can access the MCP server. Use the generic [validate-jwt](validate-jwt-policy.md) policy, or the [validate-azure-ad-token](validate-azure-ad-token-policy.md) policy when using Microsoft Entra ID, to validate the JWT in the incoming requests.
24+
### Key-based authentication
2525

26-
The following is a basic example of validating a Microsoft Entra ID token presented in an `Authorization` header in the incoming request:
26+
If the backend API is protected with an API Management subscription key passed in a `Ocp-Apim-Subscription-Key` header, MCP clients can present the key in the incoming requests, and the MCP server can validate the key. For example, in Visual Studio Code, you can add a `headers` section to the MCP server configuration to require the subscription key in the request headers:
27+
28+
```json
29+
{
30+
"name": "My MCP Server",
31+
"type": "remote",
32+
"url": "https://my-api-management-instance.azure-api.net/my-mcp-server",
33+
"transport": "streamable-http",
34+
"headers": {
35+
"Ocp-Apim-Subscription-Key": "<subscription-key>"
36+
}
37+
}
38+
39+
```
40+
41+
Visual Studio Code provides ways to store the subscription key in the workspace or user settings, or to pass the key through user input, so you don't have to hard-code it in the MCP server configuration.
42+
43+
> [!CAUTION]
44+
> When you use an MCP server in API Management, incoming headers like **Authorization** aren't automatically passed to your backend API. If your backend needs a token, you can add it as an input parameter in your API definition. Alternatively, use policies like `get-authorization-context` and `set-header` to generate and attach the token, as noted in the following section.
45+
46+
### Token-based authentication
47+
48+
You can generate an access token (JWT) using your identity provider, and pass the token in a request to the MCP server in an `Authorization` header. Then, API Management can use a policy to validate the JWT in the incoming request. This ensures that only authorized clients can access the MCP server.
49+
50+
API Management provides the generic [validate-jwt](validate-jwt-policy.md) policy, or the [validate-azure-ad-token](validate-azure-ad-token-policy.md) policy when using Microsoft Entra ID, to validate the JWT in the incoming requests.
51+
52+
For example, you can use the following policy to validate a Microsoft Entra ID token presented in an incoming request:
2753

2854
```xml
29-
<validate-azure-ad-token header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized. Access token is missing or invalid.">
55+
<validate-azure-ad-token tenant-id="your-tenant-id" header-name="Authorization" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized. Access token is missing or invalid.">
3056
<client-application-ids>
3157
<application-id>your-client-id</application-id>
3258
</client-application-ids>
@@ -41,13 +67,10 @@ For more inbound authorization options and samples, including using OAuth author
4167

4268
* [MCP client authorization lab](https://github.com/Azure-Samples/AI-Gateway/tree/main/labs/mcp-client-authorization)
4369

44-
> [!CAUTION]
45-
> When you use an MCP server in API Management, incoming headers like **Authorization** aren't automatically passed to your backend API. If your backend needs a token, you can add it as an input parameter in your API definition. Alternatively, use policies like `get-authorization-context` and `set-header` to generate and attach the token, as noted in the following section.
46-
4770

48-
### Secure outbound access
71+
## Secure outbound access
4972

50-
You can use API Management's [credential manager](credentials-overview.md) to securely inject secrets or tokens for calls to a backend API. For example, use the credential manager to obtain and present an access token from an identity provider to access the API called by an MCP server tool.
73+
Use API Management's [credential manager](credentials-overview.md) to securely inject secrets or tokens for calls to a backend API. For example, use the credential manager to obtain and present an OAuth 2.0 access token from an identity provider to access the backend API called by an MCP server tool.
5174

5275
At a high level, the process is as follows:
5376

@@ -56,6 +79,22 @@ At a high level, the process is as follows:
5679
1. Configure a connection to the provider in API Management.
5780
1. Configure `get-authorization-context` and `set-header` policies to fetch the token credentials and present them in an **Authorization** header of the API requests.
5881

82+
For example, the following policy retrieves an access token from the credential manager and sets it in the `Authorization` header of the request to the backend API:
83+
84+
```xml
85+
<!-- Add to inbound policy. -->
86+
<get-authorization-context
87+
provider-id="your-credential-provider-id "
88+
authorization-id="auth-01"
89+
context-variable-name="auth-context"
90+
identity-type="managed"
91+
ignore-error="false" />
92+
<!-- Attach the token to the backend call -->
93+
<set-header name="Authorization" exists-action="override">
94+
<value>@("Bearer " + ((Authorization)context.Variables.GetValueOrDefault("auth-context"))?.AccessToken)</value>
95+
</set-header>
96+
```
97+
5998
For a step-by-step guide to call an example backend API using credentials generated in credential manager, see [Configure credential manager - GitHub](credentials-how-to-github.md).
6099

61100
## Related content

0 commit comments

Comments
 (0)