Skip to content

Commit 651c8df

Browse files
Copilottoby
andauthored
Add automatic runtime_hint setting to publisher create command (#205)
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. <!-- START COPILOT CODING AGENT TIPS --> --- 💬 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] <[email protected]> Co-authored-by: toby <[email protected]>
1 parent 4f5e85b commit 651c8df

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tools/publisher/main.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,16 @@ func createCommand() error {
263263
packageVersion = version
264264
}
265265

266+
// Set runtime hint based on registry name if not explicitly provided
267+
if runtimeHint == "" {
268+
switch registryName {
269+
case "docker":
270+
runtimeHint = "docker"
271+
case "npm":
272+
runtimeHint = "npx"
273+
}
274+
}
275+
266276
// Create server structure
267277
server := createServerStructure(name, description, version, repoURL, repoSource,
268278
registryName, packageName, packageVersion, runtimeHint, execute, envVars, packageArgs)

0 commit comments

Comments
 (0)