Skip to content

Docs/migration skill - #2968

Open
KKonstantinov wants to merge 4 commits into
mainfrom
docs/migration-skill
Open

KKonstantinov wants to merge 4 commits into
mainfrom
docs/migration-skill

Conversation

@KKonstantinov

@KKonstantinov KKonstantinov commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Publish the v1→v2 upgrade guide as an Agent Skill that npx skills add and skills.sh can find, without a second copy of the guide: its text moves into skills/mcp-typescript-sdk-upgrade-to-v2/, and docs/migration/upgrade-to-v2.md assembles it with VitePress includes. The rendered page does not change.

Motivation and Context

#2360 folded docs/migration-SKILL.md into the guide ("this file IS the agent skill") because the two-file model had drifted. One source was the right call, but the guide never became installable:

  • Skill tools only discover a SKILL.md in a folder named after its name:. upgrade-to-v2.md is neither, so npx skills add finds nothing and skills.sh lists no TypeScript SDK skill. What agents find instead are copies of the pre-docs: restructure migration guide — codemod-first, two-journey split, SKILL folded into upgrade-to-v2 #2360 migration-SKILL.md in other repos, and third-party skills that never mention the codemod.
  • At 1,886 lines the guide is about 4× the spec's 500-line limit for a skill body, which an agent loads whole when the skill triggers.

This keeps #2360's single source and reverses only "the guide file is the skill": the skill is now the source, and the docs page is a view of it.

Changes:

  • skills/mcp-typescript-sdk-upgrade-to-v2/ — SKILL.md (167 lines: intro, quick path, what the codemod does and does not handle, a "read this reference when…" table, Need help) and one references/ file per subsystem (32–286 lines). The text moved verbatim. Links between sections now cross files (references/auth.md#auth), and links to other docs pages are site URLs, so they work wherever the skill is installed.
  • docs/migration/upgrade-to-v2.md — <!--@include--> directives (#regions of SKILL.md, whole reference files) plus the Contents list. A source: frontmatter field, which GitHub shows and the site does not, says where to edit. The description: is reworded for llms.txt now that the page is no longer the skill.
  • docs/.vitepress/skill.ts, config.mts — on the assembled page, the skill's links map back to in-page anchors and relative links.
  • docs/.vitepress/llms.ts — expands the includes for the markdown renditions, and throws on a missing file or region, where VitePress would leave the comment in the page (missing file) or include the whole file (missing region).
  • pnpm check:skills (in check:all and lint:all) — name matches the directory, description is 1–1024 characters, SKILL.md is under 500 lines, and every link inside the skill resolves (file and heading) without leaving it.
  • docs/migration/index.md, CONTRIBUTING.md, docs/behavior-surface-pins.md — the install command, and where the guide is edited now.

Anchor fix (second commit). The guides link headings GitHub-style (#packaging--runtime), but VitePress slugs punctuation differently (#packaging-runtime). So 24 of the 56 in-page links on the upgrade guide, 5 of them in its Contents list, and 7 links on support-2026-07-28.md went nowhere on the site. They work on GitHub, which is how this went unnoticed. The skill has to keep GitHub-style anchors, since GitHub and skills.sh render it, so a markdown-it core rule points each in-page anchor that matches no heading id, but matches a heading's GitHub slug, at the id VitePress generated. Links that already resolve are untouched. The one link among them that points into another page, from the support page into the upgrade guide, now uses the VitePress id directly.

How Has This Been Tested?

  • No content lost. Built the docs on main and on this branch and compared the output:
    • migration/upgrade-to-v2.html: after the move, identical except the page's chunk hash (its frontmatter lost name:). After the anchor fix, exactly the 24 broken hrefs changed, each to the matching heading id.
    • The page's markdown rendition is identical except table padding (Prettier re-pads tables whose link targets grew). llms.txt changes only in this page's description line, and llms-full.txt only in the migration index section.
  • Anchors. Checked every # link on every built guide page, including links into other pages, against the target page's heading ids: 31 broken before, 0 after.
  • Discovery. npx skills@1.7.1 add <repo> --list finds exactly one skill, with this name and description.
  • check:skills fails on a deliberately broken copy: name not matching the directory, missing heading, missing file, and a link leaving the skill.
  • Dev server. pnpm docs:dev renders the included content, and editing a skill file logs [vitepress] page reload and reloads the open page.
  • pnpm check:all passes.

Breaking Changes

None. The page's URL and all its anchors are unchanged. Contributors now edit the guide in skills/mcp-typescript-sdk-upgrade-to-v2/ rather than in docs/migration/upgrade-to-v2.md.

No changeset: no package changes.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

  • This undoes the "this file IS the agent skill" part of docs: restructure migration guide — codemod-first, two-journey split, SKILL folded into upgrade-to-v2 #2360; the single source and the codemod-first structure stay.
  • Reviewing the move. The first commit is the move. Every line of main's upgrade-to-v2.md is in exactly one skill file, apart from the frontmatter, the Contents list and the --- separators between sections, which stay in the page.
  • GitHub view. GitHub does not render include comments, so on GitHub docs/migration/upgrade-to-v2.md shows only its frontmatter, including the source: pointer, and the Contents list. The READMEs link the rendered site.
  • Name. mcp-typescript-sdk-upgrade-to-v2: npx skills add installs into a flat directory such as ~/.claude/skills/, so the name carries the namespace; typescript-sdk keeps it apart from a Python counterpart. A rename after publishing is costly, since skills.sh keeps old names listed.
  • Publishing. skills.sh has no submission step. The skill is listed after the first npx skills add modelcontextprotocol/typescript-sdk --skill mcp-typescript-sdk-upgrade-to-v2 against the public repo.
  • Follow-ups, separate PRs:
    • The codemod's diagnostics (handlerRegistration.ts) and an error string in auth.ts cite the repo path docs/migration/upgrade-to-v2.md; switch them to site URLs.
    • Point the v1.x README, which the npm page of @modelcontextprotocol/sdk shows, at the skill.

Move the guide's text into skills/mcp-typescript-sdk-upgrade-to-v2/ (SKILL.md plus one reference file per subsystem) and assemble docs/migration/upgrade-to-v2.md from it with VitePress includes. The rendered page is unchanged. Add pnpm check:skills to validate the skill's frontmatter and internal links.
The migration guides link headings GitHub-style (#packaging--runtime), which is what GitHub and skills.sh render, but VitePress slugs punctuation differently (#packaging-runtime): 24 of 56 in-page links on the upgrade guide and 6 on the 2026-07-28 guide went nowhere on the site. Map each such anchor to the heading id VitePress generated, in the same core rule that now resolves the skill's links, and share the slug function with check:skills.
…cription

GitHub renders frontmatter as a table and does not render include comments, so a source: field tells GitHub readers to edit the skill files; the site and llms.ts do not display it. The description, which llms.txt shows, no longer reads as a skill trigger.
@KKonstantinov
KKonstantinov requested a review from a team as a code owner October 8, 2026 07:55
@changeset-bot

changeset-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 007c199

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@2968

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/@modelcontextprotocol/codemod@2968

@modelcontextprotocol/core

npm i https://pkg.pr.new/@modelcontextprotocol/core@2968

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@2968

@modelcontextprotocol/server-legacy

npm i https://pkg.pr.new/@modelcontextprotocol/server-legacy@2968

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@2968

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@2968

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@2968

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@2968

commit: 007c199

@claude claude Bot added the v2 Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes label Oct 8, 2026

@claude claude Bot 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.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Comment thread scripts/check-skills.ts Outdated
Comment thread scripts/check-skills.ts Outdated
Comment thread docs/.vitepress/llms.ts
Comment thread docs/.vitepress/config.mts
Comment thread scripts/check-skills.ts
Comment thread docs/.vitepress/llms.ts Outdated
Comment thread docs/.vitepress/config.mts
…s line count

support-2026-07-28.md links into the upgrade guide with a GitHub-style
anchor (#client-connection--dispatch). The page_links rule only maps
in-page anchors, so the link still opened the guide at the top. It now
uses the VitePress id. On GitHub, upgrade-to-v2.md shows only its
Contents list, so the GitHub-style anchor no longer lands anywhere there.

check:skills counted the empty element after the trailing newline, so it
reported every SKILL.md one line long. It now counts the file's lines and
enforces the spec's "under 500 lines".

check:skills derives its root from import.meta.url, as skill.ts does:
import.meta.dirname is undefined before Node 20.11, which engines allows,
and the script runs in lint:all on pre-push.

Three JSDoc blocks are now one line each. expandIncludes no longer claims
that VitePress silently leaves the comment: that holds for a missing file,
but for a missing region VitePress 1.6 includes the whole file. The throw
catches both. Included content is trimmed of edge blank lines because the
including page owns the spacing.

@claude claude Bot 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.

Thanks for 007c199 — I re-read it and found no new bugs: the import.meta.url root, the trailing-newline line count with the >= 500 / "under 500" wording, the one-line JSDoc, and the #client-connection-dispatch anchor in support-2026-07-28.md all do what the commit message says. Because this is a ~1,900-line guide move plus new build tooling (page_links markdown-it rule, expandIncludes, check-skills.ts) that ships without tests, a maintainer's look at the skill-as-source design is still worthwhile.

What was reviewed this run: the four files in the fix commit against the earlier inline threads; the link-resolution path in scripts/check-skills.ts (fenced-code skipping, frontmatter field parsing, relative-link containment) for regressions from the root change — none found.

Extended reasoning...

The latest push (007c199) touches only docs/.vitepress/llms.ts, docs/.vitepress/skill.ts, scripts/check-skills.ts and docs/migration/support-2026-07-28.md, and each change matches the earlier inline feedback it cites. The PR as a whole moves the v1-to-v2 upgrade guide into skills/mcp-typescript-sdk-upgrade-to-v2/ and adds VitePress include/anchor-rewrite machinery plus a new lint wired into lint:all and check:all; it touches no auth, crypto or runtime SDK code. It is not approved because the change is large, introduces a new content-ownership model for the docs, and its new build scripts have no tests; two earlier optional inline threads (CRLF handling, cross-file duplicate heading ids) are not changed by this push.

Still open from earlier reviews (3):

  • Unresolved: 3 minor or pre-existing.

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

v2 Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant