Skip to main content
Glama

Prisma MCP Server

Official
by prisma
Apache 2.0
4
44,192
  • Linux
  • Apple
resolvePkg.ts1.04 kB
import path from 'path' import resolve from 'resolve' /** * Alternative to `require.resolve` that returns undefined instead of throwing. * It also enables preserving symlinks, which is not possible with the original * `require.resolve`. This variant will find the _entrypoint_ of a package. */ async function resolveOrUndefined(id: string, options: resolve.AsyncOpts) { const _options = { preserveSymlinks: false, ...options } return new Promise((res) => { resolve(id, _options, (e, v) => { if (e) res(undefined) res(v) }) }) as Promise<string | undefined> } /** * Alternative to `require.resolve` that returns undefined instead of throwing. * It also enables preserving symlinks, which is not possible with the original * `require.resolve`. This variant will find the _root_ of a package. */ export async function resolvePkg(id: string, options: resolve.AsyncOpts) { const resolvedPath = await resolveOrUndefined(`${id}/package.json`, options) return resolvedPath && path.dirname(resolvedPath) }

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