Hi Arjun Thakur ,
Thanks for the question.
rewrite-uri is not applied in MCP Server APIs MCP Server operations in Azure API Management do not use the standard API pipeline when constructing backend URLs. The backend call is generated from the operation’s original path template and backend base URL, not from the rewritten URI produced by inbound policies. Therefore, rewrite-uri executes but is not used when MCP constructs the backend request. Reference: API Management policy execution flow https://dori-uw-1.kuma-moon.com/azure/api-management/api-management-policies#policy-execution
Why the backend URL must carry the version prefix Because MCP bypasses inbound path rewrites, the version segment (/v1) must be added using backend-level policies such as set-backend-service or by modifying the backend service-base-url. These policies influence the backend target before MCP generates the request, which makes them effective for MCP tools. Reference: set-backend-service policy https://dori-uw-1.kuma-moon.com/azure/api-management/set-backend-service-policy
Supported approach today Update the backend base URL so that the MCP request is formed correctly:
Example:
<backend>
<service-base-url>
https://backend-service/internal/@{context.Request.MatchedParameters.resource}/v1
</service-base-url>
</backend>
This ensures the effective backend call becomes: https://backend-service/internal//v1/api/
Current limitation MCP Server currently does not support path rewriting via rewrite-uri for backend URL construction. Only backend base URL overrides are honored in MCP tool execution paths. This behavior is consistent with the MCP request flow described in API Management documentation. Reference: API Management overview of request processing https://dori-uw-1.kuma-moon.com/azure/api-management/api-management-howto-policies#how-policies-are-applied
I hope this helps. If the answer is useful, you may accept it to close the thread.