Skip to main content
Glama

Prisma MCP Server

Official
by prisma
Apache 2.0
4
44,192
  • Linux
  • Apple
serializeDatasources.ts984 B
import type { DataSource } from '@prisma/generator' import type { DatasourceOverwrite } from './extractSqliteSources' // this is NOT printing datasources, but just serializing the data source // object used for generation // this is needed, as we need to print `path.resolve` statements // it basically just strips the quotes export function serializeDatasources(datasources: DatasourceOverwrite[]): string { const str = JSON.stringify(datasources, null, 2) const replaceRegex = /"('file:'.*'\))"/ return str .split('\n') .map((line) => { return line.replace(replaceRegex, (match: string) => { return match.slice(1, match.length - 1) // strip the quotes }) }) .join('\n') } // only used in one test export function datasourceToDatasourceOverwrite(datasource: DataSource): DatasourceOverwrite { return { name: datasource.name, url: datasource.url.fromEnvVar ? `env("${datasource.url.fromEnvVar}")` : datasource.url.value!, } }

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