Skip to main content
Glama

Prisma MCP Server

Official
by prisma
Apache 2.0
4
44,192
  • Linux
  • Apple
unixSocket.ts1.01 kB
import { DatabaseCredentials } from '@prisma/internals' /** * match a string that looks like a unix file path * implicit relative paths are ignored due to their ambiguity with hostnames * (.e.g my-database-socket can both be a hostname and a file path missing the ./ prefix) * * example 1: an explicit relative path in the same directory * ./sockets/my-database-socket * * example 2: an explicit relative path in a parent directory * ../sockets/my-database-socket * * example 3: an absolute path * /sockets/my-database-socket * * ? for more info: https://regex101.com/r/p9md3l/1 */ const simpleUnixPathPattern = /^\.{0,2}\// export function getSocketFromDatabaseCredentials(credentials: DatabaseCredentials): string | null { if (['postgres', 'postgresql', 'cockroachdb'].includes(credentials.type)) { const host = credentials.host if (typeof host === 'string' && simpleUnixPathPattern.test(host)) { return host } return null } return credentials.socket ?? null }

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