- Package Name:
azure-ai-agentserver-activity, azure-ai-agentserver-core
- Package Version:
azure-ai-agentserver-activity==1.0.0b1, azure-ai-agentserver-core==2.0.0b8
- Operating System: Linux container in Microsoft Foundry Hosted Agent
- Python Version: 3.13
Describe the bug
A Python Foundry Hosted Agent configured as an Agent 365 digital worker cannot initialize a versioned Foundry Toolbox when the toolbox contains Agent 365 MCP connections that use UserEntraToken / OAuth identity passthrough.
The hosted agent and agentic user can authenticate to the toolbox endpoint, but tools/list fails for the Agent 365 MCP connections with JSON-RPC error -32007 / CONNECTION_FAILED. Toolbox enumeration is all-or-nothing, so unrelated tools in the same toolbox also become unavailable.
The Agent 365 agentic identity itself is valid. From the same hosted runtime, obtaining a downstream token through get_agentic_user_token for a scope such as ea9ffc3e-8a23-4a7d-836d-234d7c7565c1/McpServers.Mail.All and calling the Agent 365 MCP server directly succeeds.
To Reproduce
- Use a Frontier tenant and create an Agent 365 digital worker hosted in Microsoft Foundry with
ActivityAgentServerHost(digital_worker=True).
- Grant the agent registration an Agent 365 Tools delegated permission such as
McpServers.Mail.All, then grant tenant admin consent.
- Create a versioned Foundry Toolbox containing:
- One tool that does not require user identity passthrough.
- An Agent 365 MCP connection, such as the Outlook Mail MCP server, configured with
UserEntraToken / OAuth identity passthrough.
- Deploy the Python Hosted Agent and authenticate the toolbox request as its Agent 365 agentic user.
- Initialize the toolbox or invoke
tools/list.
- Observe
-32007 / CONNECTION_FAILED for the Agent 365 connection and failure to load every tool in the toolbox.
- As a control, remove the Agent 365 connection from the toolbox. The remaining toolbox tools load successfully.
- As a second control, obtain the scoped token with the Agent 365 connection's
get_agentic_user_token method and call https://agent365.svc.cloud.microsoft/agents/servers/mcp_MailTools directly. tools/list succeeds.
Expected behavior
Foundry Toolbox should support Agent 365 agentic-user token acquisition for Agent 365 MCP connections, or surface the OAuth consent/authentication flow required to complete it. A valid agentic identity with the required delegated scope and admin consent should be able to discover and invoke the MCP tools from a Hosted Agent.
Additional context
The current workaround is to keep Agent 365 MCP connections out of the Foundry Toolbox and register each MCP server directly in the hosted application, using get_agentic_user_token for its required McpServers.*.All scope.
This appears specific to the Hosted Agent and Toolbox identity-passthrough path rather than the Agent 365 MCP servers or agentic identity, because the direct scoped-token path works from the same runtime.
Relevant documentation: https://learn.microsoft.com/en-us/azure/foundry/agents/how-to/mcp-authentication
azure-ai-agentserver-activity,azure-ai-agentserver-coreazure-ai-agentserver-activity==1.0.0b1,azure-ai-agentserver-core==2.0.0b8Describe the bug
A Python Foundry Hosted Agent configured as an Agent 365 digital worker cannot initialize a versioned Foundry Toolbox when the toolbox contains Agent 365 MCP connections that use
UserEntraToken/ OAuth identity passthrough.The hosted agent and agentic user can authenticate to the toolbox endpoint, but
tools/listfails for the Agent 365 MCP connections with JSON-RPC error-32007/CONNECTION_FAILED. Toolbox enumeration is all-or-nothing, so unrelated tools in the same toolbox also become unavailable.The Agent 365 agentic identity itself is valid. From the same hosted runtime, obtaining a downstream token through
get_agentic_user_tokenfor a scope such asea9ffc3e-8a23-4a7d-836d-234d7c7565c1/McpServers.Mail.Alland calling the Agent 365 MCP server directly succeeds.To Reproduce
ActivityAgentServerHost(digital_worker=True).McpServers.Mail.All, then grant tenant admin consent.UserEntraToken/ OAuth identity passthrough.tools/list.-32007/CONNECTION_FAILEDfor the Agent 365 connection and failure to load every tool in the toolbox.get_agentic_user_tokenmethod and callhttps://agent365.svc.cloud.microsoft/agents/servers/mcp_MailToolsdirectly.tools/listsucceeds.Expected behavior
Foundry Toolbox should support Agent 365 agentic-user token acquisition for Agent 365 MCP connections, or surface the OAuth consent/authentication flow required to complete it. A valid agentic identity with the required delegated scope and admin consent should be able to discover and invoke the MCP tools from a Hosted Agent.
Additional context
The current workaround is to keep Agent 365 MCP connections out of the Foundry Toolbox and register each MCP server directly in the hosted application, using
get_agentic_user_tokenfor its requiredMcpServers.*.Allscope.This appears specific to the Hosted Agent and Toolbox identity-passthrough path rather than the Agent 365 MCP servers or agentic identity, because the direct scoped-token path works from the same runtime.
Relevant documentation: https://learn.microsoft.com/en-us/azure/foundry/agents/how-to/mcp-authentication