Skip to content

skills: add SEP-2640 protocol support - #1238

Merged
guglielmo-san merged 17 commits into
modelcontextprotocol:mainfrom
sambhav:skills-sep-2640
Nov 27, 2026
Merged

guglielmo-san merged 17 commits into
modelcontextprotocol:mainfrom
sambhav:skills-sep-2640

Conversation

@sambhav

@sambhav sambhav commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Add opt-in Go support for the Skills extension: skills/list, skills/get, optional resources/directory/read, manifests, pagination, and content verification.

This is PR 1 of 2. Draft #1240 contains the optional filesystem provider and will need to adopt the revised API. Its helper-only comparison contains only filesystem code, tests, and documentation.

Review changes

  • Register client methods with skills.AddMethods before connecting. Custom calls retain explicit registration, and registration copies the sending-method map so active readers retain a stable view.
  • Use skills.List to iterate or skills.ListPage to fetch one page. Both accept a nullable *ListOptions and reject invalid entries by default. Opt-in filtering reports invalid entries while preserving pagination.
  • Use skills.Add for a static catalog or skills.AddHandlers for request-dependent results. Typed server requests carry transport metadata. Configure extension capabilities on the server options and register resources in either order before connecting.
  • Protocol calls validate entries internally. Frontmatter provides name and description accessors, and content verification preserves date strings alongside YAML yes/no values.

Compatibility and scope

On protocol 2026-07-28 and later, all three methods include required cache hints and all three methods return resultType: complete. The compatibility backport omits these fields on earlier protocols. Verification remains lazy and checks manifest membership, sizes, digests, and all frontmatter fields. Entries remain scoped to their originating server.

Removed the conformance runner changes and fixture, CONTRIBUTING edits, unrelated auth/extauth bullets, documentation intro/pagination changes, and x/sync reclassification. The only added dependency is gopkg.in/yaml.v3, used by Skills frontmatter verification. Skills documentation sources and generated files are updated together.

Validation

The revised branch passed the SDK build, Skills race tests, and targeted core registration tests. The full local test run was interrupted.

Earlier revision, standard conformance: 40 server checks and 239 client checks passed, zero failures.

Skills scenarios were rerun using conformance #330's chore/sep-2640-yaml branch at c4d79493f8013f18a7eb0bbe8aef584cff7b31aa, with temporary fixtures outside this PR:

Layer Protocol / HTTP mode Enumeration Manifest Directory Total
Protocol 2025-11-25 / stateful 30 6 7 43
Protocol 2026-07-28 / stateless 32 6 7 45
Filesystem helper 2025-11-25 / stateful 30 6 7 43
Filesystem helper 2026-07-28 / stateless 32 6 7 45

Zero failures or warnings. Legacy enumeration also has two version-conditioned skips.

@sambhav
sambhav force-pushed the skills-sep-2640 branch 3 times, most recently from adc1ddf to ca89d93 Compare September 4, 2026 17:02
@panyam

panyam commented Sep 4, 2026

Copy link
Copy Markdown

Woooot great to see this @sambhav. I ran the SEP-2640 conformance scenarios against this branch (conformance PR 330, the traceability extraction and server scenarios Il share soon for the skills extension). 41 checks, 0 failures.

Scenario Result
sep-2640-skills-enumeration 30/30
sep-2640-skills-manifest 4/4, 2 untestable
sep-2640-skills-directory 7/7

Repro, pointing a minimal skills.AddDirectory server at any skills tree:

node dist/index.js server --url http://localhost:18299/ \
  --scenario sep-2640-skills-enumeration --spec-version 2025-11-25 --force

Got three tiny notes (none blocking):

1. ttlMs and cacheScope are emitted on protocol 2025-11-25. In the SEP - "In protocol versions 2026-07-28 and later, the result also carries the base protocol's list-caching attributes". ttlMs does not appear in the 2025-11-25 schema at all, so this is emitting a field that is not defined in the negotiated version. We might want a version guard if it was not deliberate? If it was, this is a nice data point. I pointed out in PR 138 that it dropped the condition and was wondering if it was intention so looks like two efforts came to this point independently. So the condition itself may need to be removed instead of changing impls.

2. Two untestable SHOULD rows instead of passing. sep-2640-skillmd-metadata-name and -description check that the SKILL.md resource carries name and description from frontmatter. Since the dir utility serves through resource-template dispatch, SKILL.md is not in resources/list, so the metadata is not observable. I dont think this is a bug and I also do not think it needs changing, but figured Id flag it. A server registering SKILL.md as a listed resource does/would exercise those two.

3. Possible doc gap dueto needing flags against this branch. The runner defaults to the draft stateless wire. here it asserts MCP-Protocol-Version: 2026-07-28 with no handshake, so the server correctly refuses with -32022. --spec-version 2025-11-25 --force and selects the stateful wire and overrides the extension-applicability skip. The scenarios themselves are version-portable, they just do not advertise that. Just wanted to call this out.

@sambhav
sambhav force-pushed the skills-sep-2640 branch 2 times, most recently from 60744e4 to 36000a2 Compare September 4, 2026 21:59
@sambhav sambhav changed the title skills: add SEP-2640 support skills: add SEP-2640 protocol support Sep 4, 2026
@sambhav

sambhav commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

Thanks for running the SEP scenarios. The PR is now split so this one contains only the generic protocol layer. I addressed note 1 in the latest revision: skills/list now omits ttlMs and cacheScope before protocol version 2026-07-28, with regression coverage. Notes 2 and 3 make sense and do not require changes in this generic layer; the filesystem metadata behavior and usage notes will remain explicit in the follow-up helper PR.

@sambhav

sambhav commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

I reran conformance PR 330 locally against the split filesystem helper. It caught a nested YAML mapping normalization bug (metadata decoded to a non-JSON concrete map shape), now fixed with regression coverage. Final 2025-11-25 results: enumeration 29/29, manifest 4/4 with the two expected untestable metadata SHOULDs, and directory 7/7; no failures. The runner still needs --spec-version 2025-11-25 --force for this stateful fixture, as documented in conformance PR 330.

@sambhav

sambhav commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

The optional filesystem layer is now advertised as upstream draft #1240. While #1238 is pending, its GitHub Files changed view necessarily includes both stack commits; the clean helper-only diff is sambhav#1. I will rebase #1240 onto upstream main after this PR merges, then mark it ready.

@sambhav

sambhav commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

@guglielmo-san 🙏 this is ready. There is another PR stacked on top which provides a neater abstraction and utility for skills with filesystems (#1240). Would appreciate it if we can land this one first and the other one as a quick follow.

Comment thread skills/client.go Resolved
Comment thread skills/client.go Resolved
Comment thread skills/server.go Resolved
Comment thread skills/client.go Resolved
Comment thread skills/server.go Resolved
Comment thread skills/server.go Resolved
Comment thread skills/validation.go Resolved
@guglielmo-san

Copy link
Copy Markdown
Contributor

There are some changes that are unrelated to the skills SEP, can you remove them from this PR to allow an easier review?

  • scripts/server-conformance.sh
  • conformance/skills-server/main.go
  • CONTRIBUTING.md / internal/readme/contributing.src.md
  • auth/extauth bullet in README.md, internal/readme/README.src.md, docs/README.md and internal/docs/README.src.md: unrelated. Keep only the skills bullet.
  • Intro paragraph of internal/docs/README.src.md
  • Pagination section of internal/docs/server.src.md
  • go.mod: moving golang.org/x/sync from indirect to direct concerns mcp/mrtr.go, not Skills. Only the gopkg.in/yaml.v3 addition is needed.

@yarolegovich yarolegovich self-assigned this Oct 7, 2026
Comment thread extensions/skills/validation.go Resolved
Comment thread extensions/skills/server.go Resolved
Comment thread skills/client.go Resolved
Comment thread skills/client.go Resolved

sambhav commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

Addressed the scope cleanup from 4 October in 21ad3c2: removed the conformance runner/fixture, CONTRIBUTING edits, unrelated auth/extauth bullets, docs intro/pagination edits, and x/sync reclassification. Only Skills documentation and its YAML dependency remain. Updated #1240 to include this protocol revision while preserving the filesystem provider; the helper-only comparison is now seven files. Both branches preserve their previous heads without force-pushing. Replied separately to all four current review threads. Full Go/race checks and standard + Skills conformance pass.

sambhav and others added 4 commits November 23, 2026 22:34
ext-skills#157 aligned the stable spec page with the 2026-07-28 base schema.
ReadResourceDirectoryResult now extends CacheableResult, so ttlMs and
cacheScope are required on resources/directory/read results from 2026-07-28,
as they already are for skills/list and skills/get. Skill also gains an
optional _meta.

AddHandlers now stamps the directory result through the same envelope path
as list and get, ReadDirectory validates the hints the way List and Get do,
and both directions are covered by the era and malformed-response tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSiqKZYUECJYpKAY7qg4Cp
hedeqiang added a commit to hedeqiang/crewbase that referenced this pull request Nov 25, 2026
The official Go SDK does not support the Skills extension yet
(modelcontextprotocol/go-sdk#1238 is still open). Crewbase uses the
official SDK for MCP rather than its own protocol code, so this waits for
the SDK and is added on top of it then.

This reverts the merge 1e95099 (commit 7e748af). Elicitation, which is
built on the SDK's own ElicitationHandler, stays.
hedeqiang added a commit to hedeqiang/crewbase that referenced this pull request Nov 25, 2026
The official Go SDK has no Skills support yet
(modelcontextprotocol/go-sdk#1238 is still open), so Crewbase keeps its own
host-side implementation until it lands, built on the SDK's custom-method
API (AddSendingCustomMethod / CallCustomMethod) and resources/read. It is
to be replaced by the SDK's once that is released.

This reverts 14cfb41, restoring 7e748af.
// Use of this source code is governed by the license
// that can be found in the LICENSE file.

package skills

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.

I'd still prefer placing this under extensions/skills rather than at the top level of the module.
It keeps optional MCP extensions grouped cleanly under extensions/ instead of growing the root package namespace.

Comment thread extensions/skills/server.go Resolved
Comment thread skills/client.go Resolved
Comment thread extensions/skills/types.go Resolved
Comment thread skills/types.go Resolved
sambhav and others added 2 commits November 27, 2026 06:32
Address the latest review:

- Move the package to extensions/skills so optional MCP extensions are
  grouped instead of growing the module root.
- Unexport resultType on ListSkillsResult, GetSkillResult, and
  ReadDirectoryResult, matching how mcp handles result types. SEP-2640
  only allows "complete" or an omitted value, so handlers cannot set it.
- Clear resultType explicitly for protocols before 2026-07-28, so a
  reused or proxied result never serializes it on legacy responses.
- Check the response envelope before the payload in Get and
  ReadDirectory, as ListPage already does.
- Decode through internal/json, using UnmarshalUseNumber for
  Frontmatter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014dNQo9bM6iAoGvd2tEx8a2
@alexbadoi

alexbadoi commented Nov 27, 2026 •

Copy link
Copy Markdown

👀 any approximate ETA on this?

@guglielmo-san
guglielmo-san dismissed yarolegovich’s stale review November 27, 2026 10:43

All requested changes from Oct 12 have been addressed in subsequent commits.

@guglielmo-san
guglielmo-san merged commit 48c1dd0 into modelcontextprotocol:main Nov 27, 2026
10 checks passed
Tangerg added a commit to Tangerg/go-sdk that referenced this pull request Dec 2, 2026
Brings the fork up to upstream main at 723d70e, which is v1.9.0 plus
fourteen later commits. Upstream changes: modelcontextprotocol#1238, modelcontextprotocol#1511, modelcontextprotocol#1515, modelcontextprotocol#1517,
modelcontextprotocol#1521, modelcontextprotocol#1523, modelcontextprotocol#1524, modelcontextprotocol#1527, modelcontextprotocol#1533, modelcontextprotocol#1537, modelcontextprotocol#1539, modelcontextprotocol#1540, modelcontextprotocol#1544, modelcontextprotocol#1547,
modelcontextprotocol#1549, modelcontextprotocol#1550, modelcontextprotocol#1553, modelcontextprotocol#1554, modelcontextprotocol#1558, modelcontextprotocol#1560, modelcontextprotocol#1561, modelcontextprotocol#1562.

Fork-side adaptations:

- internal/jsonrpc2: the -32600 reply to a duplicate in-flight ID
  (modelcontextprotocol#1550) is written off the read loop and holds its admission slot
  until written, like every other reply under MaxIncomingRequests.
- mcp: ClientSession.initialize takes the session state lock that
  upstream added, and still projects the negotiated version to the
  connection.
- mcp: the fork's copies of hintomitempty, nowrapinvalidparams and
  nomethodnotfoundcodeinerror go away with upstream's removal (modelcontextprotocol#1533).
- extensions/skills: reads the protocol version from the fork's
  json.RawMessage Meta.
- Tests: the duplicate-ID admission test drains the new reply, and the
  client cancellation test runs on 2025-11-25 only, because 2026-07-28
  clients reject every standalone server request (modelcontextprotocol#1537, modelcontextprotocol#1540, modelcontextprotocol#1554).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants