registry/tools/publisher
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Avinash Sridhar 5c238eceef feat: refactor to account for updated openAPI schema
* Update the model to handle new changes to schema based on https://github.com/modelcontextprotocol/registry/pull/33

* Made the import script a little simpler.
* Add a new updated seed file
* update template mcp.json file for publisher
2025-05-17 09:38:19 -06:00
..
build.sh feat: add build script and update README for MCP Registry Publisher Tool 2025-05-05 14:38:45 -06:00
main.go feat: require GitHub Client ID environment variable for publshing 2025-05-06 09:47:26 -06:00
mcp.json feat: refactor to account for updated openAPI schema 2025-05-17 09:38:19 -06:00
README.md feat: require GitHub Client ID environment variable for publshing 2025-05-06 09:47:26 -06:00

MCP Registry Publisher Tool

The MCP Registry Publisher Tool is designed to publish Model Context Protocol (MCP) server details to an MCP registry. This tool currently only handles GitHub authentication via device flow and manages the publishing process.

Building the Tool

You can build the publisher tool using the provided build script:

# Build for current platform
./build.sh

# Build for all supported platforms (optional)
./build.sh --all

The compiled binary will be placed in the bin directory.

Usage

# Basic usage
./bin/mcp-publisher --registry-url <REGISTRY_URL> --mcp-file <PATH_TO_MCP_FILE>

# Force a new login even if a token exists
./bin/mcp-publisher --registry-url <REGISTRY_URL> --mcp-file <PATH_TO_MCP_FILE> --login

Command-line Arguments

  • --registry-url: URL of the MCP registry (required)
  • --mcp-file: Path to the MCP configuration file (required)
  • --login: Force a new GitHub authentication even if a token already exists (overwrites existing token file)
  • --token: Use the provided token instead of GitHub authentication (bypasses the device flow)

Authentication

The tool uses GitHub device flow authentication:

  1. When first run (or with --login flag), the tool will initiate the GitHub device flow
  2. You'll be provided with a URL and a code to enter
  3. After successful authentication, the tool saves the token locally for future use
  4. The token is sent in the HTTP Authorization header with the Bearer scheme

Required Environment Variable

Before using the GitHub authentication, you need to set the following environment variable:

export MCP_REGISTRY_GITHUB_CLIENT_ID="your_github_client_id"

This environment variable is required for the GitHub device flow authentication. If not set, the authentication will fail.

NOTE : Authentication is made on behalf of a OAuth App which you must authorize for respective resources (e.g org)

Example

  1. Prepare your mcp.json file with your server details:
{
  "name": "io.github.yourusername/your-repository",
  "description": "Your MCP server description",
  "version_detail": {
    "version": "1.0.0"
  },
  "registries": [
    {
      "name": "npm",
      "package_name": "your-npm-package",
      "license": "MIT",
      "command_arguments": {
        "sub_commands": [
          {
            "name": "start",
            "description": "Start the server",
            "named_arguments": null
          }
        ],
        "positional_arguments": null,
        "environment_variables": [
          {
            "name": "PORT",
            "description": "Port to run the server on",
            "required": false
          }
        ],
        "named_arguments": null
      }
    }
  ],
  "remotes": [
    {
      "transporttype": "http",
      "url": "http://yourdomain.com/api"
    }
  ]
}
  1. Run the publisher tool:
# First, set the required environment variable
export MCP_REGISTRY_GITHUB_CLIENT_ID="your_github_client_id"

# Then run the publisher tool
./bin/mcp-publisher --registry-url "https://mcp-registry.example.com" --mcp-file "./mcp.json"
  1. Follow the authentication instructions in the terminal if prompted.

  2. Upon successful publication, you'll see a confirmation message.

Important Notes

  • The MCP_REGISTRY_GITHUB_CLIENT_ID environment variable must be set for GitHub authentication
  • The authentication token is saved in a file named .mcpregistry_token in the current directory
  • The tool requires an active internet connection to authenticate with GitHub and communicate with the registry
  • Make sure the repository and package mentioned in your mcp.json file exist and are accessible