PostgreSQL

by a21071

Not rated
GitHub

About

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

Details

Author
a21071
Repository
a21071/mcp-postgres
Categories
Design, Developer Tools, Database, Frontend, Infrastructure
Tags
#integration

- CRUD operations for User and Post entities
- Type-safe database operations using Prisma
- MCP-compatible tool interface
- Built with TypeScript for type safety

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name PostgreSQL
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 -y
    • Argument 2 @highlight/mcp-server

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Run the server:

npm start

getData

Retrieve user data from PostgreSQL. Parameters: tableName (string)

addUserData

Add new user to the database. Parameters: email (string), name (string), age (integer)

deleteUserData

Delete user by ID, email, or name. Parameters: id (string, optional), email (string, optional), name (string, optional)

updateUserData

Update user information. Parameters: id (string), email (string, optional), name (string, optional)

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "postgresql": {
            "env": {},
            "args": [
                "-y",
                "@highlight/mcp-server"
            ],
            "command": "npx"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Macos

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "npx",
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "cmd"
}

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

3. Set up PostgreSQL database:

docker-compose up -d

4. Run database migrations:

npx prisma migrate dev

5. 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

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.