Azure / Azure/api-center

Azure API Center APIM sync imports APIM MCP API with runtime URI `/mcp/messages` instead of the streamable MCP endpoint `/mcp`

Open
#77 0 comments 0 reactions 0 assignees View on GitHub
Bug Investigating
Dominant language
PowerShell
Stars
45
Forks
21
Avg merge
21m
Merged PRs (30d)
1

Description

## Description

We are using Azure API Management (APIM) to expose a REST API as a Model Context Protocol (MCP) server, then syncing APIM into Azure API Center using an API Center `apiSources` APIM sync.

The APIM-hosted MCP server is reachable by clients at the expected streamable MCP endpoint:

```text
https://.azure-api.net/petstore-api-mcp/mcp
```

However, the Azure API Center APIM sync imports the MCP API deployment runtime URI as:

```text
https://.azure-api.net/petstore-api-mcp/mcp/messages
```

This appears to be incorrect for streamable HTTP MCP clients. Azure AI Foundry / Foundry private tool catalog does not show or cannot use the synced MCP server when the runtime URI is `/mcp/messages`. If we create an equivalent API Center MCP record manually or via Bicep with runtime URI `/mcp`, Foundry can see and use it correctly.

## API Versions Used

- APIM MCP API resource: `Microsoft.ApiManagement/service/apis@2025-09-01-preview`
- API Center resources and APIM sync source: `Microsoft.ApiCenter/*@2024-06-01-preview`

## Expected Behavior

When Azure API Center APIM sync imports an APIM MCP API using streamable HTTP transport, the API Center deployment runtime URI should be the client-facing MCP endpoint:

```text
https://.azure-api.net/petstore-api-mcp/mcp
```

This is the endpoint that MCP clients and Azure AI Foundry should use for the MCP server.

## Actual Behavior

Azure API Center APIM sync creates a synced API Center MCP API record with runtime URI:

```text
https://.azure-api.net/petstore-api-mcp/mcp/messages
```

This appears to copy the APIM internal MCP `message` endpoint metadata into API Center as the deployment runtime URI. For streamable MCP, `/mcp/messages` is not the correct base MCP server endpoint for client discovery and tool invocation.

## Impact

- Azure AI Foundry / Foundry private tool catalog does not show or cannot use the APIM-synced MCP server.
- The same APIM MCP server works when registered in API Center with runtime URI `/mcp`.
- Native APIM-to-API Center sync cannot currently be relied on for Foundry-consumable MCP server registration.
- The current workaround creates a duplicate API Center MCP API record outside the native sync-managed record.

## Steps to Reproduce

1. Create or use an APIM REST API, for example `petstore-api`.
2. Create an APIM MCP API from the REST API, for example `petstore-api-mcp`, using preview APIM MCP API support.
3. Confirm the APIM MCP client endpoint is available at:

```text
https://.azure-api.net//mcp
```

4. Create an Azure API Center instance and workspace.
5. Create an API Center environment, for example `apim-production`.
6. Assign the API Center managed identity reader access to APIM.
7. Create an API Center APIM sync source using `Microsoft.ApiCenter/services/workspaces/apiSources@2024-06-01-preview`, similar to:

```bicep
resource apiCenterApimApiSource 'Microsoft.ApiCenter/services/workspaces/apiSources@2024-06-01-preview' = {
parent: apiCenterWorkspace
name: 'apim-sync'
properties: {
azureApiManagementSource: {
resourceId: apim.id
msiResourceId: '${tenant().tenantId}/${apiCenter.identity.principalId}/systemAssigned'
}
targetEnvironmentId: '/workspaces/${apiCenterWorkspace.name}/environments/${apiCenterApimEnvironment.name}'
targetLifecycleStage: 'production'
importSpecification: 'always'
}
}
```

8. Wait for API Center sync to import APIM APIs.
9. Inspect the synced API Center MCP API deployment runtime URI.
10. Observe that the synced API Center MCP API deployment uses `/mcp/messages` instead of `/mcp`.

The suspected issue is that Azure API Center sync is using `mcpProperties.endpoints.message.uriTemplate` as the API Center deployment runtime URI. For streamable MCP clients and Foundry integration, the expected runtime URI is the base MCP endpoint `/mcp`, not `/mcp/messages`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.