Skip to main content
Glama
dabhivijay2478

Better Auth MCP Server

get_feature_details

Retrieve detailed documentation and setup information for Better Auth authentication features like two-factor, GitHub integration, or database adapters.

Instructions

Get detailed information about a specific Better Auth plugin or feature

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
featureNameYesName of the Better Auth feature (e.g., "two-factor", "github", "drizzle")

Implementation Reference

  • The main handler function for the get_feature_details tool. It validates the feature name, checks cache, fetches detailed information if needed, caches the result, and returns a standardized response.
    private async handleGetFeatureDetails(args: any) {
      const featureName = this.validateFeatureName(args);
    
      try {
        // Check cache first
        if (this.featureCache.has(featureName)) {
          return this.createSuccessResponse(this.featureCache.get(featureName));
        }
    
        // Fetch detailed feature information
        const featureInfo = await this.fetchFeatureDetails(featureName);
        
        // Save to cache
        this.featureCache.set(featureName, featureInfo);
        
        return this.createSuccessResponse(featureInfo);
      } catch (error) {
        this.handleAxiosError(error, `Feature "${featureName}"`);
      }
    }
  • src/index.ts:149-162 (registration)
    Registration of the get_feature_details tool in the MCP server's tool list, including name, description, and input schema definition.
    {
      name: "get_feature_details",
      description: "Get detailed information about a specific Better Auth plugin or feature",
      inputSchema: {
        type: "object",
        properties: {
          featureName: {
            type: "string",
            description: "Name of the Better Auth feature (e.g., \"two-factor\", \"github\", \"drizzle\")",
          },
        },
        required: ["featureName"],
      },
    },
  • src/index.ts:225-226 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes get_feature_details calls to the handleGetFeatureDetails method.
    case "get_feature_details":
      return await this.handleGetFeatureDetails(request.params.arguments);
  • Key helper function that performs the actual data fetching and web scraping to get detailed feature information from Better Auth documentation.
    private async fetchFeatureDetails(featureName: string): Promise<BetterAuthFeature> {
      // Find the feature in our categories
      const category = this.findFeatureCategory(featureName);
      if (!category) {
        throw new McpError(ErrorCode.InvalidParams, `Unknown feature: ${featureName}`);
      }
    
      const basicInfo = await this.fetchFeatureBasicInfo(featureName, category);
      
      try {
        const response = await this.axiosInstance.get(basicInfo.url);
        const $ = cheerio.load(response.data);
        
        // Extract detailed information
        const description = this.extractDescription($);
        const installation = this.extractInstallation($);
        const usage = this.extractUsage($);
        const config = this.extractConfiguration($);
        const examples = this.extractExamples($);
        
        return {
          ...basicInfo,
          description: description || basicInfo.description,
          installation,
          usage,
          config,
          examples,
        };
      } catch (error) {
        // Return basic info if detailed fetch fails
        return basicInfo;
      }
    }
  • Validation helper used by the handler to validate and normalize the featureName input parameter.
    private validateFeatureName(args: any): string {
      if (!args?.featureName || typeof args.featureName !== "string") {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Feature name is required and must be a string"
        );
      }
      return args.featureName.toLowerCase();
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dabhivijay2478/better-auth-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server