MCP PostgreSQL Server

by a21071

Integrations

  • Provides database operations for PostgreSQL, enabling CRUD operations on User and Post entities with type-safe queries through the MCP interface

  • Utilizes Prisma for type-safe database operations, providing a structured interface to interact with the PostgreSQL database schema

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
    { "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 watch

Dependencies

License

MIT

-
security - not tested
F
license - not found
-
quality - not tested

A Model Context Protocol server that enables performing PostgreSQL database operations (create, read, update, delete) on User and Post entities through MCP tools.

  1. Features
    1. Installation
      1. Usage
        1. Available MCP Tools
      2. Database Schema
        1. Development
          1. Dependencies
            1. License

              Related MCP Servers

              • -
                security
                A
                license
                -
                quality
                A Model Context Protocol server that provides read-only access to PostgreSQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.
                Last updated -
                1
                14,119
                43,961
                JavaScript
                MIT License
                • Apple
                • Linux
              • -
                security
                F
                license
                -
                quality
                A server implementing the Model Context Protocol (MCP) for Cursor that allows using a PostgreSQL database as storage for model contexts, enabling secure database exploration and querying.
                Last updated -
                JavaScript
                • Linux
                • Apple
              • -
                security
                F
                license
                -
                quality
                A Model Context Protocol server providing both read and write access to PostgreSQL databases, enabling LLMs to query data, modify records, and manage database schemas.
                Last updated -
                4
                JavaScript
              • -
                security
                F
                license
                -
                quality
                A Model Context Protocol server that enables interaction with PostgreSQL databases to list tables, retrieve schemas, and execute read-only SQL queries.
                Last updated -
                14,119
                JavaScript
                • Linux
                • Apple

              View all related MCP servers

              ID: kf076lifqy