Skip to main content
Glama

Prisma MCP Server

Official
by prisma
Apache 2.0
4
44,231
  • Linux
  • Apple
show.ts2.16 kB
import type { PrismaConfigInternal } from '@prisma/config' import { Command } from '@prisma/internals' import { argOrThrow } from '../_lib/cli/parameters' import { messages } from '../_lib/messages' import { requestOrThrow } from '../_lib/pdp' import { getTokenOrThrow, platformParameters } from '../_lib/utils' export class Show implements Command { public static new() { return new Show() } public async parse(argv: string[], _config: PrismaConfigInternal): Promise<string | Error> { const args = argOrThrow(argv, { ...platformParameters.global, }) const token = await getTokenOrThrow(args) const userWorkspaces = await getUserWorkspacesOrThrow({ token }) return messages.resourceList(userWorkspaces) } } export const getUserWorkspacesOrThrow = async (input: { token: string }) => { const { token } = input const { me } = await requestOrThrow<{ me: { workspaces: { __typename: string id: string displayName: string createdAt: string isDefault: boolean }[] } }>({ token, body: { query: /* GraphQL */ ` query { me { __typename workspaces { id displayName createdAt isDefault } } } `, }, }) return me.workspaces } export const getDefaultWorkspaceOrThrow = async (input: { token: string }) => { const { token } = input const { me } = await requestOrThrow<{ me: { workspaces: { __typename: string id: string displayName: string createdAt: string isDefault: boolean }[] } }>({ token, body: { query: /* GraphQL */ ` query { me { __typename workspaces { id displayName createdAt isDefault } } } `, }, }) const defaultWorkspace = me.workspaces.find((_) => _.isDefault) if (!defaultWorkspace) { throw new Error('No default workspace found') } return defaultWorkspace }

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