import { slugify } from './parser' /** * MCP Server Configuration */ export interface McpServerConfig { $schema: string mcpServers: { [key: string]: { description: string command: string args: string[] env: Record } } quickImport: { identifier: string manifestUrl: string | null customParams: { description: string mcp: { type: string command: string args: string[] } } } } /** * Generate MCP configuration JSON for documentation server */ export function generateMcpConfig(sourceUrl: string, siteName: string): string { const identifier = slugify(siteName) const config: McpServerConfig = { $schema: 'https://json-schema.org/draft/2020-12/schema', mcpServers: { [identifier]: { description: `${siteName} documentation assistant`, command: 'npx', args: ['-y', '@anthropic/mcp-docs-server', '--docs-path', `./${identifier}-docs/`], env: { DOCS_SOURCE: sourceUrl, }, }, }, quickImport: { identifier: identifier, manifestUrl: null, customParams: { description: `Documentation for ${siteName}`, mcp: { type: 'stdio', command: 'npx', args: ['-y', '@anthropic/mcp-docs-server', '--docs-path', `./${identifier}-docs/`], }, }, }, } return JSON.stringify(config, null, 2) } /** * Generate Claude Desktop configuration snippet */ export function generateClaudeDesktopConfig(sourceUrl: string, siteName: string): string { const identifier = slugify(siteName) const config = { [identifier]: { command: 'npx', args: ['-y', '@anthropic/mcp-docs-server', '--docs-path', `./${identifier}-docs/`], env: { DOCS_SOURCE: sourceUrl, }, }, } return JSON.stringify(config, null, 2) } /** * Generate VS Code MCP configuration */ export function generateVSCodeMcpConfig(sourceUrl: string, siteName: string): string { const identifier = slugify(siteName) const config = { 'mcp.servers': { [identifier]: { type: 'stdio', command: 'npx', args: ['-y', '@anthropic/mcp-docs-server', '--docs-path', `./${identifier}-docs/`], env: { DOCS_SOURCE: sourceUrl, }, }, }, } return JSON.stringify(config, null, 2) } /** * Generate instructions for MCP setup */ export function generateMcpInstructions(sourceUrl: string, siteName: string): string { const identifier = slugify(siteName) return `# MCP Configuration for ${siteName} ## Quick Setup ### Claude Desktop Add this to your Claude Desktop configuration (\`claude_desktop_config.json\`): \`\`\`json { "mcpServers": { "${identifier}": { "command": "npx", "args": ["-y", "@anthropic/mcp-docs-server", "--docs-path", "./${identifier}-docs/"] } } } \`\`\` ### VS Code with Copilot Add to your VS Code settings: \`\`\`json { "mcp.servers": { "${identifier}": { "type": "stdio", "command": "npx", "args": ["-y", "@anthropic/mcp-docs-server", "--docs-path", "./${identifier}-docs/"] } } } \`\`\` ## Setup Steps 1. Extract the ZIP file to a convenient location 2. Copy the configuration above to your MCP config file 3. Update the \`--docs-path\` to point to the extracted folder 4. Restart your AI assistant application ## Source Information - **Original URL:** ${sourceUrl} - **Server Name:** ${identifier} --- *Generated by llm.energy* ` }