Foundry Portal strips query parameters from MCP endpoint URL during tool enumeration, causing 406 NotAcceptable error #382
Unanswered
shweta0310
asked this question in
Get Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
When adding an MCP (Model Context Protocol) tool to an agent via the Foundry portal, the portal fails to list tools from an Azure AI Search Knowledge Base MCP endpoint. The portal strips the required
?api-version=query parameter from the endpoint URL when probing the server, causing a 406 NotAcceptable error.The MCP connection is saved correctly, but the MCP tool is never attached to the agent because the portal blocks on the tool enumeration failure.
Workaround: Adding the MCP tool directly to the agent definition via the Foundry Agent REST API works — the tool functions correctly at runtime.
Steps to Reproduce
src-supplier-kb-mcphttps://<search-service>.search.windows.net/knowledgebases/<kb-name>/mcp?api-version=2025-11-01-PreviewMicrosoft EntraProject Managed Identityhttps://search.azure.comExpected Behavior
The portal should call the MCP endpoint with the full URL including query parameters to enumerate available tools (e.g.,
knowledge_base_retrieve), then attach the MCP tool to the agent definition.Actual Behavior
The portal strips the
?api-version=2025-11-01-Previewquery parameter and calls:Azure AI Search requires the
api-versionparameter on all requests and returns 406 NotAcceptable without it.The error displayed in the portal:
However, the portal does successfully create the project connection (verified via Management API — see below). It just fails to proceed to the tool-binding step.
Workaround — REST API
The MCP tool can be successfully added by POSTing a new agent version directly via the Foundry Agent REST API:
{ "definition": { "kind": "prompt", "model": "gpt-4.1", "instructions": "<existing instructions>", "tools": [ { "type": "file_search", "vector_store_ids": ["<existing-vector-store-id>"] }, { "type": "mcp", "server_label": "src-supplier-kb-mcp", "server_url": "https://<search-service>.search.windows.net/knowledgebases/<kb-name>/mcp?api-version=2025-11-01-Preview", "require_approval": "never", "allowed_tools": ["knowledge_base_retrieve"] } ] } }This returns 200 OK and creates a new agent version with the MCP tool attached. At runtime, the agent successfully calls
knowledge_base_retrieveMCP tool because the full URL (with query parameter) is preserved.Verification — Connection is created correctly by portal
Listing project connections via Management API confirms the portal creates the connection with the correct URL:
Response shows:
The connection URL is correct — the query parameter is only stripped during the tool enumeration probe.
Environment
2025-11-01-Preview, Knowledge Base with MCP endpointv1Root Cause Analysis
Microsoft Foundry Portal's MCP tool dialog appears to parse the endpoint URL and strip query parameters before making the tool enumeration call. Azure AI Search requires
api-versionon all API calls — without it, the service returns 406 NotAcceptable.The issue is specifically in the portal's enumeration/probe logic, not in the connection creation or the agent runtime. The runtime correctly uses the full URL.
Impact
Suggested Fix
Preserve the full URL (including all query parameters) when the Foundry Portal calls the MCP endpoint for tool enumeration. The
server_urlshould be used as-is without modification, like removal of query-parameters from the URL.Additional Context
Beta Was this translation helpful? Give feedback.
All reactions