## Motivation and Context Docs currently don't have very clear organisation, and don't explain core flows. This fixes #89 (although we still might want to push these to `https://modelcontextprotocol.io/docs/`), based on the plan there. One minor change from that plan is that I merged tutorials and guides, because they ended up basically being duplicates which I thought would be annoying for us to keep in sync. Additionally in the Diátaxis framework, tutorials and guides are separated by whether they are focused on acquisition of skills (e.g. in a learning environment) or application of skills (e.g. in a work environment). I expect the registry to be something that will be used occasionally in a work environment, rather than a fundamental 'learnable' skill so I think it's reasonable not to have tutorials and fold these into guides. ## How Has This Been Tested? - Read through all these updated docs - Unit and integration tests (that previously used examples.md and use the schema) working - Ran `npx markdown-link-check .` to check all the links work ## Breaking Changes Links to old docs will break, but I don't think there are any. All internal links have been checked and updated. ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] 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) - [x] Documentation update
5 KiB
Adding a new package registry
The MCP Registry project is a metaregistry, meaning that it hosts metadata for MCP servers but does not host the code for the servers directly.
For local MCP servers, the MCP Registry has pointers in the packages node of the server.json schema that refer to packages in supported package managers.
The list of supported package managers for hosting MCP servers is defined by the properties.packages[N].properties.registry_type string enum in the server.json schema. For example, this could be "npm" (for npmjs.com packages) or "pypi" (for PyPI packages).
For remote MCP servers, the package registry is not relevant. The MCP client consumes the server via a URL instead of by downloading and running a package. In other words, this document only applies to local MCP servers.
For the sake of illustration, this document will use npm (the Node.js package manager) as an example at each step.
Prerequisites
The package registry must meet the following requirements:
- The package registry supports packaging and executing CLI apps. Local MCP servers use the stdio transport.
- npm CLI tools typically express their CLI commands in the
binproperty of the package.json
- npm CLI tools typically express their CLI commands in the
- The package registry (or associated client tooling) has a widely accepted single-shot CLI command.
- npm's
npxtool executes CLI commands using a documented execution heuristic - For example, the MCP client can map the
server.jsonmetadata to annpxCLI execution, with args and environment variables populated via user input.
- npm's
- The package registry supports anonymous package downloads. This allows the MCP client software to use the metadata found in the MCP registry to discover, download, and execute package-based local MCP servers with minimal user intervention.
npxby default connects to the public npmjs.com registry, allowing simple consumption of public npm packages.
- The package registry should support a validation mechanism to verify ownership of the server name. This prevents misattribution and ensures that only the actual package owner can reference their packages in server registrations. For example:
- npm requires an
mcpNamefield inpackage.jsonthat matches the server name being registered - PyPI requires a
mcp-name:line in the package README/description - Each registry type must implement a validation mechanism accessible via public API
- npm requires an
Steps
These steps may evolve as additional validations or details are discovered and mandated.
- Create a feature request issue on the MCP Registry repository to begin the discussion about adding the package registry.
- Example for NuGet: https://github.com/modelcontextprotocol/registry/issues/126
- Open a PR with the following changes:
- Update the
server.jsonschema- Add your package registry name to the
registry_typeexample array. - Add your package registry base url to the
registry_base_urlexample array. - Add the single-shot CLI command name to the
runtime_hintexample value array.
- Add your package registry name to the
- Update the
openapi.yaml- Add your package registry name to the
registry_typeenum value array. - Add your package registry base url to the
registry_base_urlenum value array. - Add the single-shot CLI command name to the
runtime_hintexample value array.
- Add your package registry name to the
- Add a sample, minimal
server.jsonto theserver.jsonexamples. - Implement a registry validator:
- Create a new validator file:
internal/validators/registries/yourregistry.go, following the pattern of existing validators. Examples:- npm: Checks for an
mcpNamefield inpackage.jsonthat matches the server name - PyPI: Searches for
mcp-name: server-nameformat in the package README content - NuGet: Looks for
mcp-name: server-nameformat in the package README file - Docker/OCI: Validates a Docker image label
io.modelcontextprotocol.server.namein the image manifest
- npm: Checks for an
- Add corresponding unit tests:
internal/validators/registries/yourregistry_test.go - Register your validator in
internal/validators/validators.go
- Create a new validator file:
- Update the publishing documentation:
- Add a new publishing guide:
docs/guides/publishing/publish-[yourregistry].md, following the pattern of existing publishing guides (e.g.,publish-npm.md,publish-pypi.md) - Include instructions on how to prepare packages for your registry, including any specific validation requirements
- Update
docs/guides/publishing/README.mdto reference your new publishing guide
- Add a new publishing guide:
- Update the