Commands
agent-commerce export mcp-registry
Write server.json for the MCP Registry from protocols.mcp.registry, then publish it with mcp-publisher.
doctor --registry and the protocols.mcp.registry keys may change in a minor release.agent-commerce export mcp-registry [--config <path>] [--env-file <path>]
[--output <path>] [--force]Writes server.json, the listing the public MCP Registry accepts, from your config. The registry is a catalog of MCP servers in preview. The command loads and validates the full config as start does: required ${VAR} placeholders must resolve. It makes no network requests.
Options
--config <path>AGENT_COMMERCE_CONFIG, then config.yaml.--env-file <path>--output <path>stringdefault: server.json--forcebooleandefault: falseConfig
The listing needs MCP enabled, a protocols.mcp.registry block and an HTTPS merchant.publicBaseUrl:
merchant:
publicBaseUrl: https://shop.example
protocols:
mcp:
enabled: true
mountPath: /mcp
registry:
name: io.github.acme/weather
version: 1.4.0 # the listing's version, not the package's
description: Weather forecasts, paid per callConfig loading checks these fields against the registry's rules: name is a namespace and a name joined by one /, at most 200 characters; version is not latest or a range such as ^1.2.3 or 1.x; description is 1 to 100 characters. Quote versions YAML would read as numbers, such as "1.4". See Configuration for the full rules.
With this block, the gateway also reports name and version as its MCP serverInfo at initialize. Without it, it reports agent-commerce and the package version.
What it writes
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.acme/weather",
"description": "Weather forecasts, paid per call",
"version": "1.4.0",
"remotes": [
{
"type": "streamable-http",
"url": "https://shop.example/mcp"
}
]
}The one streamable-http remote is <publicBaseUrl><protocols.mcp.mountPath>, written with a lowercase scheme and host and no default port. x402 challenges use the same form when payments.x402.publicResourceUrl is on, which gives the listing and the challenges matching URL strings.
Output
$ agent-commerce export mcp-registry --env-file .env
Wrote server.json for io.github.acme/weather 1.4.0.
Publish it with mcp-publisher after verifying the namespace.The command writes nothing and prints one FAIL line per key to change when:
| Key | Refused when |
|---|---|
protocols.mcp.enabled | it is false |
protocols.mcp.registry | the block is missing |
merchant.publicBaseUrl | the URL uses a scheme other than HTTPS, or names localhost, 127.0.0.1 or a .localhost host |
The command writes a temporary file beside the destination, then renames it. A failed write leaves an existing output file intact.
Publish the listing
- Export
Run
agent-commerce export mcp-registrywith the config the gateway runs. - Prove the namespace and publish
Log in and publish with the registry's
mcp-publisherCLI. Your namespace determines how you prove ownership:io.github.<user>/needs GitHub authentication; a reverse-DNS namespace such ascom.example/needs a DNS TXT record or a/.well-known/mcp-registry-authfile onexample.com. The gateway does not serve that file. See the registry's authentication guide. - Verify
Run
agent-commerce doctor --registryto compare the published listing with your config.
The registry recommends semantic versions and uses their ordering to choose the latest. Publishing a prerelease such as 1.2.3-1 after its release, 1.2.3, does not make it the latest; if your config names that prerelease, doctor --registry reports a version difference.
Exit codes
0 when the file is written. 1 for an existing output file without --force, a config error, a refused key or a failed write.
Based on: docs/protocols/mcp.md