MCP Postgres Query Server MCP Server

MCP server for Claude Desktop

Local serverstdioGo

What is the MCP Postgres Query Server MCP Server?

MCP server for Claude Desktop

The short version

A Model Context Protocol (MCP) server implementation for querying a PostgreSQL database in read-only mode, designed to work with Claude Desktop and other MCP clients.

This project implements a Model Context Protocol (MCP) server that provides:

  • Read-Only Database Access — Only SELECT queries are permitted for security
  • Query Validation — Prevents potentially harmful SQL operations
  • Timeout Protection — Queries running longer than 10 seconds are automatically terminated
  • MCP Protocol Support — Complete implementation of the Model Context Protocol
  • JSON Response Formatting — Query results are returned in structured JSON format

What it needs from you

  • Node.js (v14 or later) - npm (comes with Node.js) - PostgreSQL database (connection details provided via command line)

More MCP options

Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.

Maintainer setup documentation.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

ToolWhat it does
rowsThe result set rows
rowCountNumber of rows returned
fieldsColumn metadata

How to install the MCP Postgres Query Server MCP Server

{
  "mcpServers": {
    "postgres-query": {
      "command": "node",
      "args": [
        "/path/to/your/mcp-postgres-query-server/dist/index.js",
        "postgresql://username:password@hostname:port/database"
      ]
    }
  }
}

From the project documentation. Replace placeholders and example paths before connecting.

Configuration

  • Node.js (v14 or later) - npm (comes with Node.js) - PostgreSQL database (connection details provided via command line)

Example prompts to try

  • “Use MCP Postgres Query Server to Tools.”

Frequently asked questions

MCP server for Claude Desktop Confirm the tools offered by your installed version in the connected client. Tool availability and permissions depend on the server and account configuration.