Azure / Azure/azure-sdk-for-python

MCP OAuth credentials persist after agent deletion despite documentation stating agent-scoped credentials

Ouverte
#44,544 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
AI Agents customer-reported needs-team-attention question Service Attention
Langage dominant
Python
Étoiles
5.6k
Forks
3.4k
Merge moyen
2 j 2 h
PR mergées (30 j)
213

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par la documentation sur l’authentification MCP liée dans l’issue et reproduisez la séquence dans Azure AI Foundry Portal à l’aide du package azure-ai-agents. Déterminez si les identifiants sont associés à l’agent, à l’utilisateur ou à la connexion MCP, et documentez le comportement confirmé lors de la suppression et de la nouvelle demande de consentement, y compris toute indication nécessaire pour l’exemple du SDK.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
azure, python
Domaine
authentication, cloud, documentation, security
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Calme
Clarté
À clarifier
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.