Skip to main content
Glama
AlyssonM

HiveAuth MCP Server

by AlyssonM

verify_credential

Verify verifiable credentials by checking signature authenticity, issuer validity, and revocation status to ensure trust and compliance.

Instructions

Verify a verifiable credential for authenticity, integrity, and revocation status. Checks signature, issuer validity, and status list compliance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
credentialYesThe verifiable credential to verify

Implementation Reference

  • Core implementation of the verify_credential tool handler. Validates input, calls HiveAuth verification API, formats success/error responses with detailed status and raw JSON output.
    export async function verifyCredential(args: any): Promise<CallToolResult> {
      // Validate and sanitize input
      const validation = validateAndSanitizeInput(VerifyCredentialInputSchema, args, 'verify_credential');
      
      if (!validation.success) {
        return createValidationErrorResult(validation.error!);
      }
    
      const data = validation.data!;
      const { credential } = data;
    
      const HIVEAUTH_API_BASE_URL = process.env.HIVEAUTH_API_BASE_URL || 'http://localhost:3000';
      const VERIFY_ENDPOINT = `${HIVEAUTH_API_BASE_URL}/api/verify`;
    
      try {
        const response = await fetch(VERIFY_ENDPOINT, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
          },
          body: JSON.stringify({ credential }),
        });
    
        if (!response.ok) {
          const errorData = await response.json().catch(() => ({ message: response.statusText }));
          throw new Error(`Failed to verify credential: ${errorData.message}`);
        }
    
        const result = await response.json();
    
        const statusText = result.verified ? '✅ VERIFIED' : '❌ INVALID';
        const details = [];
    
        if (result.verified) {
          details.push('• Signature verification: ✅ Valid');
          details.push('• Issuer verification: ✅ Valid');
          details.push('• Status check: ✅ Not revoked');
          
          if (result.credential?.validFrom) {
            details.push(`• Valid from: ${result.credential.validFrom}`);
          }
          if (result.credential?.validUntil) {
            details.push(`• Valid until: ${result.credential.validUntil}`);
          }
        } else {
          details.push(`• Error: ${result.message || 'Unknown verification error'}`);
          if (result.errors) {
            result.errors.forEach((error: string) => {
              details.push(`• ${error}`);
            });
          }
        }
    
        return {
          content: [
            {
              type: 'text',
              text: `Credential Verification Result: ${statusText}\n\n${details.join('\n')}`
            },
            {
              type: 'text',
              text: `\`\`\`json\n${JSON.stringify(result, null, 2)}\n\`\`\``
            }
          ]
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: `Failed to verify credential: ${error.message}`
            }
          ],
          isError: true
        };
      }
  • Zod input schema for the verify_credential tool, requiring a verifiable credential object.
    export const VerifyCredentialInputSchema = z.object({
      credential: CredentialSchema.describe('The verifiable credential to verify')
    });
  • Registers the 'verify_credential' tool name, description, and input schema reference in TOOL_DEFINITIONS array used by createMCPTools() to generate MCP Tool objects.
    name: 'verify_credential',
    description: 'Verify a verifiable credential for authenticity, integrity, and revocation status. Checks signature, issuer validity, and status list compliance.',
    inputSchema: TOOL_SCHEMAS.verify_credential
  • src/index.ts:86-87 (registration)
    Dispatches calls to the 'verify_credential' tool by invoking the verifyCredential handler function.
    case 'verify_credential':
      return await verifyCredential(args);
  • Maps the tool name 'verify_credential' to its input schema in TOOL_SCHEMAS lookup object.
    verify_credential: VerifyCredentialInputSchema,

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/AlyssonM/hiveauth-mcp'

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