type SetupTab = { id: string, label: string, content: string, }; function escapeHtml(value: string): string { return value .replaceAll("&", "&") .replaceAll("<", "<") .replaceAll(">", ">") .replaceAll("\"", """) .replaceAll("'", "'"); } function codeBlock(language: string, value: string): string { return `
${escapeHtml(language)}
${escapeHtml(value)}
`; } function getCursorInstallUrl(mcpUrl: string): string { const url = new URL("cursor://anysphere.cursor-deeplink/mcp/install"); url.searchParams.set("name", "stack-auth"); url.searchParams.set("config", Buffer.from(JSON.stringify({ url: mcpUrl })).toString("base64url")); return url.toString(); } function getVsCodeInstallUrl(mcpUrl: string): string { const url = new URL("https://insiders.vscode.dev/redirect"); const installPayload = JSON.stringify({ type: "http", name: "stack-auth", url: mcpUrl, }); url.searchParams.set("url", `vscode:mcp/install?${encodeURIComponent(installPayload)}`); return url.toString(); } function getTabs(mcpUrl: string, cursorInstallUrl: string, vsCodeInstallUrl: string): SetupTab[] { return [ { id: "cursor", label: "Cursor", content: `

Configure Hexclave MCP in Cursor IDE for enhanced code assistance.

CAdd to Cursor

Manual Installation

Add the following to your mcp.json file:

${codeBlock("mcp.json", `{ "mcpServers": { "stack-auth": { "url": "${mcpUrl}" } } }`)}`, }, { id: "vscode", label: "VS Code", content: `

Configure Hexclave MCP in VS Code for enhanced code assistance.

VSAdd to VS Code

Manual Installation

Open a terminal and run the following command:

${codeBlock("Terminal", `code --add-mcp '{"type":"http","name":"stack-auth","url":"${mcpUrl}"}'`)}

Then, from inside VS Code, open the .vscode/mcp.json file and click "Start server".

`, }, { id: "codex", label: "Codex", content: `

Configure Hexclave MCP in Codex CLI and the Codex IDE extension. The configuration is shared between both.

Open a terminal and run the following command:

${codeBlock("Terminal", `codex mcp add stack-auth --url ${mcpUrl}`)}

Verify it is configured:

${codeBlock("Terminal", "codex mcp list")}

Manual Installation

Alternatively, add the following to ~/.codex/config.toml:

${codeBlock("config.toml", `[mcp_servers.stack-auth] url = "${mcpUrl}"`)}`, }, { id: "claudecode", label: "Claude Code", content: `

Open a terminal and run the following command:

${codeBlock("Terminal", `claude mcp add --transport http stack-auth ${mcpUrl}`)}

From within Claude Code, you can use the /mcp command to get more information about the server.

`, }, { id: "claudedesktop", label: "Claude Desktop", content: `

Open Claude Desktop and navigate to Settings > Connectors > Add Custom Connector.

Enter the name as stack-auth and the remote MCP server URL as ${escapeHtml(mcpUrl)}.

`, }, { id: "windsurf", label: "Windsurf", content: `

Copy the following JSON to your Windsurf MCP config file:

${codeBlock("mcp.json", `{ "mcpServers": { "stack-auth": { "serverUrl": "${mcpUrl}" } } }`)}`, }, { id: "chatgpt", label: "ChatGPT", content: `
In Team, Enterprise, and Edu workspaces, only workspace owners and admins have permission to set this.

Navigate to Settings > Connectors.

Add a custom connector with the server URL: ${escapeHtml(mcpUrl)}

After this, it should be visible in Composer > Deep Research Tool.

Connectors can only be used with Deep Research.
`, }, { id: "gemini", label: "Gemini CLI", content: `

Add the following JSON to your Gemini CLI configuration file (~/.gemini/settings.json):

${codeBlock("settings.json", `{ "mcpServers": { "stack-auth": { "httpUrl": "${mcpUrl}", "headers": { "Accept": "application/json, text/event-stream" } } } }`)}`, }, ]; } function getMarkdownInstructions(mcpUrl: string, cursorInstallUrl: string, vsCodeInstallUrl: string): string { return `
Cursor #### Installation Link [![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](${cursorInstallUrl}) #### Manual Installation Add the following to your \`mcp.json\` file: \`\`\`json { "mcpServers": { "stack-auth": { "url": "${mcpUrl}" } } } \`\`\`
VSCode #### Installation Link [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visual-studio-code&logoColor=white)](${vsCodeInstallUrl}) #### Manual Installation Open a terminal and run the following command: \`\`\` code --add-mcp '{"type":"http","name":"stack-auth","url":"${mcpUrl}"}' \`\`\` Then, from inside VS Code, open the .vscode/mcp.json file and click "Start server".
Codex Open a terminal and run the following command: \`\`\` codex mcp add stack-auth --url ${mcpUrl} \`\`\` Verify it is configured: \`\`\` codex mcp list \`\`\` Alternatively, add the following to \`~/.codex/config.toml\`: \`\`\`toml [mcp_servers.stack-auth] url = "${mcpUrl}" \`\`\`
Claude Code Open a terminal and run the following command: \`\`\` claude mcp add --transport http stack-auth ${mcpUrl} \`\`\` From within Claude Code, you can use the \`/mcp\` command to get more information about the server.
Claude Desktop Open Claude Desktop and navigate to Settings > Connectors > Add Custom Connector. Enter the name as \`stack-auth\` and the remote MCP server URL as \`${mcpUrl}\`.
Windsurf Copy the following JSON to your Windsurf MCP config file: \`\`\`json { "mcpServers": { "stack-auth": { "serverUrl": "${mcpUrl}" } } } \`\`\`
ChatGPT *Note: In Team, Enterprise, and Edu workspaces, only workspace owners and admins have permission* - Navigate to **Settings > Connectors** - Add a custom connector with the server URL: \`${mcpUrl}\` - It should then be visible in the Composer > Deep Research tool - You may need to add the server as a source *Connectors can only be used with **Deep Research***
Gemini CLI Add the following JSON to your Gemini CLI configuration file (\`~/.gemini/settings.json\`): \`\`\`json { "mcpServers": { "stack-auth": { "httpUrl": "${mcpUrl}", "headers": { "Accept": "application/json, text/event-stream" } } } } \`\`\`
`; } function renderTabs(tabs: SetupTab[]): string { const tabButtons = tabs.map((tab, index) => ``).join(""); const tabPanels = tabs.map((tab, index) => `
${tab.content}
`).join(""); return `
${tabButtons}
${tabPanels}
`; } export function renderSetupPageHtml(mcpUrl: string): string { const cursorInstallUrl = getCursorInstallUrl(mcpUrl); const vsCodeInstallUrl = getVsCodeInstallUrl(mcpUrl); const tabs = getTabs(mcpUrl, cursorInstallUrl, vsCodeInstallUrl); const markdownInstructions = getMarkdownInstructions(mcpUrl, cursorInstallUrl, vsCodeInstallUrl); return ` Hexclave MCP Setup
${renderTabs(tabs)}
Markdown Instructions If you want to include instructions for all clients in your project's README.md file, feel free to copy the following markdown:
${escapeHtml(markdownInstructions)}

Features

The Hexclave MCP server exposes ask_hexclave, which answers questions using live documentation retrieval and the docs-site AI assistant. It can help with:

`; }