registry/docs/modelcontextprotocol-io
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Radoslav Dimitrov 04623ed925
fix(validators): harden mcp-name matching (PyPI/NuGet anchoring, comment-form safe) + cargo follow-ups (#1331)
Registry-wide hardening of the `mcp-name:` ownership-token match, plus
the cargo follow-up fixes from the #1330 review — consolidated here per
maintainer request. Rebased onto current `main` (the merged #1330 cargo
commit drops out), so the diff is just the net-new work.

### Changes
- **PyPI/NuGet: boundary-anchored token match.** Replace
`strings.Contains(readme, "mcp-name: "+name)` with the shared
`containsMCPNameToken`, so a README declaring a longer name
(`…/widget-pro`) no longer satisfies an ownership claim for a shorter
prefix (`…/widget`). (Cargo already got this in #1330; NPM is unaffected
— it compares an exact metadata field.)
- **Matcher: treat the HTML comment close as a boundary.** `<!--
mcp-name: NAME-->` / `<!--mcp-name: NAME-->` (any spacing) validate
again — the documented hidden-comment form for PyPI/NuGet — while a
genuine longer name (`…/widget--pro`) still does not.
- **Cargo hardening (review of #1330):** pin scheme+port (not just host)
on the README fetch and redirects; a rate-limited/failed crate-version
existence probe now reports *transient* instead of "not found"; a 403
with the crate present no longer flatly asserts "no README".
- **Docs:** note the token must be followed by a boundary.

### ⚠️ Behavior change for PyPI/NuGet — read before merging
The match is **strictly stricter** (verified by fuzz, 2.3M execs: it can
only flip pass→fail, never fail→pass). After the comment-close fix, the
**only** forms that newly fail are unusual *inline* ones: the token
ending a sentence (`…/my-mcp.`) or glued to a trailing `/`. The
documented forms (own line, in `<!-- … -->`) are unaffected.

**Correcting an earlier claim:** this re-validates on **edits too**, not
just new versions — `edit.go → UpdateServer → ValidateUpdateRequest →
validateRegistryOwnership` runs the token check on any edit of a live
server (only delete-transitions skip it). So an existing PyPI/NuGet
server whose README uses one of the breaking inline forms would fail on
its next publish *or* edit. Given the v0.1 API-freeze posture, this
should land as a deliberate, noted change.

### Testing
`go build`, `vet`, `gofmt`, `golangci-lint` (prod files),
`check-schema`, `validate-examples` all clean. Hermetic + **live**
PyPI/NuGet/cargo suite passes. New: `TestCargoURLAllowed`, a
combined-fixture probe-429→transient case, comment-form matcher cases,
and `FuzzContainsMCPNameToken` (the strictly-stricter property, 2.3M
execs).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 02:28:41 -04:00
..
about.mdx Remove .mdx suffixes from internal doc links for Mintlify (#1052) 2026-03-12 11:46:30 +01:00
authentication.mdx docs(authentication): note OpenSSL 3.x requirement for Ed25519 (#1253) 2026-05-07 10:42:37 -04:00
ecosystem-diagram.excalidraw.svg Prepare docs for modelcontextprotocol.io (#728) 2025-11-18 17:22:31 +00:00
faq.mdx Publisher-managed "deleted" support (#893) 2026-02-27 09:00:07 -08:00
github-actions.mdx docs: document GitHub OIDC audience binding for self-hosters and CI users (#1230) 2026-04-29 20:56:53 -04:00
moderation-policy.mdx docs: Add preview disclaimer note to public documentation 2026-01-22 07:35:03 -06:00
package-types.mdx fix(validators): harden mcp-name matching (PyPI/NuGet anchoring, comment-form safe) + cargo follow-ups (#1331) 2026-06-05 02:28:41 -04:00
quickstart.mdx docs: signpost non-npm publishers to package-types from quickstart (#1192) 2026-04-23 18:21:21 -04:00
registry-aggregators.mdx Remove .mdx suffixes from internal doc links for Mintlify (#1052) 2026-03-12 11:46:30 +01:00
remote-servers.mdx docs: Add preview disclaimer note to public documentation 2026-01-22 07:35:03 -06:00
terms-of-service.mdx docs: Add preview disclaimer note to public documentation 2026-01-22 07:35:03 -06:00
versioning.mdx docs: Add preview disclaimer note to public documentation 2026-01-22 07:35:03 -06:00