Skip to main content
Glama

Prisma MCP Server

Official
by prisma
Apache 2.0
4
44,213
  • Linux
  • Apple
jwt.ts1.01 kB
import { isError } from '@prisma/internals' import { isObject, tryCatch } from './prelude' export interface JWT { jti?: string sub?: string iat?: number } export const decodeJwt = (jwt: string): JWT | Error => { if (typeof jwt !== 'string') throw new Error('JWTs must use Compact JWS serialization, JWT must be a string') const { 1: payload, length } = jwt.split('.') if (length === 5) throw new Error('Only JWTs using Compact JWS serialization can be decoded') if (length !== 3) throw new Error('Invalid JWT') if (!payload) throw new Error('JWTs must contain a payload') const decoded = tryCatch( () => atob(payload), () => new Error('Failed to base64 decode the payload.'), ) if (isError(decoded)) return decoded const result = tryCatch( () => JSON.parse(decoded), () => new Error('Failed to parse the decoded payload as JSON.'), ) if (isError(result)) return result if (!isObject(result)) throw new Error('Invalid JWT Claims Set.') 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/prisma/prisma'

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