Azure / Azure/azure-sdk-for-python

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

Abierto
#44,544 2 comentarios 0 reacciones 0 asignados Ver en GitHub
AI Agents customer-reported needs-team-attention question Service Attention
Lenguaje dominante
Python
Estrellas
5.6k
Forks
3.4k
Merge medio
2 d
PR fusionados (30 d)
217

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con la documentación de autenticación de MCP enlazada en el issue y reproduce la secuencia en Azure AI Foundry Portal usando el paquete azure-ai-agents. Determina si las credenciales están asociadas al agente, al usuario o a la conexión MCP, y documenta el comportamiento confirmado de eliminación y de volver a dar consentimiento, incluida cualquier orientación necesaria para el ejemplo del SDK.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
azure, python
Área
authentication, cloud, documentation, security
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Necesita aclaración
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.