Skip to content

Conversation

Copilot
Copy link
Contributor

@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 Copilot AI assigned Copilot and toby Jun 27, 2025
@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
@toby
Copy link
Collaborator

toby commented Jun 30, 2025

@copilot please fix the linting errors.

auto-merge was automatically disabled June 30, 2025 23:40

Head branch was pushed to by a user without write access

Copy link
Contributor Author

Copilot AI commented Jun 30, 2025

@copilot please fix the linting errors.

Fixed all linting errors in commit 02e653b. The changes include:

  • Fixed errcheck errors by properly handling flag parsing return values
  • Changed file permissions from 0644 to 0600 for security compliance
  • Replaced fmt.Println with log.Println to comply with forbidigo rules
  • Fixed import formatting and code structure
  • Converted if-else chains to switch statements for better readability
  • Broke long lines to comply with line length limits

All linting now passes cleanly with golangci-lint.

@Copilot Copilot AI requested a review from toby June 30, 2025 23:41
Copilot finished work on behalf of toby June 30, 2025 23:41
@toby
Copy link
Collaborator

toby commented Jul 2, 2025

If you run the publisher command with no arguments it prints the usage/help as logs (with timestamps), update it to print to standard out without logs. Update all of the usage flags at the root command and sub-commands to use the format --long-flag/-l, two dashes before the long flag and a single dash/single letter short alias. All on one line.

Copy link
Contributor Author

Copilot AI commented Jul 2, 2025

If you run the publisher command with no arguments it prints the usage/help as logs (with timestamps), update it to print to standard out without logs. Update all of the usage flags at the root comm...

Updated the publisher CLI help output in commit 4149a24. The usage/help now prints to standard output without log timestamps, and all flags are displayed in the --long-flag/-short format on one line as requested.

Copilot finished work on behalf of toby July 2, 2025 22:51
@toby toby requested a review from tadasant July 2, 2025 23:56
@toby toby force-pushed the copilot/fix-151 branch from c0646bf to b669015 Compare July 2, 2025 23:59
@toby toby self-requested a review July 2, 2025 23:59
@toby toby enabled auto-merge (rebase) July 3, 2025 00:55
@toby toby requested review from toby and removed request for sridharavinash July 3, 2025 00:56
@toby toby merged commit 81e5174 into main Jul 3, 2025
10 checks passed
@toby toby deleted the copilot/fix-151 branch July 3, 2025 01:40
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
4 participants