a21071
MCP Servera21071public

mcp postgres

MCP example for postgres

Repository Info

0
Stars
0
Forks
0
Watchers
1
Issues
TypeScript
Language
-
License

About This Server

MCP example for postgres

Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.

Documentation

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

  • @modelcontextprotocol/sdk - MCP server SDK
  • Prisma - Type-safe database client
  • TypeScript - Type checking

License

MIT

Quick Start

1

Clone the repository

git clone https://github.com/a21071/mcp-postgres
2

Install dependencies

cd mcp-postgres
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownera21071
Repomcp-postgres
LanguageTypeScript
License-
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation