MCP PostgreSQL Server
MCP PostgreSQL Server
-
A Model Context Protocol (MCP) server that provides PostgreSQL database operations through MCP tools.
Features
CRUD operations for User and Post entities
Type-safe database operations using Prisma
MCP-compatible tool interface
Built with TypeScript for type safety
Installation
Clone the repository
Install dependencies:
git clone https://github.com/a21071/mcp-postgres.git
cd mcp-postgres
npm installSet up PostgreSQL database:
docker-compose up -dRun database migrations:
npx prisma migrate devBuild the project:
npm run buildUsage
Run the server:
npm startAvailable MCP Tools
getData: Retrieve user data from PostgreSQL
{ "tableName": "user" }addUserData: Add new user to database
{ "email": "user@example.com", "name": "John Doe", "age": 30 }deleteUserData: Delete user by ID, email or name
{ "id": "clxyz...", "email": "user@example.com", "name": "John Doe" }updateUserData: Update user information
{ "id": "clxyz...", "email": "new@example.com", "name": "New Name" }
Database Schema
The server uses the following Prisma schema:
model User {
id String @id @default(cuid())
email String @unique
name String?
age Int?
createdAt DateTime @default(now())
posts Post[]
}
Development
Watch mode:
npm run watchDependencies
@modelcontextprotocol/sdk - MCP server SDK
Prisma - Type-safe database client
TypeScript - Type checking
License
MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/a21071/mcp-postgres'
If you have feedback or need assistance with the MCP directory API, please join our Discord server