Skip to main content
Glama

Prisma MCP Server

Official
by prisma
CLI.test.ts2.68 kB
import { defaultTestConfig } from '@prisma/config' import { jestConsoleContext, jestContext } from '@prisma/get-platform' import { CLI } from '../../CLI' import { Validate } from '../../Validate' const ctx = jestContext.new().add(jestConsoleContext()).assemble() function createCLI(download = jest.fn()) { return CLI.new( { // init: Init.new(), // migrate: MigrateCommand.new({ // diff: MigrateDiff.new(), // dev: MigrateDev.new(), // status: MigrateStatus.new(), // resolve: MigrateResolve.new(), // reset: MigrateReset.new(), // deploy: MigrateDeploy.new(), // }), // db: DbCommand.new({ // pull: DbPull.new(), // push: DbPush.new(), // // drop: DbDrop.new(), // seed: DbSeed.new(), // }), // dev: Dev.new(), // generate: Generate.new(), // version: Version.new(), validate: Validate.new(), // format: Format.new(), // telemetry: Telemetry.new(), }, ['version', 'init', 'migrate', 'db', 'dev', 'generate', 'validate', 'format', 'telemetry'], download, ) } describe('CLI', () => { const download = jest.fn() let cliInstance: CLI beforeEach(() => { cliInstance = createCLI(download) }) afterEach(() => { download.mockClear() }) describe('ensureNeededBinariesExist', () => { it('should download schema engine', async () => { ctx.fixture('ensure-needed-binaries-exist') await cliInstance.parse(['validate', '--schema', './using-query-compiler.prisma'], defaultTestConfig()) expect(download).toHaveBeenCalledWith( expect.objectContaining({ binaries: { 'schema-engine': expect.any(String), }, }), ) }) }) it('no params should return help', async () => { const spy = jest.spyOn(cliInstance, 'help').mockImplementation(() => 'Help Me') await cliInstance.parse([], defaultTestConfig()) expect(spy).toHaveBeenCalledTimes(1) spy.mockRestore() }) it('wrong flag', async () => { const spy = jest.spyOn(cliInstance, 'help').mockImplementation(() => 'Help Me') await cliInstance.parse(['--something'], defaultTestConfig()) expect(spy).toHaveBeenCalledTimes(1) spy.mockRestore() }) it('help flag', async () => { const spy = jest.spyOn(cliInstance, 'help').mockImplementation(() => 'Help Me') await cliInstance.parse(['--help'], defaultTestConfig()) expect(spy).toHaveBeenCalledTimes(1) spy.mockRestore() }) it('unknown command', async () => { await expect(cliInstance.parse(['doesnotexist'], defaultTestConfig())).resolves.toThrow() }) })

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