MCPInstall
PostgreSQL logo

PostgreSQL

by a21071 a21071/mcp-postgres

Provides type-safe PostgreSQL database integration for user data management through robust CRUD operations with TypeScript and Prisma, enabling efficient and validated database interactions.

READMEmain

MCP PostgreSQL Server

-MCP Postgres Logo

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

More Database MCP servers

Similar servers from the same category.

Provides direct access to Teradata database systems with specialized tools for executing queries, exploring database structures, monitoring performance, and analyzing data quality without leaving your conversation context.

database

Enables natural language management of Prisma Postgres databases, including creating instances, running schema migrations, and managing tables through the Prisma CLI

database

VideoDB

video-db

Bridges to VideoDB's video processing capabilities for searching, indexing, subtitling, and manipulating video content through specialized context resources.

databasesearch

JDBC Database Connector

openlinksoftware

Provides a bridge between relational databases and language models through JDBC connections, enabling SQL, SPARQL, and SPASQL queries with special optimizations for Virtuoso DBMS features like knowledge graph exploration.

database