fix: extension page link fix, change nondeveloper to 'computer controller' (#766)

This commit is contained in:
Wendy Tang
2025-01-24 18:33:45 -08:00
committed by GitHub
parent dcfb76966f
commit 1e01ee438e
5 changed files with 62 additions and 119 deletions
@@ -0,0 +1,30 @@
import type { MCPServer } from "../types/server";
export function getGooseInstallLink(server: MCPServer): string {
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}`;
}