Skip to content

Python: Fix ambiguous MCP configuration name matching - #8386

Merged
Evan Mattson (moonbox3) merged 5 commits into
microsoft:mainfrom
eavanvalkenburg:mcp-policy-name-matching
Sep 16, 2026
Merged

Evan Mattson (moonbox3) merged 5 commits into
microsoft:mainfrom
eavanvalkenburg:mcp-policy-name-matching

Conversation

@eavanvalkenburg

@eavanvalkenburg Eduard van Valkenburg (eavanvalkenburg) commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Motivation & Context

Fix MCP allowlist and approval name matching so each configured name identifies at most one raw remote tool. Preserve existing support for unambiguous prefixed names and keep discovery updates consistent across pagination and refresh.

Description & Review Guide

  • What are the major changes? Add shared validation for configured allowlist and approval names. Stage tool and prompt discovery across all pages before publishing new functions. Revalidate configuration when exposing functions, including progressive discovery. Add regression coverage for ordering, pagination, refresh, approval modes, and compatibility.
  • What is the impact of these changes? Configuration names that match multiple raw remote names now raise ToolExecutionException. Applications using those names must select an unambiguous name or a different tool_name_prefix. Raw names, unambiguous prefixed aliases, normalized-only approval nonmatching, and empty/unset allowlist behavior remain unchanged. Failed discovery refreshes retain the previous functions and metadata.
  • What do you want reviewers to focus on? The compatibility boundary for configured names and the publication of discovery results only after validation.

Related Issue

N/A. No matching open issue or overlapping open PR was found.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible — MCP unit suites pass; the full repository suite has not been run.
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1f64c925-132e-4d46-865d-d5c05e218074
Copilot AI balanced review requested due to automatic review settings September 15, 2026 09:46
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible labels Sep 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The breaking configuration contract and discovery changes require final human review.

Pull request overview

This breaking Python change makes MCP allowlist and approval names unambiguous while improving discovery refresh safety.

Changes:

  • Validates configured names across tools and prompts.
  • Stages paginated discovery before publishing results.
  • Adds regression tests and documents the updated contract.
File summaries
File Summary
python/packages/core/tests/core/test_mcp.py Adds coverage for ambiguity, pagination, refresh, and progressive discovery.
python/packages/core/AGENTS.md Documents the updated MCP configuration behavior.
python/packages/core/agent_framework/_mcp.py Implements validation and staged discovery publication.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite (auto)

Note

Copilot is running an experiment and ran this review at Lite.


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (1 commit(s)): 1cbfc5b2dadb
Model: gpt-5.6-sol-fast

Overview

The change centralizes MCP configuration-name validation and stages paginated discovery before publishing functions or metadata, with broad coverage for ambiguity, ordering, progressive disclosure, and failed reload preservation. Those guardrails correctly prevent partial publication, but validation currently combines a refreshed server snapshot with stale functions from the prior snapshot. As a result, a legitimate remote tool rename can make refresh fail and leave only an obsolete wrapper available.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.

Affected areas: python/packages/core/agent_framework/_mcp.py

@eavanvalkenburg
Eduard van Valkenburg (eavanvalkenburg) marked this pull request as ready for review September 15, 2026 10:00
@eavanvalkenburg Eduard van Valkenburg (eavanvalkenburg) changed the title [BREAKING] Python: Require unambiguous MCP configuration names Python: Fix ambiguous MCP configuration name matching Sep 15, 2026
@eavanvalkenburg Eduard van Valkenburg (eavanvalkenburg) added bug Usage: [Issues], Target: all issues (Legacy, prefer issue type: bug) and removed breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible labels Sep 15, 2026
@moonbox3
Evan Mattson (moonbox3) added this pull request to the merge queue Sep 16, 2026
Merged via the queue into microsoft:main with commit d99aa4d Sep 16, 2026
42 checks passed

This branch was previously deployed

1 inactive deployment
github-app-auth — 1a40f4fb Deployed Sep 15, 2026 by eavanvalkenburg via add_label #22919
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Usage: [Issues], Target: all issues (Legacy, prefer issue type: bug) documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants