Skip to content

Python: Bound MCP Skills catalog paging and support dynamic skill manifests - #10595

Draft
Jose Alvarez (jpalvarezl) wants to merge 3 commits into
jpalvarezl/mcp-skills/02-listed-skill-runtimefrom
jpalvarezl-mcp-skills/03-catalog-paging
Draft

Jose Alvarez (jpalvarezl) wants to merge 3 commits into
jpalvarezl/mcp-skills/02-listed-skill-runtimefrom
jpalvarezl-mcp-skills/03-catalog-paging

Conversation

@jpalvarezl

@jpalvarezl Jose Alvarez (jpalvarezl) commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Motivation & Context

Layer 3 of the Python MCP Skills stack (#10570). Typed discovery should use the MCP SDK's SkillsClient rather than hand-written request loops, and the published catalog should stay bounded. Skills with dynamic manifests (resources: "dynamic") were skipped in #10569; this layer makes them usable, matching .NET.

Depends on #10568 and #10569.

Description & Review Guide

  • What are the major changes?
    • MCPSkillsSource gets the typed catalog from the SDK's SkillsClient.list_skills(), which follows every page, detects repeated cursors and keeps the first copy of a duplicate URI. Then max_discovery_items (default 1,000; None disables) caps what is published: entries beyond it are dropped with a warning. The cap protects model context; it doesn't limit network traffic, because the SDK fetches the whole catalog.
    • A discovery error never yields a partial catalog: the SDK returns the full catalog or raises.
    • Dynamic-manifest skills are accepted without requiring directoryRead. Like .NET, a dynamic skill reads the requested relative path inside its skill folder only when asked; unsafe paths (.., absolute paths, URLs) are rejected without a server request. MAF does not walk directories with resources/directory/read. Static-manifest skills still only read exact manifest URIs.
    • Response validation and size limits for supporting resources are deferred to the later content-verification layer, which covers all listed skills.
    • No catalog caching is added; callers can keep wrapping the source in CachingSkillsSource.
  • What is the impact of these changes? SDK-based, atomic typed discovery with a bounded published catalog, and support for dynamic-manifest skills. Listed skills remain bound to the Client they were discovered on; rediscover after reconnecting.
  • What do you want reviewers to focus on? The truncating item cap and on-demand dynamic resource reads.

Note: committed with --no-verify because the pre-commit format hook reformats unrelated pre-existing code in _mcp.py and security.py (existing formatting drift upstream). Those edits are intentionally excluded and will come in with a rebase onto the upstream fix.

Related Issue

Part of #9582

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details: implementation, tests, and this PR description.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • 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.

@github-actions github-actions Bot added the python Usage: [Issues, PRs], Target: Python label Dec 4, 2026
@github-code-quality

github-code-quality Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage overview

Languages: Python

Python / code-coverage/python

jpalvarezl/mcp-skill... 0cb0614 jpalvarezl-mcp-skill... 7670ba6 +/-
92% 92% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated December 04, 2026 15:06 UTC

…resources

Page skills/list manually with page, entry, and repeated-cursor bounds; publish the catalog only after all pages succeed. Accept skills with dynamic manifests when the server supports directory reads, restricting supporting reads to discovered URIs.
@jpalvarezl
Jose Alvarez (jpalvarezl) force-pushed the jpalvarezl-mcp-skills/03-catalog-paging branch from 61f96c7 to fa47968 Compare December 4, 2026 09:08
Copilot AI balanced review requested due to automatic review settings December 4, 2026 09:08

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.

🟡 Changes recommended

Authorization-critical directory traversal lacks tests for pagination, traversal limits, and failure recovery, including verification that failed discovery retains no partial allow-list and triggers no premature resource reads.

1 open issue
What changed in this PR

Extends Python MCP Skills support with bounded catalog discovery and dynamic-manifest resources, building on the earlier discovery implementation.

Changes:

  • Adds catalog limits, cursor checks, duplicate handling, and all-or-nothing publication.
  • Builds lazy, bounded resource allow-lists for dynamic manifests when directoryRead is advertised.
  • Adds tests for catalog pagination, failures, and dynamic resource access.
File Description
python/​packages/​core/​tests/​core/​test_mcp_skills.py Tests bounded discovery and dynamic manifests.
python/​packages/​core/​agent_framework/​_skills.py Implements catalog limits and dynamic-resource authorization.

Review effort: Balanced

seen_cursors.add(next_cursor)
cursor = next_cursor

self._resource_uris = frozenset(allowed_uris)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants