MCP PostgreSQL 服务器基于模型上下文协议(MCP)构建,借助 MCP 工具实现对 PostgreSQL 数据库的便捷操作,为数据库管理提供高效解决方案。
MCP PostgreSQL 服务器可通过一系列简单步骤完成安装与启动,以下是详细指引:
git clone https://github.com/a21071/mcp-postgres.git
cd mcp-postgres
npm install
docker-compose up -d
npx prisma migrate dev
npm run build
npm start
运行服务器:
npm start
{
"tableName": "user"
}
{
"email": "user@example.com",
"name": "John Doe",
"age": 30
}
{
"id": "clxyz...",
"email": "user@example.com",
"name": "John Doe"
}
{
"id": "clxyz...",
"email": "new@example.com",
"name": "New Name"
}
该服务器使用以下 Prisma 模式:
model User {
id String @id @default(cuid())
email String @unique
name String?
age Int?
createdAt DateTime @default(now())
posts Post[]
}
若需在开发过程中实时监控代码变化,可使用监视模式:
npm run watch
本项目采用 MIT 许可证。