fix: correct deep link install link format (#1830)

This commit is contained in:
Alex Hancock
2025-03-24 12:48:37 -04:00
committed by GitHub
parent af79da7bf2
commit 50c5705d87
2 changed files with 26 additions and 31 deletions

View File

@@ -1,5 +1,30 @@
import type { MCPServer } from "../types/server";
export function getGooseInstallLink(server: MCPServer): string {
return `goose://install/${encodeURIComponent(server.command)}`;
if (server.is_builtin) {
const queryParams = [
'cmd=goosed',
'arg=mcp',
`arg=${encodeURIComponent(server.id)}`,
`description=${encodeURIComponent(server.id)}`
].join('&');
return `goose://extension?${queryParams}`;
}
const parts = server.command.split(" ");
const baseCmd = parts[0]; // npx or uvx
const args = parts.slice(1); // remaining arguments
const queryParams = [
`cmd=${encodeURIComponent(baseCmd)}`,
...args.map((arg) => `arg=${encodeURIComponent(arg)}`),
`id=${encodeURIComponent(server.id)}`,
`name=${encodeURIComponent(server.name)}`,
`description=${encodeURIComponent(server.description)}`,
...server.environmentVariables
.filter((env) => env.required)
.map(
(env) => `env=${encodeURIComponent(`${env.name}=${env.description}`)}`
),
].join("&");
return `goose://extension?${queryParams}`;
}