An Azure service that provides a hybrid, multi-cloud management platform for APIs.
APIM REST API exposed as MCP sends raw string body instead of JSON object for POST operation
I am using Azure API Management's Expose REST API as MCP server feature.
I have a REST API imported into APIM with a POST operation that expects a JSON request body like this:
{
"query": "sample search text"
}
The REST API operation works correctly when called directly, and it also works from the APIM Test console.
However, when I expose the same REST API operation as an MCP tool through APIM and call it from an MCP client, the backend appears to receive the body as a raw string:
sample search text
Instead of the expected JSON object:
{
"query": "sample search text"
}
Because of that, the backend rejects the request with a JSON parsing or validation error.
From APIM telemetry, the request appears to go through the generated MCP endpoint, and the MCP tool call seems to pass the value correctly. However, APIM forwards only the string value to the REST backend instead of wrapping it in the original JSON body shape.
Questions
- Is this expected behavior for APIM's Expose REST API as MCP server feature when the POST request body contains a single string property?
- Is there a supported way to force the APIM-generated MCP tool to send the original JSON object body?
- Should the generated MCP tool input schema be an object with a
queryproperty, or a primitive string? - Are request-body transformation policies supported for REST APIs exposed as MCP tools? If yes, should those policies be applied at the MCP server level or at the underlying REST API operation level?
- Is this a known limitation or regression in APIM REST-to-MCP request body mapping?
Environment Summary
Feature: Azure API Management - Expose REST API as MCP server
MCP endpoint: /<mcp-server-name>/mcp
Backend: HTTP REST API
Expected backend body: application/json object
Actual backend body from MCP call: raw string
Direct REST API call: works
APIM REST Test console: works
MCP tool call: fails with backend JSON validation error
Transport tested: Streamable HTTP and SSE
Is there any recommended schema design or APIM configuration to preserve the original JSON object body when exposing REST operations as MCP tools?