Skip to content

Add create command to publisher CLI for generating server.json files #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Jun 27, 2025

This PR adds a new create command to the MCP Registry Publisher CLI tool that generates properly formatted server.json files from command-line flags, addressing the difficulty of manually creating these files.

Changes Made

Core Implementation

  • Restructured CLI: Modified main.go to support subcommands (publish and create)
  • Backward Compatibility: Existing publish command functionality remains unchanged
  • Human-Friendly Flags: Added intuitive flag names with both long and short versions

Create Command Features

Required Flags

  • --name, -n: Server name (e.g., io.github.owner/repo-name)
  • --description, -d: Server description
  • --repo-url: Repository URL

Optional Flags

  • --execute, -e: Command invocation that generates runtime arguments
  • --version, -v: Server version (default: "1.0.0")
  • --env-var: Environment variables in format NAME:DESCRIPTION (repeatable)
  • --package-arg: Package arguments in format VALUE:DESCRIPTION (repeatable)
  • --runtime-hint: Runtime hint (e.g., "docker")
  • --registry: Package registry name (default: "npm")
  • --output, -o: Output file path (default: "server.json")

Smart Command Parsing

The --execute flag intelligently parses command invocations:

# Example: Docker command with complex arguments
./bin/mcp-publisher create \
  --name "io.github.example/docker-server" \
  --description "Docker-based MCP server" \
  --repo-url "https://github.com/example/docker-server" \
  --execute "docker run --rm -v /data:/app/data example/server --config=/path/config.json"

Generates runtime arguments with context-aware descriptions:

  • Detects command flags (--rm, --config)
  • Identifies flag values (/path/config.json for --config)
  • Handles complex Docker mount syntax
  • Supports quoted strings and special characters

Generated Output

Creates complete server.json files with:

  • Server metadata (name, description, version, repository)
  • Package configuration with registry details
  • Runtime arguments parsed from execute command
  • Environment variables with descriptions
  • Package arguments for user configuration

Documentation

  • Updated README with comprehensive usage examples
  • Added examples for NPX, Docker, and complex server configurations
  • Documented all available flags and their purposes
  • Maintained existing publish command documentation

Example Usage

# Basic NPX server
./bin/mcp-publisher create \
  --name "io.github.example/my-server" \
  --description "My MCP server" \
  --repo-url "https://github.com/example/my-server" \
  --execute "npx @example/my-server --verbose" \
  --env-var "API_KEY:Your API key"

# Docker server with complex configuration
./bin/mcp-publisher create \
  --name "io.github.example/docker-server" \
  --description "Docker-based server" \
  --repo-url "https://github.com/example/docker-server" \
  --runtime-hint "docker" \
  --execute "docker run --mount type=bind,src=/data,dst=/app/data example/server" \
  --package-arg "--workspace:Specify workspace directory"

The generated files provide a solid foundation that users can then edit to fine-tune descriptions, set argument requirements, and add remote server configurations.

Fixes #151.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits June 27, 2025 00:36
Co-authored-by: toby <83556+toby@users.noreply.github.com>
Co-authored-by: toby <83556+toby@users.noreply.github.com>
…ated documentation

Co-authored-by: toby <83556+toby@users.noreply.github.com>
Co-authored-by: toby <83556+toby@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Add create command to the publisher CLI to generate a server.json Add create command to publisher CLI for generating server.json files Jun 27, 2025
@Copilot Copilot AI requested a review from toby June 27, 2025 00:46
Copilot finished work on behalf of toby June 27, 2025 00:46
@toby toby requested a review from sridharavinash June 27, 2025 00:48
@toby toby marked this pull request as ready for review June 27, 2025 17:06
@sridharavinash sridharavinash enabled auto-merge (squash) June 27, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add create command to the publisher CLI to generate a server.json
2 participants