Skip to main content
Glama

Prisma MCP Server

Official
by prisma
client-output-path.ts1.58 kB
import fs from 'node:fs' import path from 'node:path' import { getTsconfig } from 'get-tsconfig' /** * Determines the client output path relative to the schema directory. * * @param schemaDir absolute path to the schema directory * @returns client output path relative to the schema directory */ export function determineClientOutputPath(schemaDir: string): string { const sourceDir = getSourceDir() const outputPath = path.join(sourceDir, 'generated', 'prisma') const relativeOutputPath = path.relative(schemaDir, outputPath) // Normalize path separators to forward slashes return relativeOutputPath.replaceAll(path.sep, '/') } /** * Determines the absolute path to the source directory. */ function getSourceDir(): string { const projectDir = process.cwd() const sourceRootFromTsConfig = getSourceDirFromTypeScriptConfig() if (sourceRootFromTsConfig) { return path.join(projectDir, sourceRootFromTsConfig) } // Check common source directories if there's no tsconfig.json for (const dir of ['src', 'lib', 'app']) { const absoluteSourceDir = path.join(projectDir, dir) if (fs.existsSync(absoluteSourceDir)) { return absoluteSourceDir } } // Default fallback if we can't determine anything better return projectDir } function getSourceDirFromTypeScriptConfig(): string | undefined { const tsconfig = getTsconfig() if (!tsconfig) { return undefined } const { config } = tsconfig return config.compilerOptions?.rootDir ?? config.compilerOptions?.baseUrl ?? config.compilerOptions?.rootDirs?.[0] }

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