[Schema][Server] Add Skills extension (io.modelcontextprotocol/skills) support#372
Draft
wachterjohannes wants to merge 1 commit into
Draft
Conversation
…) support
Implement the MCP Skills extension (SEP-2640): serve skills — multi-step
workflow instructions — through the existing Resources primitive with zero
protocol changes, mirroring the MCP Apps extension pattern.
- Add McpSkills extension marker and discovery/metadata DTOs
(SkillType, SkillDiscoveryEntry, SkillDiscoveryIndex, SkillMetadata).
- Add FrontmatterParser and SkillProvider to expose a directory of skills as
skill:// resources, deriving name/description from SKILL.md frontmatter,
enforcing the name<->final-path-segment rule, and serving skill://index.json.
- Add Builder::addSkillsFromDirectory() convenience that auto-enables the
extension.
- Fix ServerCapabilities::jsonSerialize() so an empty extension payload
serializes to {} instead of [].
- Add symfony/yaml dependency for frontmatter parsing.
- Add example server, unit tests, and inspector snapshot tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the MCP Skills extension (SEP-2640): a way for servers to ship skills — multi-step workflow instructions that tell an agent how to orchestrate tools to reach a goal. Skills are served through the existing Resources primitive with zero protocol changes, mirroring the existing MCP Apps extension (
io.modelcontextprotocol/ui).A server can expose a whole directory of skills in one line:
This registers each
SKILL.md(and its supporting files) asskill://resources, derivesname/descriptionfrom the YAML frontmatter, and serves askill://index.jsondiscovery index.What's included
Schema/Extension/Skills/McpSkills— extension marker (EXTENSION_ID,MIME_TYPE,URI_SCHEME,ENTRY_POINT,DISCOVERY_URI,META_PREFIX).SkillType(enum),SkillDiscoveryEntry,SkillDiscoveryIndex,SkillMetadata, following the existing Apps DTO conventions (readonly,fromArray, omit-nulljsonSerialize).Server/Skill/FrontmatterParser— splitsSKILL.mdinto YAML frontmatter + body (handles BOM/CRLF; rejects non-mapping frontmatter).Server/Skill/SkillProvider— walks a directory, registers each skill and its supporting files asskill://resources, enforces the spec's name↔final-path-segment rule, sanitizes schema-valid resource names (URIs keep real paths), guesses MIME types, guards against path traversal, and serves the discovery index.Server/Builder::addSkillsFromDirectory()— convenience that auto-enables the extension.Notable fix
ServerCapabilities::jsonSerialize()only cast the outerextensionsmap, so an extension with an empty payload (like Skills) serialized to[]instead of{}. The Apps extension never hit this because its payload is non-empty. Empty inner payloads are now coerced to{}.Dependency
Adds
symfony/yaml(^5.4 || ^6.4 || ^7.3 || ^8.0) for frontmatter parsing — the feature is non-functional without it.Tests & docs
FrontmatterParser, andSkillProvider(with fixtures), plus a serialization regression test for the{}fix.resources/list,resources/readof aSKILL.md, a supporting file, and the discovery index).examples/server/skills/(flat, nested, and supporting-file URIs).docs/extensions.mdanddocs/examples.md.Verified:
phpstan(level 6) clean,php-cs-fixerclean, full unit suite green (792 tests), inspector skills test green.Deferred / follow-up
The discovery schema supports a
mcp-resource-templateskill type for parameterized skill namespaces. TheSkillTypeenum already includes the value for forward-compat, but the directory provider currently emits onlyskill-mdentries; template-backed skills are left as a follow-up.