MCP.Market

PostgreSQL MCP Server

by musaddiq-dev·io.github.musaddiq-dev/postgresql-mcp-server·v0.1.2·1 stars

Python MCP server for PostgreSQL database inspection and querying

B72/100grade B
What users say
No reviews yet
Be the first
Safety scan
B72/100

full report

Adoption
New

1 stars26 downloads/wk

Reviews

Write one

Nobody has reviewed PostgreSQL MCP Server yet.

If you have run it, two minutes of your experience saves the next person an afternoon.

PostgreSQL MCP Server tools (10, 2 write)

write = sends, deletes, buys or posts

Read from the package source without running it. The installed server may list more.

  • postgresql_analyze_indexes

    Returns all indexes, their columns, and sizes for the specified table.

  • postgresql_describe_table

    Queries information_schema.columns to return column details for a table.

  • postgresql_execute_read_querywrite action

    Executes read-only SQL queries (SELECT, etc). Safe to auto-approve.

  • postgresql_execute_write_querywrite action

    Executes data modification queries (INSERT, UPDATE, DELETE, DROP). Requires manual approval.

  • postgresql_explain_query

    Prepends EXPLAIN to the query to return the execution plan without running it.

  • postgresql_get_database_summary

    Returns a comprehensive summary of the database.

  • postgresql_get_relationships

    Queries information_schema to find Foreign Keys pointing TO and FROM this table.

  • postgresql_list_tables

    Returns a list of all table names in the public schema.

  • postgresql_preview_table

    Returns the first 10 rows of a table (LIMIT 10).

  • postgresql_search_sql_definitions

    Searches information_schema.routines or pg_proc for code containing the search_term.

Public scan report

scanner v0.1.9 · 2026-09-27 · same rubric, same numbers if you re-run it

no findings
  • Code scan4 source files scanned25/25
  • –Live reliabilityno gateway calls yet and no remote to proben/a
  • –Tool poisoningtools not inspected (local package is not executed); not countedn/a
  • Auth qualitystatic API keys via environment variables6/15
  • Maintenancelast push 127 days ago8/15
  • Maintainer identityregistry namespace matches repository owner; GitHub account older than a year8/10
Overall 72/100. Components that don't apply are left out of the denominator. Any critical finding is an F.RubricAppeal a findingJSON

How PostgreSQL MCP Server compares

Against every graded Databases MCP server, from our own scans and uptime checks. Updated after each scan run.

Safety score
72/100
higher than 30% of 802 Databases servers
Tools
10
the typical Databases server has 8
Tools that change things
20%
typical: 10%. Fewer write tools means less an agent can break
GitHub stars
1
more than 45% of 601 Databases servers
Downloads a week
26
more than 13% of 324 Databases servers with a package

What its tools let an agent do: 10 send or post

Install PostgreSQL MCP Server in Claude Code, Cursor or VS Code

claude mcp add postgresql-mcp-server -- uvx mdev-postgresql-mcp-server
Add to Cursor

What the publisher says

From the PostgreSQL MCP Server repository's README, as published. We do not edit it. Read it on GitHub

<!-- mcp-name: io.github.musaddiq-dev/postgresql-mcp-server -->

PostgreSQL MCP Server

A Python Model Context Protocol (MCP) server for inspecting and querying PostgreSQL databases from MCP-compatible clients. It provides schema discovery, safe read-only query execution, query explanation, table previews, index analysis, relationship inspection, and PostgreSQL resources for table metadata.

Features

  • List public tables and inspect table schemas
  • Execute read-only SQL in a PostgreSQL read-only transaction
  • Explain query plans without executing the target query directly
  • Preview table rows with a fixed limit
  • Inspect foreign-key relationships and indexes
  • Expose passive MCP resources for table lists and schema details

Safety Model

postgresqlexecutereadquery runs with PostgreSQL read-only transaction mode, caps returned rows by POSTGRESREADQUERYLIMIT, and rolls back after execution. The server also includes postgresqlexecutewrite_query, which only accepts a single INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, or TRUNCATE statement and can modify data/schema if the connected database user has permission. Do not auto-approve write-capable tools in your MCP client. For public or shared use, run the server with a dedicated read-only PostgreSQL user.

Requirements

  • Python 3.11+
  • PostgreSQL database
  • MCP-compatible client such as Claude Desktop, Cursor, VS Code, or another MCP host

Installation

When published to PyPI, install or run the server like a standard Python MCP package:

uvx mdev-postgresql-mcp-server

For local development from source:

git clone https://github.com/musaddiq-dev/postgresql-mcp-server.git
cd postgresql-mcp-server
python -m venv .venv
source .venv/bin/activate
pip install -e .

Configuration

Copy the example environment file and update it with your database connection details.

cp .env.example .env

Example read-only user:

CREATE USER mcp_readonly WITH PASSWORD 'change-me';
GRANT CONNECT ON DATABASE your_database TO mcp_readonly;
GRANT USAGE ON SCHEMA public TO mcp_readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO mcp_readonly;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO mcp_readonly;

Running

mdev-postgresql-mcp-server

From a local checkout before PyPI publication, run:

python -m postgresql_mcp_server.server

MCP Client Configuration

For published installs, prefer uvx. MCP servers using stdio must write protocol messages only to stdout; this server writes logs to stderr through Python logging.

Claude Desktop / Cursor / Windsurf / Cline

Most MCP clients accept this mcpServers JSON shape:

{
  "mcpServers": {
    "postgresql": {
      "command": "uvx",
      "args": ["mdev-postgresql-mcp-server"],
      "env": {
        "POSTGRES_HOST": "localhost",
        "POSTGRES_PORT": "5432",
        "POSTGRES_USER": "mcp_readonly",
        "POSTGRES_PASSWORD": "change-me",
        "POSTGRES_DB": "your_database"
      }
    }
  }
}

For local development from this repository, use the installed console script path instead:

Shortened. The full README is on GitHub.

Nothing above is checked by us. What we check is on the safety report.

PostgreSQL MCP Server: common questions

Is PostgreSQL MCP Server safe?
Mostly: it is graded B (72/100). Read the PostgreSQL MCP Server safety report
How do I install PostgreSQL MCP Server?
It runs on your machine. Copy the Claude Code, Cursor, VS Code or Claude Desktop config from the install section.
Does PostgreSQL MCP Server need an API key?
Yes. The registry entry asks for POSTGRES_PASSWORD.
Is PostgreSQL MCP Server maintained?
The last commit was 163 days ago (2026-05-23). The latest release is v0.1.2.
What can I use instead of PostgreSQL MCP Server?
Servers from other publishers that do the same job: DBHub MCP server, Sling CLI MCP server and Faucet MCP server.
How does PostgreSQL MCP Server compare with other Databases MCP servers?
safety score 72/100 (higher than 30% of 802 Databases servers); tools 10 (the typical Databases server has 8); tools that change things 20% (typical: 10%. Fewer write tools means less an agent can break). Full comparison.

Alternatives to PostgreSQL MCP Server

Same job from other publishers: the closest match first, then the best rated.

  • DBHub
    Token-efficient database MCP server for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite
    A
  • Sling CLI
    Sling CLI MCP server for querying any database, running data pipelines and managing replications
    B
  • Faucet
    SQL database to MCP tools and REST API: PostgreSQL, MySQL, SQL Server, Oracle, SQLite, Snowflake.
    A
  • CogniCore
    Memory, reflection and safety for AI agents. Hosted or local, no vector database.
    A
  • ClickHouse
    Official ClickHouse MCP server for querying and exploring ClickHouse clusters and chDB.
    A

More from musaddiq-dev →