How to publish an MCP server to the official MCP Registry (and fix server.json errors)

By Jonah EasePublished Last checked
Publishing to the official MCP Registry takes a proof inside your package, a server.json, and three commands. The registry stores metadata only, and points at a package you published elsewhere[8]. It says it is in preview, so breaking changes or data resets may occur[8]. If you only need this one listing, you can do all of it by hand: see when you don't need ManyCP.
Put the proof inside the package
The registry checks that the package really belongs to the name in server.json. The marker has to be inside the version you publish[3].
| Package | Proof, with this guide's sample name |
|---|---|
| npm | "mcpName": "io.github.example-user/weather-mcp" in package.json |
| PyPI | mcp-name: io.github.example-user/weather-mcp in the README, which PyPI shows as the description |
| NuGet | mcp-name: io.github.example-user/weather-mcp in the package README |
| Cargo | mcp-name: io.github.example-user/weather-mcp as visible text in the README (crates.io removes HTML comments) |
| Docker / OCI | LABEL io.modelcontextprotocol.server.name="io.github.example-user/weather-mcp" in the Dockerfile |
| Remote server | No package, so no marker. The URL has to be publicly reachable[4]. |
With GitHub login the name must start with io.github.<your-username>/. A domain you own gives a name that starts with that domain, reversed[2].
The steps
- Publish the package first, so the proof is live:
npm publish --access public[1]. - Install the tool:
brew install mcp-publisher, or the release download on the registry's GitHub page[1]. - Write
server.json.mcp-publisher initmakes a template withTODO:placeholders[10]. The next section has a finished one. - Log in:
mcp-publisher login github. It prints a code to enter at github.com/login/device[1]. - Check it:
mcp-publisher validate[10]. Then publish:mcp-publisher publish.
mcp-publisher login github
mcp-publisher validate
mcp-publisher publish
# Is it live? (this search form is the quickstart's own check)
curl "https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.example-user/weather-mcp"The last command is the one in the quickstart[1].
A server.json that validates
This file was built by buildServerJson, the function ManyCP publishes with, for a sample npm server. Posted to the registry's validation endpoint on it returned {"valid":true,"issues":[]}[11].
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.example-user/weather-mcp",
"description": "Weather forecasts and alerts for any city.",
"version": "1.0.0",
"title": "Weather",
"repository": {
"url": "https://github.com/example-user/weather-mcp",
"source": "github"
},
"packages": [
{
"registryType": "npm",
"identifier": "@example-user/weather-mcp",
"version": "1.0.0",
"runtimeHint": "npx",
"transport": {
"type": "stdio"
}
}
]
}$schemaishttps://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json, which is required[9].descriptionis 100 characters at most[9].versionis one exact version, never a range[5].- The version in
packages[].versionmust be a version that is on npm and carries the proof.
A remote server has no package
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.example-user/weather-mcp",
"description": "Weather forecasts and alerts for any city.",
"version": "1.0.0",
"title": "Weather",
"repository": {
"url": "https://github.com/example-user/weather-mcp",
"source": "github"
},
"remotes": [
{
"type": "streamable-http",
"url": "https://weather.example.com/mcp"
}
]
}A remote entry uses remotes with a streamable-http or sse type and a public URL[4]. This one also returned valid on .
Publish from GitHub Actions
The registry's own workflow logs in with GitHub OIDC, so there is no stored secret, and it needs id-token: write[6]. This is the registry-only variant ManyCP puts in a pull request body: it leaves publishing the package to your own release job, waits for the version to appear on npm, and sets the version from the tag.
# Publishes this server to the official MCP Registry when you push a tag like v1.2.3.
# Your own release pipeline publishes the package. This only tells the registry about it, with GitHub OIDC (no stored secret).
name: Publish to MCP Registry
on:
push:
tags: ["v*"]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
id-token: write # required for `mcp-publisher login github-oidc`
contents: read
steps:
- name: Checkout
uses: actions/checkout@v5
# The package must be on npm before the registry can check it. Your own release job publishes it.
- name: Wait for the package on npm
run: |
VERSION="${GITHUB_REF_NAME#v}"
for i in $(seq 1 30); do
curl -sfo /dev/null "https://registry.npmjs.org/@example-user%2Fweather-mcp/$VERSION" && exit 0
sleep 10
done
echo "Version $VERSION is not on npm yet." && exit 1
# Keep server.json and the git tag in lockstep (registry versions never change once published).
- name: Sync version from tag
run: |
VERSION="${GITHUB_REF_NAME#v}"
jq --arg v "$VERSION" '.version = $v | (.packages[]? | select(.registryType=="npm") | .version) = $v' \
server.json > server.tmp && mv server.tmp server.json
- name: Install mcp-publisher
run: |
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
- name: Authenticate to MCP Registry (GitHub OIDC)
run: ./mcp-publisher login github-oidc
- name: Validate server.json
run: ./mcp-publisher validate
- name: Publish server to MCP Registry
run: ./mcp-publisher publish
Errors and fixes
The texts below are the registry's own, with this guide's sample names in them. The ones that start with expected, version must and invalid version were returned by the registry's validator on .
| Error text | Cause | Fix | Source |
|---|---|---|---|
NPM package '@example-user/weather-mcp' is missing required 'mcpName' field. Add this to your package.json: "mcpName": "io.github.example-user/weather-mcp" | The npm version in server.json has no mcpName. The registry reads the published copy of that version, not your repo. | Add mcpName to package.json, publish a new npm version, and put that version in server.json. | [12][3] |
NPM package ownership validation failed. Expected mcpName 'io.github.example-user/weather-mcp', got 'weather-mcp' | mcpName is there but differs from the name in server.json. | Make them identical, character for character, and publish a new version. | [12][1] |
NPM package '@example-user/weather-mcp' exists, but version '1.0.0' was not found (status: 404). A newly published release can take a moment to appear on the registry. Wait and retry, or publish version '1.0.0' before registering it | The package version is not on npm yet, or has only just been published. | Check the version on npm, wait a minute and publish again. | [12] |
PyPI package 'weather-mcp' ownership validation failed. The server name 'io.github.example-user/weather-mcp' must appear as 'mcp-name: io.github.example-user/weather-mcp' in the package README | The README that PyPI shows for this version has no mcp-name line. | Add the line mcp-name: io.github.example-user/weather-mcp to the README and publish a new PyPI version. | [13][3] |
PyPI package 'weather-mcp' ownership validation failed: found 'mcp-name: io.github.example-user/weather-mcp' in the README, but it is immediately followed by "." rather than a boundary. The token must be followed by a space, newline, an HTML tag, or a comment close ('-->') — put it on its own line and republish | Punctuation is glued to the end of the name. | Put the mcp-name line on its own line and publish a new version. | [13] |
OCI image 'docker.io/example-user/weather-mcp:1.0.0' is missing required annotation. Add this to your Dockerfile: LABEL io.modelcontextprotocol.server.name="io.github.example-user/weather-mcp" | The image has no ownership label. | Add the LABEL line, rebuild, push a new tag and use that tag in the identifier. | [14][3] |
OCI packages must not have 'version' field - include version in 'identifier' instead (e.g., 'docker.io/owner/image:1.0.0') | An oci package carries its version in the image tag, not in a version field. | Delete the version field from the package and keep the tag in identifier. | [14] |
expected length <= 100 (location: body.description) | The description is longer than 100 characters. | Cut it to 100 characters or fewer, at a word. | [9][11] |
version must be a specific version, not a range: "^1.0.0" | A version range (^, ~, >=, 1.x, 1.*) was used where one exact version belongs. | Use one exact version such as 1.0.0, in server.json and in each package. | [5][11] |
expected string to match pattern ^[a-zA-Z0-9.-]+/[a-zA-Z0-9._-]+$ (location: body.name) | The name has no namespace, or more than one slash. | Use namespace/name, such as io.github.example-user/weather-mcp. | [9][11] |
invalid version: cannot publish duplicate version: io.github.example-user/weather-mcp@1.0.0 already exists | That name and version are already published, and published metadata does not change. | Raise the version in server.json and publish again. | [15][16][7] |
Invalid or expired Registry JWT token | The login has run out, or you are not logged in. | Run mcp-publisher login github again, then publish. | [1][17] |
You do not have permission to publish this server | Your login does not match the name's namespace. With GitHub, the name must start with io.github.<your-username>/. | Rename the server, or log in with the method that owns that namespace. | [1][2][17] |
invalid audience | mcp-publisher login github-oidc from an older mcp-publisher. | Install the latest mcp-publisher in the workflow. | [10] |
A package that was published a moment ago can be missing for a short time; the registry's own message says to wait and retry[12].
When you don't need ManyCP
- You have one server and one registry listing. Everything above is free to do by hand, and the quickstart has no payment step[1].
- You already ship releases from GitHub Actions. Add the workflow above and publish on every tag.
- You only want the registry. The registry is one of 26 directories, and some of the others read it.
What ManyCP adds: ManyCP builds the server.json, checks it with the registry, and publishes with your GitHub sign-in. If your package is missing the mcpName proof, it opens a pull request on your own repo to add it. It does not publish your npm or PyPI package for you. A new package version, with the proof in it, is yours to release. For the rest of the list, see all 26 directories compared, or run the free checker first.
Sources
- MCP Registry: Quickstart, publish an MCP server · checked
- MCP Registry: How to authenticate when publishing · checked
- MCP Registry: Supported package types and ownership checks · checked
- MCP Registry: Publishing remote servers · checked
- MCP Registry: Versioning published MCP servers · checked
- MCP Registry: Automate publishing with GitHub Actions · checked
- MCP Registry: Frequently asked questions · checked
- The MCP Registry: about (preview status) · checked
- server.json schema, 2025-12-11 · checked
- mcp-publisher command reference · checked
- Official registry API reference, including POST /v0.1/validate · checked
- Registry source: npm ownership check (npm.go) · checked
- Registry source: PyPI ownership check (pypi.go) · checked
- Registry source: Docker/OCI ownership check (oci.go) · checked
- Registry source: duplicate version error (database.go) · checked
- Registry source: duplicate version check (registry_service.go) · checked
- Registry source: publish handler (publish.go) · checked
ManyCP is not affiliated with, endorsed by or sponsored by any directory, Docker, OpenAI, Anthropic or GitHub named here. Names are used to say which service a fact is about.