feat(skills): publish skill://index.json + advertise skills extension (SEP-2640)#2762
Draft
SamMorrowDrums wants to merge 1 commit into
Conversation
Adds SEP-2640 skill discovery so skill-aware MCP clients can enumerate the server's skills (and the tools each governs) from a single resource read, without first fetching every SKILL.md. - Register a `skill://index.json` resource whose handler emits the Agent Skills discovery index built from the in-memory skill set. Each entry carries `type: skill-md`, `name`, `description`, `url` (the skill's SKILL.md), and the skill's `allowedTools`, so clients can gate/defer those tools before loading the skill. - Advertise the `io.modelcontextprotocol/skills` capability extension in the server's initialize result. Only the extension is set on ServerOptions, so the SDK still infers tools/resources/prompts capabilities from registered handlers. - Tests: index builder shape + an end-to-end in-memory initialize asserting the extension is advertised (without clobbering tools/resources) and index.json serves the discovery shape. Verified against the runtime SEP-2640 consumer: all 27 skills are discovered with their allowed-tools lists. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
What
Makes the skill-discovery image emit the two pieces a SEP-2640-aware MCP client needs to enumerate skills without fetching every
SKILL.md:skill://index.jsonresource — an Agent Skills discovery index built from the in-memory skill set. Each entry:{ "type": "skill-md", "name", "description", "url": "skill://github/<name>/SKILL.md", "allowedTools": [...] }.$schema=https://schemas.agentskills.io/discovery/0.2.0/index.json.io.modelcontextprotocol/skillscapability extension — advertised in theinitializeresult so clients opt intoskill://discovery.Stacked on
sammorrowdrums/skills-over-mcp-refactor(#2374). The branch already registers per-skillskill://github/<name>/SKILL.mdresources and parsesallowed-toolsfrontmatter; this PR exposes that same data through the well-known index + the capability flag.Why
The
skills-over-mcp-refactorbranch lists skills only as individualresources/listentries, withallowed-toolsburied inside eachSKILL.md, and advertises no skills extension. A SEP-2640 client that gates on the extension + readsskill://index.jsontherefore discovers zero skills from the image. This PR closes that gap so the discovery index and the per-skill allow-lists are available up front, enabling clients to defer a skill's tools until the skill is loaded.Implementation notes
Extensionsfield is set onServerOptions.Capabilities; the Go SDK still inferstools/resources/promptsfrom registered handlers (Server.capabilities()only fills nil fields), so advertising the extension does not clobber the existing capabilities.allSkills()/ each skill'sallowedTools— no new source of truth.Tests
TestBuildSkillIndex/TestBuildSkillIndexJSON_IsValid— index shape: oneskill-mdentry per skill, correcturl, non-emptyallowedTools, valid JSON.TestSkillsExtensionAndIndexAdvertised— end-to-end in-memoryinitialize: the skills extension is advertised (and tools/resources are still present), andskill://index.jsonserves the discovery shape.gofmt,go vet, and the fullpkg/githubsuite pass.Verified against a SEP-2640 consumer
Built the binary from this branch and ran a real client discovery loop:
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com