generate-links.jsā¢3.16 kB
#!/usr/bin/env node
/**
* Generate installation links for various MCP clients
* Outputs URLs that can be used in README badges and quick install buttons
*/
import { Buffer } from "buffer";
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import { dirname } from "path";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Load package.json for configuration
const packageJsonPath = path.join(__dirname, "..", "package.json");
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
// Configuration from package.json
const packageName = packageJson.name;
const serverName = packageName.split("-")[0];
const packageDescription = packageJson.description ?? "";
// VS Code and VS Code Insiders config
const configObjVSCode = {
[serverName]: {
command: "npx",
args: [`${packageName}@latest`],
env: {
URANIUM_API_KEY: "your_api_key_here",
},
},
};
const configJSONVSCode = JSON.stringify(configObjVSCode);
// Cursor config (flat, not nested)
const configObjCursor = {
command: "npx",
args: [`${packageName}@latest`],
env: {
URANIUM_API_KEY: "your_api_key_here",
},
};
const configJSONCursor = JSON.stringify(configObjCursor);
const configBase64Cursor = Buffer.from(configJSONCursor).toString("base64");
// LM Studio config
const configObjLMStudio = {
command: "npx",
args: [`${packageName}@latest`],
env: {
URANIUM_API_KEY: "your_api_key_here",
},
};
const configJSONLMStudio = JSON.stringify(configObjLMStudio);
const configBase64LMStudio = Buffer.from(configJSONLMStudio).toString("base64");
// Generate URLs
const urlForVSCode = `vscode:mcp/install?${encodeURIComponent(configJSONVSCode)}`;
const urlForVSCodeGithub = `https://insiders.vscode.dev/redirect?url=${encodeURIComponent(urlForVSCode)}`;
const urlForVSCodeInsiders = `vscode-insiders:mcp/install?${encodeURIComponent(configJSONVSCode)}`;
const urlForVSCodeInsidersGithub = `https://insiders.vscode.dev/redirect?url=${encodeURIComponent(urlForVSCodeInsiders)}`;
// Cursor deeplink (as per https://docs.cursor.com/en/tools/developers#generate-install-link)
const cursorWebUrl = `cursor://anysphere.cursor-deeplink/mcp/install?name=${serverName}&config=${configBase64Cursor}`;
// Goose extension install URL
const gooseCmd = encodeURIComponent("npx");
const gooseArg = encodeURIComponent(`${packageName}@latest`);
const gooseId = encodeURIComponent(serverName);
const gooseName = encodeURIComponent(serverName.charAt(0).toUpperCase() + serverName.slice(1)); // Capitalize first letter
const gooseDescription = encodeURIComponent(packageDescription);
const gooseWebUrl = `https://block.github.io/goose/extension?cmd=${gooseCmd}&arg=${gooseArg}&id=${gooseId}&name=${gooseName}&description=${gooseDescription}`;
// LM Studio deeplink
const lmStudioWebUrl = `https://lmstudio.ai/install-mcp?name=${serverName}&config=${configBase64LMStudio}`;
// Output URLs in order (for use by other scripts)
console.log(urlForVSCodeGithub);
console.log(urlForVSCodeInsidersGithub);
console.log(cursorWebUrl);
console.log(gooseWebUrl);
console.log(lmStudioWebUrl);