logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

mcp-postgres

Perform seamless CRUD operations on a PostgreSQL database with type safety, allowing efficient management of user data and post entities. Utilize a robust MCP-compatible tool interface for reliable database interactions.

Author

mcp-postgres logo

a21071

No License

Quick Info

GitHub GitHub Stars 0
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

postgresapispostgresqlmcp postgresapis httppostgresql database

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

  1. Clone the repository
  2. Install dependencies:
git clone https://github.com/a21071/mcp-postgres.git
cd mcp-postgres
npm install
  1. Set up PostgreSQL database:
docker-compose up -d
  1. Run database migrations:
npx prisma migrate dev
  1. Build the project:
npm run build

Usage

Run the server:

npm start

Available MCP Tools

  • getData: Retrieve user data from PostgreSQL

json { "tableName": "user" }

  • addUserData: Add new user to database

json { "email": "user@example.com", "name": "John Doe", "age": 30 }

  • deleteUserData: Delete user by ID, email or name

json { "id": "clxyz...", "email": "user@example.com", "name": "John Doe" }

  • updateUserData: Update user information json { "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 watch

Dependencies

License

MIT

See Also

`