Back to MCP directory
publicPublicdnsLocal runtime

prisma

Prisma是一个下一代ORM工具,提供Prisma Client、Prisma Migrate和Prisma Studio等功能,支持Node.js和TypeScript,简化数据库操作。

article

README

🚀 Prisma 框架介绍

Prisma 是一款功能强大的数据库工具,它简化了数据库操作,为开发者提供了高效、便捷的数据访问方式,能显著提升开发效率。

🚀 快速开始

你可以按照以下步骤快速开启 Prisma 的使用之旅。

📦 安装指南

快速安装

通过 npm 安装 Prisma:

npm install prisma --save-dev

然后在项目根目录下初始化 Prisma 配置文件:

npx prisma init --sample

按照提示完成数据库连接配置。

💻 使用示例

基础用法

  1. 创建数据模型: 在 prisma/schema.prisma 文件中定义你的数据模型。
model User {
  id       Int      @id
  name     String
  email    String   @unique
  posts    Post[]
}

model Post {
  id       Int      @id
  title    String
  content  String?
  author   User     @relation(fields: [authorId], references: [id])
  authorId Int
}
  1. 运行数据库迁移: 在终端中执行以下命令生成并应用迁移文件:
npx prisma db pull
npx prisma db push
  1. 使用 Prisma 客户端进行查询: 在项目中导入 Prisma 客户端并使用它进行数据库操作。
import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient();

async function main() {
  const users = await prisma.user.findMany();
  console.log(users);
}

main().catch((e) => console.error(e));

👥 社区支持

Prisma 拥有一个庞大的开发者社区,欢迎加入:

🤝 项目贡献

提交问题

如果你有任何关于 Prisma 的问题,请在 GitHub 仓库中创建讨论: 👉 提交问题

报告错误

如果遇到错误或问题,请参考文档中的最佳实践创建 bug 报告: 👉 创建 bug 报告

提交功能请求

在 roadmap 上查看已有计划的功能,如果没有,请提交新功能请求: 👉 提交功能请求

📋 贡献指南

请参考我们的贡献规范和行为准则:

🧪 测试状态

  • Prisma 测试状态: Prisma Tests Status
  • 生态系统测试状态: Ecosystem Tests Status
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client