youraitools-api / tree / functions/install.js ยท raw (this view has old GitHub links rewritten for the mirror; raw is byte-exact)
// Free-first MCP tier + one-line install snippets (Claude Code, Claude Desktop, Cursor) for the tools that have it.
// Cursor deeplink format: cursor://anysphere.cursor-deeplink/mcp/install?name=&config=<base64 JSON of one server>.
const b64 = (s) => (typeof btoa === 'function' ? btoa(s) : Buffer.from(s, 'utf8').toString('base64'));
export const FREE_PER_DAY = 30;

export function install(name, mcpUrl) {
  return {
    claudeCode: `claude mcp add --transport http ${name} ${mcpUrl}`,
    claudeDesktop: JSON.stringify({ mcpServers: { [name]: { command: 'npx', args: ['-y', 'mcp-remote', mcpUrl] } } }),
    cursor: JSON.stringify({ mcpServers: { [name]: { url: mcpUrl } } }),
    cursorDeeplink: `cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(name)}&config=${encodeURIComponent(b64(JSON.stringify({ url: mcpUrl })))}`,
  };
}

/** Markdown block for one tool (llms.txt, which-api.md). */
export function installMd(name, mcpUrl) {
  const s = install(name, mcpUrl);
  return `- Claude Code: \`${s.claudeCode}\`\n- Claude Desktop (claude_desktop_config.json, or Settings > Connectors > Add custom connector with ${mcpUrl}): \`${s.claudeDesktop}\`\n- Cursor (~/.cursor/mcp.json): \`${s.cursor}\`, one-click: ${s.cursorDeeplink}\n`;
}

agentgate-source: code mirror on Cloudflare Pages. All repos