From 651c8dfee340a8c04cb93bcb28e1fe3430809a09 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Tue, 29 Jul 2025 09:51:26 -0600 Subject: [PATCH] Add automatic runtime_hint setting to publisher create command (#205) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `publisher create` command now automatically sets the `runtime_hint` field in the generated `server.json` based on the `registry_name` when no explicit `--runtime-hint` is provided: - When `registry_name` is `docker`, sets `runtime_hint` to `docker` - When `registry_name` is `npm`, sets `runtime_hint` to `npx` - Other registries remain unchanged (no `runtime_hint` field) ## Before ```bash # NPM registry - no runtime_hint field generated $ mcp-publisher create --name "test-server" --description "Test" --repo-url "https://github.com/test/repo" --registry npm ``` ```json { "packages": [ { "registry_name": "npm", "name": "test-server", "version": "1.0.0" } ] } ``` ## After ```bash # NPM registry - automatically sets runtime_hint to "npx" $ mcp-publisher create --name "test-server" --description "Test" --repo-url "https://github.com/test/repo" --registry npm ``` ```json { "packages": [ { "registry_name": "npm", "name": "test-server", "version": "1.0.0", "runtime_hint": "npx" } ] } ``` The manual `--runtime-hint` flag continues to work and takes precedence over the automatic setting, ensuring backward compatibility. Fixes #204. --- 💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click [here](https://survey.alchemer.com/s3/8343779/Copilot-Coding-agent) to start the survey. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: toby <83556+toby@users.noreply.github.com> --- tools/publisher/main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/publisher/main.go b/tools/publisher/main.go index acee2e7..7d21cf8 100644 --- a/tools/publisher/main.go +++ b/tools/publisher/main.go @@ -263,6 +263,16 @@ func createCommand() error { packageVersion = version } + // Set runtime hint based on registry name if not explicitly provided + if runtimeHint == "" { + switch registryName { + case "docker": + runtimeHint = "docker" + case "npm": + runtimeHint = "npx" + } + } + // Create server structure server := createServerStructure(name, description, version, repoURL, repoSource, registryName, packageName, packageVersion, runtimeHint, execute, envVars, packageArgs)