Commands

agent-commerce export mcp-registry

Write server.json for the MCP Registry from protocols.mcp.registry, then publish it with mcp-publisher.

ExperimentalThis command, doctor --registry and the protocols.mcp.registry keys may change in a minor release.
Usagebash
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>
Path to the config. Default: AGENT_COMMERCE_CONFIG, then config.yaml.
--env-file <path>
Load environment variables before reading the config. Variables already set in the environment take precedence.
--output <path>stringdefault: server.json
Where to write the listing. Missing parent directories are created.
--forcebooleandefault: false
Overwrite an existing file. Without it, an existing file stops the run before the config is read.

Config

The listing needs MCP enabled, a protocols.mcp.registry block and an HTTPS merchant.publicBaseUrl:

yaml
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 call

Config 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

server.jsonjson
{
  "$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:

KeyRefused when
protocols.mcp.enabledit is false
protocols.mcp.registrythe block is missing
merchant.publicBaseUrlthe 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

  1. Export

    Run agent-commerce export mcp-registry with the config the gateway runs.

  2. Prove the namespace and publish

    Log in and publish with the registry's mcp-publisher CLI. Your namespace determines how you prove ownership: io.github.<user>/ needs GitHub authentication; a reverse-DNS namespace such as com.example/ needs a DNS TXT record or a /.well-known/mcp-registry-auth file on example.com. The gateway does not serve that file. See the registry's authentication guide.

  3. Verify

    Run agent-commerce doctor --registry to 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