get_integration_guide
Retrieve framework-specific authentication integration guides to configure Better Auth for production-ready setups.
Instructions
Get integration guide for a specific framework or platform
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| framework | Yes | Framework name (e.g., "next", "remix", "astro", "expo") |
Implementation Reference
- src/index.ts:404-423 (handler)The primary handler function for the 'get_integration_guide' tool. Validates the framework argument, checks cache, fetches/parses the guide if necessary, caches the result, and returns a JSON-formatted response.private async handleGetIntegrationGuide(args: any) { const framework = this.validateFramework(args); try { // Check cache first if (this.integrationCache.has(framework)) { return this.createSuccessResponse(this.integrationCache.get(framework)); } // Fetch integration guide const guide = await this.fetchIntegrationGuide(framework); // Save to cache this.integrationCache.set(framework, guide); return this.createSuccessResponse(guide); } catch (error) { this.handleAxiosError(error, `Integration guide for "${framework}"`); } }
- src/index.ts:163-176 (schema)Tool schema definition including name, description, and input schema that requires a 'framework' string parameter.{ name: "get_integration_guide", description: "Get integration guide for a specific framework or platform", inputSchema: { type: "object", properties: { framework: { type: "string", description: "Framework name (e.g., \"next\", \"remix\", \"astro\", \"expo\")", }, }, required: ["framework"], }, },
- src/index.ts:227-228 (registration)Registration of the tool handler in the CallToolRequest switch statement.case "get_integration_guide": return await this.handleGetIntegrationGuide(request.params.arguments);
- src/index.ts:428-456 (helper)Key helper function that performs the HTTP request to Better Auth docs, parses HTML with Cheerio, extracts guide content (title, description, setup, config, examples), and constructs the IntegrationGuide object.private async fetchIntegrationGuide(framework: string): Promise<IntegrationGuide> { const url = `${this.BETTER_AUTH_DOCS_URL}/docs/integrations/${framework}`; try { const response = await this.axiosInstance.get(url); const $ = cheerio.load(response.data); const title = $("h1").first().text().trim(); const description = this.extractDescription($); const setup = this.extractSetup($); const config = this.extractConfiguration($); const examples = this.extractExamples($); return { name: title || framework, framework, description: description || `Better Auth integration guide for ${framework}`, url, setup, config, examples, }; } catch (error) { throw new McpError( ErrorCode.InvalidParams, `Integration guide for "${framework}" not found` ); } }
- src/index.ts:754-762 (helper)Input validation helper specifically for the framework parameter used by the handler.private validateFramework(args: any): string { if (!args?.framework || typeof args.framework !== "string") { throw new McpError( ErrorCode.InvalidParams, "Framework name is required and must be a string" ); } return args.framework.toLowerCase(); }