Skip to content

Python: Verify MCP Skills resource content - #10597

Draft
Jose Alvarez (jpalvarezl) wants to merge 1 commit into
jpalvarezl-mcp-skills/03-catalog-pagingfrom
jpalvarezl-mcp-skills-content-verification
Draft

Jose Alvarez (jpalvarezl) wants to merge 1 commit into
jpalvarezl-mcp-skills/03-catalog-pagingfrom
jpalvarezl-mcp-skills-content-verification

Conversation

@jpalvarezl

Copy link
Copy Markdown
Member

Motivation & Context

MCP Skills discovery needs to verify the server-provided resources before exposing them to an agent. This layer builds on the opt-in SDK integration, listed-skill runtime, and bounded catalog discovery in the earlier stack layers.

Description & Review Guide

  • What are the major changes? Verify extension-listed resource URIs and single text/binary content blocks; enforce per-skill resource and byte budgets; verify declared sizes and SHA-256 digests; and compare the complete SKILL.md frontmatter with the listed descriptor, including URI aliases. Dynamic manifests use synchronized accounting, and failed verification does not publish verified content or consume the budget. Add regression tests and update core guidance.

  • What is the impact of these changes? Extension-listed skills default to 512 resources and 16 MiB per skill, including SKILL.md; callers may override these positive limits. Limits apply after the SDK receives each response, not at the transport boundary. Verification failures propagate rather than falling back to the legacy index. Legacy index and archive behavior is unchanged. Listed skills remain bound to their originating client, cached responses are revalidated, private cache isolation is preserved, and server-provided allowed-tools does not grant permissions. A matching digest verifies consistency, not server trust.

    With an existing connected client, the prior call remains valid with the new defaults; callers can instead set tighter limits:

    from agent_framework import MCPSkillsSource
    
    # Before, and after with the new defaults:
    source = MCPSkillsSource(client=client)
    
    # After, with explicit limits:
    source = MCPSkillsSource(client=client, max_skill_resources=128, max_skill_size_bytes=8 * 1024 * 1024)

    The agreed approach is extension-only verification with configurable resource limits. From python\, these targeted checks passed:

    uv run --no-sync pytest 'packages\core\tests\core\test_mcp_skills.py' 'packages\core\tests\core\test_skills.py' -q --tb=short  # passed; 15 skipped
    uvx ruff@0.17.5 check --no-fix 'packages\core\agent_framework\_skills.py' 'packages\core\tests\core\test_mcp_skills.py'  # passed
    uvx ruff@0.17.5 format --check 'packages\core\agent_framework\_skills.py' 'packages\core\tests\core\test_mcp_skills.py'  # passed
    uv tool run pyright --pythonpath '.venv\Scripts\python.exe' 'packages\core\agent_framework\_skills.py'  # passed
    uv tool run pyright --pythonpath '.venv\Scripts\python.exe' -p 'pyrightconfig.tests.json' 'packages\core\tests\core\test_mcp_skills.py'  # passed

    A full build and the complete unit-test suite were not run. The commit used --no-verify because the existing poe-check hook reformats unrelated lines in _mcp.py and security.py; the changed Python files were checked separately with Ruff.

  • What do you want reviewers to focus on? The frontmatter comparison, alias handling, resource accounting under concurrent reads, and revalidation of cached responses.

Related Issue

Fixes #9582

This is layer 4 of a dependent stack, not a competing implementation: SDK foundation, listed-skill runtime, and catalog paging are the preceding layers. The issue currently has neither a ready-for-implementation label nor an on-issue maintainer agreement comment.

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: Copilot assisted with implementation, tests, documentation, and this description. Human review and acceptance have not yet been confirmed for this draft.

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-code-quality

Copy link
Copy Markdown
Contributor

Code coverage overview

Languages: Python

Python / code-coverage/python

jpalvarezl-mcp-skill... a519cb2 jpalvarezl-mcp-skill... aa688d7 +/-
92% 92% 0%
View coverage of the 2 most impacted files.
File jpalvarezl-mcp-skill... a519cb2 jpalvarezl-mcp-skill... aa688d7 +/-
packages/core/a...work/_skills.py 96% 95% -1%
packages/core/a...amework/_mcp.py 92% 92% 0%

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

@github-actions github-actions Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python labels Dec 4, 2026

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

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.

Python: [Feature]: Support the released MCP Skills extension in MCPSkillsSource

1 participant