Azure / Azure/azure-sdk-for-python
MCP OAuth credentials persist after agent deletion despite documentation stating agent-scoped credentials
- 主要言語
- Python
- スター
- 5.6k
- フォーク
- 3.4k
- 平均マージ
- 2日
- マージ済み PR(30日)
- 217
説明
- **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
コントリビューションガイド
調査の方向性
Issue にリンクされている MCP 認証ドキュメントから始め、azure-ai-agents パッケージを使用して Azure AI Foundry Portal でその手順を再現します。資格情報のスコープがエージェント、ユーザー、MCP 接続のいずれに設定されているかを追跡し、削除と再同意に関して確認できた動作を、必要な SDK サンプルのガイダンスも含めて記録します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- azure, python
- 領域
- authentication, cloud, documentation, security
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 42/100