registry/tools/publisher
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Mingyong Chen d16328e8c1
Rename mcp.json to server.json (#106)
<!-- Provide a brief summary of your changes -->
Rename mcp.json to server.json
## Motivation and Context
<!-- Why is this change needed? What problem does it solve? -->

## How Has This Been Tested?
<!-- Have you tested this in a real application? Which scenarios were
tested? -->

## Breaking Changes
<!-- Will users need to update their code or configurations? -->

## 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)
- [ ] Documentation update

## Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply. -->
- [ ] I have read the [MCP
Documentation](https://modelcontextprotocol.io)
- [ ] My code follows the repository's style guidelines
- [ ] New and existing tests pass locally
- [ ] I have added appropriate error handling
- [ ] I have added or updated documentation as needed

## Additional context
<!-- Add any other context, implementation notes, or design decisions
-->
Related to #86

Co-authored-by: Avinash Sridhar <sridharavinash@users.noreply.github.com>
2025-06-03 18:52:46 +00:00
..
auth Publish Auth Interface (#112) 2025-05-30 15:05:15 -04: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 Rename mcp.json to server.json (#106) 2025-06-03 18:52:46 +00:00
README.md Rename mcp.json to server.json (#106) 2025-06-03 18:52:46 +00:00
server.json Rename mcp.json to server.json (#106) 2025-06-03 18:52:46 +00: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 uses GitHub OAuth device flow authentication to securely manage 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)
  • -auth-method: Authentication method to use (default: github-oauth)

Authentication

The tool has been simplified to use GitHub OAuth device flow authentication exclusively. Previous versions supported multiple authentication methods, but this version focuses solely on GitHub OAuth for better security and user experience.

  1. Automatic Setup: The tool automatically retrieves the GitHub Client ID from the registry's health endpoint
  2. First Run Authentication: When first run (or with the --login flag), the tool initiates the GitHub device flow
  3. User Authorization: You'll be provided with a URL and a verification code to enter on GitHub
  4. Token Storage: After successful authentication, the tool saves the access token locally in .mcpregistry_token for future use
  5. Secure Communication: The token is sent in the HTTP Authorization header with the Bearer scheme for all registry API calls

Note: Authentication is performed via GitHub OAuth App, which you must authorize for the respective resources (e.g., organization access if publishing organization repositories).

Example

  1. Prepare your server.json file with your server details:
{
  "name": "io.github.yourusername/your-repository",
  "description": "Your MCP server description",
  "version_detail": {
    "version": "1.0.0"
  },
  "packages": [
    {
      "registry_name": "npm",
      "name": "your-npm-package",
      "version": "1.0.0",
      "package_arguments": [
        {
          "description": "Specify services and permissions",
          "is_required": true,
          "format": "string",
          "value": "-s",
          "default": "-s",
          "type": "positional",
          "value_hint": "-s"
        }
      ],
      "environment_variables": [
        {
          "name": "API_KEY",
          "description": "API Key to access the server"
        }
      ]
    }
  ],
  "repository": {
    "url": "https://github.com/yourusername/your-repository",
    "source": "github"
  }
}
  1. Run the publisher tool:
./bin/mcp-publisher --registry-url "https://mcp-registry.example.com" --mcp-file "./server.json"
  1. Follow the authentication instructions in the terminal if prompted.

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

Important Notes

  • GitHub Authentication Only: The tool exclusively uses GitHub OAuth device flow for authentication
  • Automatic Client ID: The GitHub Client ID is automatically retrieved from the registry's health endpoint
  • Token Storage: The authentication token is saved in .mcpregistry_token in the current directory
  • Internet Required: Active internet connection needed for GitHub authentication and registry communication
  • Repository Access: Ensure the repository and package mentioned in your server.json file exist and are accessible
  • OAuth Permissions: You may need to grant the OAuth app access to your GitHub organizations if publishing org repositories