import type { InstallTarget } from '@bmm/types'; export interface SnippetInput { name: string; slug: string; publicUrl: string; } export function buildSnippet(target: InstallTarget, input: SnippetInput): { label: string; code: string; note?: string } { const key = input.slug.replace(/[^a-zA-Z0-9_-]/g, '_'); const mcpUrl = `${input.publicUrl.replace(/\/$/, '')}/mcp`; switch (target) { case 'claude-desktop': return { label: 'claude_desktop_config.json', code: JSON.stringify( { mcpServers: { [key]: { url: mcpUrl, auth: 'oauth2', }, }, }, null, 2, ), note: '~/Library/Application Support/Claude/claude_desktop_config.json (macOS) — Settings → Developer (Windows). Restart Claude after saving.', }; case 'cursor': return { label: '.cursor/mcp.json', code: JSON.stringify( { mcpServers: { [key]: { url: mcpUrl, auth: 'oauth2', }, }, }, null, 2, ), note: 'Place at the project root or in ~/.cursor/mcp.json for global use.', }; case 'chatgpt': return { label: 'ChatGPT — Custom Connector', code: `Name: ${input.name}\nURL: ${mcpUrl}\nAuth: OAuth 2.1 (Dynamic Client Registration)`, note: 'ChatGPT → Settings → Connectors → Add custom connector. Paste the values above. OAuth handshake runs on first use.', }; } }