Azure / Azure/azure-sdk-for-python

[BUG] Foundry Hosted Agent cannot use Agent 365 MCP tools through UserEntraToken

Aperta
#48,264 2 commenti 1 reazione 0 assegnatari Vedi su GitHub
Client customer-reported Hosted Agents needs-team-attention question Service Attention
Lingua principale
Python
Stelle
5.6k
Fork
3.4k
Merge medio
2g 2h
PR unite (30g)
213

Descrizione

- **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**

1. Use a Frontier tenant and create an Agent 365 digital worker hosted in Microsoft Foundry with `ActivityAgentServerHost(digital_worker=True)`.
2. Grant the agent registration an Agent 365 Tools delegated permission such as `McpServers.Mail.All`, then grant tenant admin consent.
3. 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.
4. Deploy the Python Hosted Agent and authenticate the toolbox request as its Agent 365 agentic user.
5. Initialize the toolbox or invoke `tools/list`.
6. Observe `-32007` / `CONNECTION_FAILED` for the Agent 365 connection and failure to load every tool in the toolbox.
7. As a control, remove the Agent 365 connection from the toolbox. The remaining toolbox tools load successfully.
8. 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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia tracciando ActivityAgentServerHost(digital_worker=True) e i percorsi azure-ai-agentserver-activity e azure-ai-agentserver-core utilizzati per inizializzare la Foundry Toolbox con versione e gestire tools/list. Confronta questo flusso con la chiamata MCP diretta get_agentic_user_token funzionante; il lavoro è completato quando le connessioni Agent 365 UserEntraToken vengono enumerate e invocate correttamente senza rendere indisponibili gli strumenti Toolbox non correlati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
azure, python
Ambito
api, authentication, cloud
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.