import { randomUUID } from "node:crypto"; import type { OAuthRegisteredClientsStore } from "@modelcontextprotocol/sdk/server/auth/clients.js"; import type { OAuthClientInformationFull } from "@modelcontextprotocol/sdk/shared/auth.js"; export class InMemoryClientsStore implements OAuthRegisteredClientsStore { private clients = new Map(); getClient(clientId: string): OAuthClientInformationFull | undefined { return this.clients.get(clientId); } registerClient( clientMetadata: Omit, ): OAuthClientInformationFull { const clientId = randomUUID(); const client: OAuthClientInformationFull = { ...clientMetadata, client_id: clientId, client_id_issued_at: Math.floor(Date.now() / 1000), }; this.clients.set(clientId, client); return client; } }