概览
What is Prisma MCP Server?
This package provides a Model Context Protocol (MCP) server that acts as an interface to a database managed by Prisma ORM. It allows MCP-compatible clients (like AI assistants or other applications) to interact with your database by querying resources and executing tools.
How to use Prisma MCP Server?
Install the package and @prisma/client as a peer dependency, generate the Prisma Client from your schema, set the required DATABASE_URL environment variable (and optionally TRANSPORT_TYPE, PORT, etc.), then call createPrismaMcpServer and start the server with the desired transport (stdio or sse). An example TypeScript entry point is provided in the README.
Features of Prisma MCP Server
- Exposes Prisma models as readable MCP resources.
- Provides MCP tools for CRUD operations on models.
- Handles translation between MCP requests and Prisma Client queries.
- Supports configurable
stdioorsse(HTTP) transport. - Easily extensible by adding custom resources or tools.
Use cases of Prisma MCP Server
- Query database records (e.g., users, projects) via MCP resource URIs.
- Perform create, update, or delete operations on any Prisma model through MCP tools.
- Integrate an AI assistant like Claude Desktop with a database-backed application.
FAQ from Prisma MCP Server
What are the prerequisites for using Prisma MCP Server?
You need Node.js, a project with @prisma/client installed, a prisma/schema.prisma file, and a running database supported by Prisma (e.g., PostgreSQL, MySQL, SQLite).
How do I configure the transport mode?
Set the TRANSPORT_TYPE environment variable to sse to use Server‑Sent Events over HTTP; otherwise it defaults to stdio. When using sse, you can optionally set PORT (defaults to 8080).
Where is the database connection configured?
In the DATABASE_URL environment variable. This must be set to a valid database connection string. It should never be committed to version control.
Can I add custom resources or tools?
Yes. Fork or modify the package source; edit src/resources.ts and src/tools.ts to add custom resources and tools, then rebuild with yarn build.
How do I connect Claude Desktop to this server?
For stdio: configure Claude Desktop to launch your application (e.g., npx cadcamfun-db-mcp-server). For sse: point Claude Desktop to http://localhost:8080/sse (or a custom port). Example mcp.json snippets are provided in the README.