CAT
/MCP
SkillsMCPMarketplacesDigestToolsAdvertise

This week in Claude

Every Monday: Claude Code, Agent SDK, MCP, and the Anthropic platform moves worth your time.

Skills by Category
Frontend DevelopmentBackend & APIsTesting & QASecurityDevOps & CI/CDGit & Pull RequestsDocumentationCode Review & QualityAI & Agent BuildingSkill Development
MCP Servers by Category
Sales & MarketingWeb & Browser AutomationDatabasesAI & LLM ToolsCloud & InfrastructureCommunication & MessagingDeveloper ToolsDesign & CreativeDocuments & KnowledgeSearch & Web Crawling
Marketplaces by Category
AI Agents & OrchestrationLLM IntegrationDevelopment ToolsFrontend & UIBackend & APIsDatabasesTesting & Code QualityDevOps & CloudSecurity & ComplianceGit & Version Control

Cross AI Tools

Discover Claude Code plugins, extensions, and tools. Automatically updated directory of Anthropic Claude AI marketplaces with development tools, productivity plugins, and integrations.

Resources

  • Browse Skills
  • Browse MCP Servers
  • Browse Marketplaces
  • Plugins Reference

Community

  • About
  • Tools
  • Feedback
  • Privacy Policy
  • Advertise

Built for the Claude Code community with Claude Code by @mertduzgun

Independent project, not affiliated with Anthropic

PostgreSQL MCP Server

musaddiq-dev/postgresql-mcp-server
1 toolsauthSTDIOregistry active
Summary

Connects Claude to PostgreSQL databases with a full suite of inspection and querying tools. You get schema discovery, read-only query execution with automatic row limits and transaction rollback, query plan explanations, foreign key relationship mapping, and index analysis. The write query tool accepts single INSERT, UPDATE, DELETE, or DDL statements and commits them, so you'll want a read-only user for most workflows. Exposes MCP resources for table lists and schema definitions. Ships with configurable row limits and runs queries in explicit read-only transaction mode for safety. Install via uvx and configure with standard Postgres connection parameters.

CodeRabbit
CodeRabbit
AI writes the code. CodeRabbit catches the slop.
Try For Free →
Keep your Mac awake
Keep your Mac awake
Keep your Mac awake while Claude Code and 40+ AI agents run. Sleeps when they're idle.
One time payment $9 →
Context.devContext.dev
Context.dev
Integrate web data into your AI product. One API to scrape website & brand data.
Get API Key Now →
Make your agent a DeFi expert
Make your agent a DeFi expert
Agent, run crypto. Access onchain data & trade routes via 1inch.
Install now →
Make money from your Skills
Make money from your Skills
On Capafy, your Skill runs online 24/7 as an agent product, and you get paid every time someone uses it.
Start earning →
AppSignal
AppSignal
Monitor with ease. Code with confidence.
Start Free Trial →
CodeRabbit
CodeRabbit
AI writes the code. CodeRabbit catches the slop.
Try For Free →
Keep your Mac awake
Keep your Mac awake
Keep your Mac awake while Claude Code and 40+ AI agents run. Sleeps when they're idle.
One time payment $9 →
Context.devContext.dev
Context.dev
Integrate web data into your AI product. One API to scrape website & brand data.
Get API Key Now →
Make your agent a DeFi expert
Make your agent a DeFi expert
Agent, run crypto. Access onchain data & trade routes via 1inch.
Install now →
Make money from your Skills
Make money from your Skills
On Capafy, your Skill runs online 24/7 as an agent product, and you get paid every time someone uses it.
Start earning →
AppSignal
AppSignal
Monitor with ease. Code with confidence.
Start Free Trial →

Tools

Public tool metadata for what this MCP can expose to an agent.

1 tools
execute_custom_queryExecute a custom SQL query against the database. WARNING: Use with care. Do not expose to untrusted input.4 params

Execute a custom SQL query against the database. WARNING: Use with care. Do not expose to untrusted input.

Parameters* required
querystring
SQL query to execute
valuesarray
Optional parameter values for the query
timeoutnumber
Optional query timeout in milliseconds
connectionStringstring
PostgreSQL connection string

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

postgresql_execute_read_query runs with PostgreSQL read-only transaction mode, caps returned rows by POSTGRES_READ_QUERY_LIMIT, and rolls back after execution. The server also includes postgresql_execute_write_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
VariableDescriptionRequiredDefault
POSTGRES_HOSTPostgreSQL hostYeslocalhost
POSTGRES_PORTPostgreSQL portYes5432
POSTGRES_USERPostgreSQL usernameYesNone
POSTGRES_PASSWORDPostgreSQL passwordNoNone
POSTGRES_DBPostgreSQL database nameYesNone
LOG_LEVELPython logging level written to stderrNoINFO
POSTGRES_READ_QUERY_LIMITMaximum rows returned by read queriesNo1000

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:

{
  "mcpServers": {
    "postgresql": {
      "command": "/absolute/path/to/postgresql-mcp-server/.venv/bin/mdev-postgresql-mcp-server",
      "args": [],
      "env": {
        "POSTGRES_HOST": "localhost",
        "POSTGRES_PORT": "5432",
        "POSTGRES_USER": "mcp_readonly",
        "POSTGRES_PASSWORD": "change-me",
        "POSTGRES_DB": "your_database"
      }
    }
  }
}

Claude Code CLI

claude mcp add postgresql \
  --env POSTGRES_HOST=localhost \
  --env POSTGRES_PORT=5432 \
  --env POSTGRES_USER=mcp_readonly \
  --env POSTGRES_PASSWORD=change-me \
  --env POSTGRES_DB=your_database \
  -- uvx mdev-postgresql-mcp-server

VS Code MCP

VS Code uses the same command/args/env model in its MCP configuration:

{
  "servers": {
    "postgresql": {
      "type": "stdio",
      "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"
      }
    }
  }
}

Tools

ToolPurposeSafety
postgresql_list_tablesList public base tablesRead-only
postgresql_describe_tableShow columns and metadata for a tableRead-only
postgresql_execute_read_queryRun bounded SQL under read-only transaction modeRead-only
postgresql_execute_write_queryRun a single approved modifying SQL statement and commitDestructive
postgresql_explain_queryReturn PostgreSQL EXPLAIN output for a single queryRead-only
postgresql_get_database_summaryReturn database version and table countRead-only
postgresql_get_relationshipsInspect foreign-key relationshipsRead-only
postgresql_analyze_indexesInspect indexes and sizesRead-only
postgresql_preview_tableReturn up to 10 rows from a tableRead-only
postgresql_search_sql_definitionsSearch public SQL routines/functionsRead-only

Resources

  • postgres://list_tables returns public table names.
  • postgres://schema/{table_name} returns a generated schema statement for a table.

Smoke Check

Without a database, verify syntax with:

python -m py_compile src/postgresql_mcp_server/server.py

With a configured database, start the server and use your MCP client to call list_tables.

Distribution

This server is published through the standard Python MCP distribution path:

  • PyPI package: mdev-postgresql-mcp-server
  • MCP Registry name: io.github.musaddiq-dev/postgresql-mcp-server
  • Runtime hint: uvx
  • Transport: stdio

The mcp-name marker at the top of this README is required for MCP Registry ownership verification. Users should prefer uvx mdev-postgresql-mcp-server in local MCP client configurations.

Security Notes

  • Do not commit .env or MCP client configs containing credentials.
  • Use least-privilege database users.
  • Treat execute_write_query as destructive and require explicit user approval in your MCP client.
  • Review generated SQL before running write-capable tools.

License

MIT

Featured
CodeRabbit
CodeRabbit
AI writes the code. CodeRabbit catches the slop.
Try For Free →
Keep your Mac awake
Keep your Mac awake
Keep your Mac awake while Claude Code and 40+ AI agents run. Sleeps when they're idle.
One time payment $9 →
Context.devContext.dev
Context.dev
Integrate web data into your AI product. One API to scrape website & brand data.
Get API Key Now →
Make your agent a DeFi expert
Make your agent a DeFi expert
Agent, run crypto. Access onchain data & trade routes via 1inch.
Install now →
Make money from your Skills
Make money from your Skills
On Capafy, your Skill runs online 24/7 as an agent product, and you get paid every time someone uses it.
Start earning →
AppSignal
AppSignal
Monitor with ease. Code with confidence.
Start Free Trial →

Configuration

POSTGRES_HOST*default: localhost

PostgreSQL host

POSTGRES_PORT*default: 5432

PostgreSQL port

POSTGRES_USER*

PostgreSQL username

POSTGRES_PASSWORDsecret

PostgreSQL password

POSTGRES_DB*

PostgreSQL database name

POSTGRES_READ_QUERY_LIMITdefault: 1000

Maximum rows returned by read queries

Categories
Databases
Registryactive
Packagemdev-postgresql-mcp-server
TransportSTDIO
AuthRequired
UpdatedMay 23, 2026
View on GitHub

Related Databases MCP Servers

View all →
Postgres

ai.waystation/postgres

Connect to your PostgreSQL database to query data and schemas.
54
Read Only Local Postgres Mcp Server

hovecapital/read-only-local-postgres-mcp-server

MCP server for read-only PostgreSQL database queries in Claude Desktop
2
Database Mcp

cocaxcode/database-mcp

MCP server for database connectivity. Multi-DB (PostgreSQL, MySQL, SQLite), 19 tools.
1
Mcp Mysql

io.github.infoinlet-marketplace/mcp-mysql

Read-only MySQL/MariaDB for AI agents — query, list/describe tables, health. SQL-guarded.
Database Admin

io.github.cybeleri/database-admin

Database admin MCP: schema inspection, query optimization for PostgreSQL and MySQL
Postgres Secured (Aegis Zero-Trust)

io.github.yash-0620/postgres-mcp-secured

Enterprise PostgreSQL MCP secured by Aegis Zero-Trust to block unauthorized SQL injections.