Skip to main content
Glama

1MCP Server

authRequestRepository.ts1.88 kB
import { randomUUID } from 'node:crypto'; import { AuthRequestData } from '@src/auth/sessionTypes.js'; import { AUTH_CONFIG } from '@src/constants.js'; import logger from '@src/logger/logger.js'; import { FileStorageService } from './fileStorageService.js'; /** * Repository for authorization request operations * * Manages temporary authorization requests used in the consent flow. * These store OAuth parameters securely server-side while user reviews consent. */ export class AuthRequestRepository { constructor(private storage: FileStorageService) {} /** * Creates a new authorization request */ create( clientId: string, redirectUri: string, codeChallenge?: string, state?: string, resource?: string, scopes?: string[], ): string { const authRequestId = AUTH_CONFIG.SERVER.AUTH_REQUEST.ID_PREFIX + randomUUID(); const authRequestData: AuthRequestData = { clientId, redirectUri, codeChallenge, state, resource, scopes, expires: Date.now() + AUTH_CONFIG.SERVER.AUTH_REQUEST.TTL_MS, createdAt: Date.now(), }; this.storage.writeData(AUTH_CONFIG.SERVER.AUTH_REQUEST.FILE_PREFIX, authRequestId, authRequestData); logger.info(`Created auth request: ${authRequestId} for client: ${clientId}`); return authRequestId; } /** * Retrieves authorization request data by ID */ get(authRequestId: string): AuthRequestData | null { return this.storage.readData<AuthRequestData>(AUTH_CONFIG.SERVER.AUTH_REQUEST.FILE_PREFIX, authRequestId); } /** * Deletes an authorization request by ID */ delete(authRequestId: string): boolean { const result = this.storage.deleteData(AUTH_CONFIG.SERVER.AUTH_REQUEST.FILE_PREFIX, authRequestId); if (result) { logger.info(`Deleted auth request: ${authRequestId}`); } return result; } }

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/1mcp-app/agent'

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