Complete create command implementation with package arguments and updated documentation

Co-authored-by: toby <83556+toby@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-06-27 00:44:45 +00:00 • committed by Toby Padilla
commit 662957fa7f

View file

@ -18,12 +18,23 @@ The compiled binary will be placed in the `bin` directory.
## Usage
The tool supports two main commands:
### Publishing a server
```bash
# Basic usage
./bin/mcp-publisher -registry-url <REGISTRY_URL> -mcp-file <PATH_TO_MCP_FILE>
./bin/mcp-publisher publish -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
./bin/mcp-publisher publish -registry-url <REGISTRY_URL> -mcp-file <PATH_TO_MCP_FILE> -login
```
### Creating a server.json file
```bash
# Create a new server.json file
./bin/mcp-publisher create --name "io.github.owner/repo" --description "My server" --repo-url "https://github.com/owner/repo"
```
### Command-line Arguments
@ -33,6 +44,87 @@ The compiled binary will be placed in the `bin` directory.
- `-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)
## Creating a server.json file
The tool provides a `create` command to help generate a properly formatted `server.json` file. This command takes various flags to specify the server details and generates a complete server.json file that you can then modify as needed.
### Usage
```bash
./bin/mcp-publisher create [flags]
```
### Create Command Flags
#### Required Flags
- `--name`, `-n`: Server name (e.g., io.github.owner/repo-name)
- `--description`, `-d`: Server description
- `--repo-url`: Repository URL
#### Optional Flags
- `--version`, `-v`: Server version (default: "1.0.0")
- `--repo-source`: Repository source (default: "github")
- `--output`, `-o`: Output file path (default: "server.json")
- `--execute`, `-e`: Command to execute the server (generates runtime arguments)
- `--registry`: Package registry name (default: "npm")
- `--package-name`: Package name (defaults to server name)
- `--package-version`: Package version (defaults to server version)
- `--runtime-hint`: Runtime hint (e.g., "docker")
- `--env-var`: Environment variable in format NAME:DESCRIPTION (can be repeated)
- `--package-arg`: Package argument in format VALUE:DESCRIPTION (can be repeated)
### Create Examples
#### Basic NPX Server
```bash
./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 for the service"
```
#### Docker Server
```bash
./bin/mcp-publisher create \
--name "io.github.example/docker-server" \
--description "Docker-based MCP 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" \
--env-var "CONFIG_PATH:Path to configuration file"
```
#### Server with Package Arguments
```bash
./bin/mcp-publisher create \
--name "io.github.example/full-server" \
--description "Complete server example" \
--repo-url "https://github.com/example/full-server" \
--execute "npx @example/server" \
--package-arg "-s:Specify services and permissions" \
--package-arg "--config:Configuration file path" \
--env-var "API_KEY:Service API key" \
--env-var "DEBUG:Enable debug mode"
```
The `create` command will generate a `server.json` file with:
- Proper structure and formatting
- Runtime arguments parsed from the `--execute` command
- Environment variables with descriptions
- Package arguments for user configuration
- All necessary metadata
After creation, you may need to manually edit the file to:
- Adjust argument descriptions and requirements
- Set environment variable optionality (`is_required`, `is_secret`)
- Add remote server configurations
- Fine-tune runtime and package arguments
## 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.
@ -45,7 +137,9 @@ The tool has been simplified to use **GitHub OAuth device flow authentication ex
**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
## Publishing Example
To publish an existing server.json file to the registry:
1. Prepare your `server.json` file with your server details:
@ -90,7 +184,7 @@ The tool has been simplified to use **GitHub OAuth device flow authentication ex
2. Run the publisher tool:
```bash
./bin/mcp-publisher --registry-url "https://mcp-registry.example.com" --mcp-file "./server.json"
./bin/mcp-publisher publish --registry-url "https://mcp-registry.example.com" --mcp-file "./server.json"
```
3. Follow the authentication instructions in the terminal if prompted.