You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/api-management/export-rest-mcp-server.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,8 @@ The following limitations currently apply to this preview:
44
44
> [!NOTE]
45
45
> Other API types in API Management that aren't HTTP-compatible can't be exposed as MCP servers.
46
46
47
+
+ If you’ve enabled diagnostic logging via Application Insights or Azure Monitor at the global scope (All APIs) for your API Management service instance, ensure that the **Number of payload bytes to log** setting for Frontend Response is set to 0. This prevents unintended logging of response bodies across all APIs and helps ensure proper functioning of MCP servers. To log payloads selectively for specific APIs, configure the setting individually at the API scope, allowing targeted control over response logging.
48
+
47
49
+ To test the MCP server, you can use Visual Studio Code with access to [GitHub Copilot](https://code.visualstudio.com/docs/copilot/setup).
Copy file name to clipboardExpand all lines: articles/api-management/expose-existing-mcp-server.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,8 @@ The following limitations currently apply to this preview:
56
56
57
57
+ Appropriate credentials to the MCP server (such as OAuth 2.0 client credentials or API keys, depending on the server) for secure access.
58
58
59
+
+ If you’ve enabled diagnostic logging via Application Insights or Azure Monitor at the global scope (All APIs) for your API Management service instance, ensure that the **Number of payload bytes to log** setting for Frontend Response is set to 0. This prevents unintended logging of response bodies across all APIs and helps ensure proper functioning of MCP servers. To log payloads selectively for specific APIs, configure the setting individually at the API scope, allowing targeted control over response logging.
60
+
59
61
+ To test the MCP server, you can use Visual Studio Code with access to [GitHub Copilot](https://code.visualstudio.com/docs/copilot/setup).
Copy file name to clipboardExpand all lines: articles/api-management/mcp-server-overview.md
+6-44Lines changed: 6 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,45 +85,7 @@ Configure policies such as the following::
85
85
86
86
## Secure access to the MCP server
87
87
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).
89
-
90
-
### Secure inbound access
91
-
92
-
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 token in the incoming requests.
93
-
94
-
The following is a basic example of validating a Microsoft Entra ID token presented in an `Authorization` header in the incoming request:
95
-
96
-
```xml
97
-
<validate-azure-ad-tokenheader-name="Authorization"failed-validation-httpcode="401"failed-validation-error-message="Unauthorized. Access token is missing or invalid.">
98
-
<client-application-ids>
99
-
<application-id>your-client-id</application-id>
100
-
</client-application-ids>
101
-
</validate-azure-ad-token>
102
-
```
103
-
104
-
For more inbound authorization options and samples, including using OAuth authorization, see:
105
-
106
-
*[MCP server authorization with Protected Resource Metadata (PRM) sample](https://github.com/blackchoey/remote-mcp-apim-oauth-prm)
107
-
108
-
*[Secure Remote MCP Servers using Azure API Management (Experimental)](https://github.com/Azure-Samples/remote-mcp-apim-functions-python)
> 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.
114
-
115
-
116
-
### Secure outbound access
117
-
118
-
You can use API Management's [credential manager](credentials-overview.md) to securely inject secrets or tokens for calls to a backend API. At a high level, the process is as follows:
119
-
120
-
1. Register an application in a supported identity provider.
121
-
1. Create a credential provider resource in API Management to manage the credentials from the identity provider.
122
-
1. Configure a connection to the provider in API Management.
123
-
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.
124
-
125
-
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).
126
-
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).
127
89
128
90
## Monitoring
129
91
@@ -147,16 +109,14 @@ Use [Azure API Center](../api-center/register-discover-mcp-server.md) to registe
147
109
148
110
## Availability
149
111
150
-
<!-- availability in workspaces?-->
151
-
152
-
153
112
MCP servers in API Management are available in the following service tiers:
154
113
155
114
***Classic tiers**: Basic, Standard, Premium
156
115
***v2 tiers**: Basic v2, Standard v2, Premium v2
157
116
158
117
> [!NOTE]
159
-
> 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.
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.
119
+
> * MCP servers aren't currently supported in [workspaces](workspaces-overview.md).
160
120
161
121
## Related content
162
122
@@ -168,4 +128,6 @@ MCP servers in API Management are available in the following service tiers:
168
128
169
129
*[Expose REST API in API Management as an MCP server](export-rest-mcp-server.md)
170
130
171
-
*[Expose and govern existing MCP server](expose-existing-mcp-server.md)
131
+
*[Expose and govern existing MCP server](expose-existing-mcp-server.md)
132
+
133
+
*[Secure access to MCP servers](secure-mcp-servers.md)
With [MCP server support in API Management](mcp-server-overview.md), you can expose and govern access to MCP servers and their tools. This article describes how to secure access to MCP servers managed in API Management, including both MCP servers exposed from managed REST APIs and existing MCP servers hosted outside of API Management.
19
+
20
+
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).
21
+
22
+
### Secure inbound access
23
+
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.
25
+
26
+
The following is a basic example of validating a Microsoft Entra ID token presented in an `Authorization` header in the incoming request:
27
+
28
+
```xml
29
+
<validate-azure-ad-tokenheader-name="Authorization"failed-validation-httpcode="401"failed-validation-error-message="Unauthorized. Access token is missing or invalid.">
30
+
<client-application-ids>
31
+
<application-id>your-client-id</application-id>
32
+
</client-application-ids>
33
+
</validate-azure-ad-token>
34
+
```
35
+
36
+
For more inbound authorization options and samples, including using OAuth authorization, see:
37
+
38
+
*[MCP server authorization with Protected Resource Metadata (PRM) sample](https://github.com/blackchoey/remote-mcp-apim-oauth-prm)
39
+
40
+
*[Secure Remote MCP Servers using Azure API Management (Experimental)](https://github.com/Azure-Samples/remote-mcp-apim-functions-python)
> 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
+
47
+
48
+
### Secure outbound access
49
+
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.
51
+
52
+
At a high level, the process is as follows:
53
+
54
+
1. Register an application in a supported identity provider.
55
+
1. Create a credential provider resource in API Management to manage the credentials from the identity provider.
56
+
1. Configure a connection to the provider in API Management.
57
+
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.
58
+
59
+
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).
60
+
61
+
## Related content
62
+
63
+
64
+
*[Register and discover remote MCP servers in Azure API Center](../api-center/register-discover-mcp-server.md)
65
+
66
+
*[Expose REST API in API Management as an MCP server](export-rest-mcp-server.md)
67
+
68
+
*[Expose and govern existing MCP server](expose-existing-mcp-server.md)
Copy file name to clipboardExpand all lines: includes/api-management-configure-test-mcp-server.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,9 @@ Learn more about configuring policies:
15
15
*[Transform and protect your API](../articles/api-management/transform-api.md)
16
16
*[Set and edit policies](../articles/api-management/set-edit-policies.md)
17
17
18
+
> [!IMPORTANT]
19
+
> Do not access the response body using `context.Response.Body` within MCP server policies. Doing so triggers response buffering, which interferes with the streaming behavior required by MCP servers and may cause them to malfunction.
20
+
18
21
To configure policies for the MCP server:
19
22
20
23
1. In the [Azure portal](https://portal.azure.com), navigate to your API Management instance.
@@ -86,6 +89,7 @@ After adding an MCP server in Visual Studio Code, you can use tools in agent mod
86
89
| `401 Unauthorized` error from backend | Authorization header not forwarded | Use `set-header` policy to manually attach token |
87
90
| API call works in API Management but fails in agent | Incorrect base URL or missing token | Double-check security policies and endpoint |
88
91
| Not able to create MCP server | MCP server capability is not available in Consumption or Developer tier, and must be enabled using [update group](../articles/api-management/configure-service-update-settings.md) in classic Basic, Standard, and Premium tiers | Use a supported classic or v2 tier - see [Prerequisites](#prerequisites) |
0 commit comments