Neon PostgreSQL MCP Server

by spragginsdesigns

264 downloads Not rated yet
GitHub

About

# Neon PostgreSQL MCP Server A Model Context Protocol (MCP) server that provides secure access to Neon PostgreSQL databases, enabling AI assistants like Claude to interact with your database through standardized tools. ## Overview This MCP server allows AI assistants to: - Query data using SELECT statements - Execute…

Explore

- Secure Connection: SSL/TLS encrypted connections to Neon PostgreSQL
- Connection Pooling: Efficient database connection management
- Type Safety: Input validation for all operations
- Error Handling: Comprehensive error handling with meaningful messages
- MCP Compliance: Full implementation of the Model Context Protocol specification

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 Neon PostgreSQL MCP Server
    Command (node, npx, python, etc.)

    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

- Node.js 18+
- A Neon PostgreSQL database account and connection string
- An MCP-compatible client (e.g., Claude Desktop, Cursor IDE)

Choose one of the available implementations:

ES Module version (recommended):

node pg-mcp-server.js

CommonJS version:

node index.js

Basic version:

node basic-pg-server.js

TypeScript version:
```bash

npm install

sql

(required): SQL SELECT query to execute

params

(optional): Array of query parameters for parameterized queries

table

(required): Name of the table to describe

Execute SELECT queries to retrieve data from your database.

Parameters:
- sql (required): SQL SELECT query to execute
- params (optional): Array of query parameters for parameterized queries

Example:

SELECT * FROM users WHERE age > $1

Execute SQL statements that modify data (INSERT, UPDATE, DELETE).

Parameters:
- sql (required): SQL statement to execute
- params (optional): Array of statement parameters

Example:

INSERT INTO users (name, email) VALUES ($1, $2)

List all tables in the public schema of your database.

Parameters: None

Returns: Array of table names

Get detailed structure information about a specific table.

Parameters:
- table (required): Name of the table to describe

Returns:
- Column information (name, data type, nullable, default value)
- Primary key columns

Claude Desktop / Cursor

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

{
    "mcpServers": {
        "neon postgresql mcp server": {
            "neon-pg-mcp-server": {
                "command": "node",
                "args": [
                    "pg-mcp-server.js"
                ]
            }
        }
    }
}

McpServers

{
    "neon-pg-mcp-server": {
        "command": "node",
        "args": [
            "pg-mcp-server.js"
        ]
    }
}

A Model Context Protocol (MCP) server that provides secure access to Neon PostgreSQL databases, enabling AI assistants like Claude to interact with your database through standardized tools.

Overview

This MCP server allows AI assistants to:
- Query data using SELECT statements
- Execute data modifications (INSERT, UPDATE, DELETE)
- List available tables
- Describe table structures

The server implements multiple versions to demonstrate different approaches:
- pg-mcp-server.js - Modern ES module implementation using the latest MCP SDK
- index.js - CommonJS implementation with class-based architecture
- basic-pg-server.js - Simplified implementation with basic MCP protocol handling
- src/index.ts - TypeScript implementation (requires compilation)

Features

- Secure Connection: SSL/TLS encrypted connections to Neon PostgreSQL
- Connection Pooling: Efficient database connection management
- Type Safety: Input validation for all operations
- Error Handling: Comprehensive error handling with meaningful messages
- MCP Compliance: Full implementation of the Model Context Protocol specification

Prerequisites

- Node.js 18+
- A Neon PostgreSQL database account and connection string
- An MCP-compatible client (e.g., Claude Desktop, Cursor IDE)

Installation

1. Clone this repository:

git clone <repository-url>
cd neon-pg-server

2. Install dependencies:

npm install

3. Set up your Neon PostgreSQL connection string as an environment variable:

export NEON_PG_CONNECTION_STRING="postgresql://user:password@host/database?sslmode=require"

Usage

Running the Server

Choose one of the available implementations:

ES Module version (recommended):

node pg-mcp-server.js

CommonJS version:

node index.js

Basic version:

node basic-pg-server.js

TypeScript version:
```bash

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.