Skip to main content
Glama
prisma

Prisma MCP Server

Official
by prisma
index.ts1.14 kB
import type { SqlCommenterPlugin } from '@prisma/sqlcommenter' import { formatQueryInsight } from './format/format' /** * Creates a SQL commenter plugin that adds Prisma query shape information * to SQL queries as `prismaQuery` comments. * * The query shapes are parameterized to remove user data, making them safe * for logging and observability while still providing useful structural * information about the queries being executed. * * @example * ```ts * import { prismaQueryInsights } from '@prisma/sqlcommenter-query-insights' * * const prisma = new PrismaClient({ * adapter: myAdapter, * comments: [prismaQueryInsights()], * }) * ``` * * Output examples: * - Raw query: `/*prismaQuery='queryRaw'* /` * - Single query: `/*prismaQuery='User.findMany:eyJzZWxlY3Rpb24iOnsiJHNjYWxhcnMiOnRydWV9fX0'* /` * - Batched queries: `/*prismaQuery='User.findUnique:W3siYXJndW1lbnRzIjp7IndoZXJlIjp7ImlkIjp7IiR0eXBlIjoiUGFyYW0ifX19fV0'* /` */ export function prismaQueryInsights(): SqlCommenterPlugin { return (context) => { const insight = formatQueryInsight(context.query) return { prismaQuery: insight } } }

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/prisma/prisma'

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