Azure / Azure/azure-sdk-for-python
MCP OAuth credentials persist after agent deletion despite documentation stating agent-scoped credentials
- Lingua principale
- Python
- Stelle
- 5.6k
- Fork
- 3.4k
- Merge medio
- 2g 2h
- PR unite (30g)
- 202
Descrizione
- **Package Name**: azure-ai-agents
- **Package Version**: N/A
- **Operating System**: N/A
- **Python Version**: N/A
**Describe the bug**
OAuth credentials for an MCP tool (GitHub MCP server) persist across agent deletion and recreation, even though documentation states that credentials are scoped to the specific agent. Deleting an agent does not revoke or invalidate previously granted OAuth access, and newly created agents can reuse the same credentials without re-authentication. Is this expected?
**To Reproduce**
1. Create an agent (MyAgent) in Azure AI Foundry Portal.
2. Add a GitHub MCP server configured with OAuth.
3. Invoke the agent and complete GitHub OAuth consent.
4. Verify that the agent can access GitHub resources (e.g., list public repos).
5. Delete the agent.
6. Recreate a new agent:
- Either with the same name (MyAgent) or a different name (myagent2)
- Add the same GitHub MCP server tool.
7. Invoke the agent.
**Expected behavior**
OAuth credentials should be scoped to the specific agent instance.
After deleting the agent:
- OAuth credentials should be revoked or invalidated, or
- Recreating an agent should require the user to re-consent via GitHub OAuth.
This would align with documentation stating credentials are scoped to the “particular agent”.
```
The user's OAuth credentials are stored securely and scoped to the particular user and the particular agent they interacted with. These credentials are generally a refresh token and an access token.
```
Doc link - https://learn.microsoft.com/en-us/azure/ai-foundry/agents/how-to/mcp-authentication?view=foundry
**Actual behavior**
OAuth consent is not re-triggered.
The newly created agent can immediately access GitHub resources.
OAuth credentials appear to be reused across agents.
**Additional context**
The current behavior suggests OAuth credentials are scoped to the user and MCP server (or OAuth client), not to the agent instance. This contradicts the documentation and can cause confusion around security boundaries, agent lifecycle semantics, and expected credential revocation behavior.
**Clarification is needed on:**
- Actual credential scoping model
- Whether agent deletion is expected to revoke MCP OAuth credentials
- How users can explicitly revoke or manage MCP OAuth access, is this at tool connection level?
- Sample code for configuring OAuth using SDK
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia dalla documentazione sull’autenticazione MCP collegata nell’issue e riproduci la sequenza in Azure AI Foundry Portal usando il pacchetto azure-ai-agents. Verifica se le credenziali hanno come ambito l’agente, l’utente o la connessione MCP, e documenta il comportamento confermato relativo all’eliminazione e al nuovo consenso, incluse eventuali indicazioni necessarie per l’esempio dell’SDK.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- azure, python
- Ambito
- authentication, cloud, documentation, security
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 42/100