pg-mcp

NeuroviaLabs/pg-mcp
0 starsCommunity

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

Enables read-only PostgreSQL database access with query, table listing, and schema inspection tools.

README.md

neurovia-labs-pg-mcp

A lightweight MCP server for read-only PostgreSQL access. Maintains a persistent connection pool and exposes query tools for use with Claude Code or any MCP client.

Tools

| Tool | Description | |------|-------------| | query | Run a read-only SQL query (SELECT, WITH, EXPLAIN) | | list_tables | List all tables in a schema | | describe_table | Show columns and types for a table |

Usage

With npx (no install)

Add to your .mcp.json:

{
  "mcpServers": {
    "db": {
      "command": "npx",
      "args": ["github:NeuroviaLabs/pg-mcp"],
      "env": {
        "DATABASE_URL": "postgresql://user:pass@host:5432/dbname"
      }
    }
  }
}

Local

git clone git@github.com:NeuroviaLabs/pg-mcp.git
cd pg-mcp
npm install

Add to your .mcp.json:

{
  "mcpServers": {
    "db": {
      "command": "node",
      "args": ["db-server.js"],
      "env": {
        "DATABASE_URL": "postgresql://user:pass@host:5432/dbname"
      }
    }
  }
}

The connection URL can also be passed as a CLI argument:

node db-server.js postgresql://user:pass@host:5432/dbname

Features

  • Persistent connection pool (max 5 connections)
  • Read-only enforcement (SELECT/WITH/EXPLAIN only + read-only transactions)
  • 30s query timeout
  • SSL support

License

ISC

Related MCP servers

Browse all →