PostgreSQL MCP Server

PostgreSQL MCP Server

postgres-mcp-server-aadarshjain•byaadarshjain

A Model Context Protocol server that connects to a PostgreSQL database and exposes data discovery and querying capabilities as MCP tools.

License: Not specified•Runtime: Awaiting documentation review•Category: databases storage

WHAT IT DOES

  • •Connects to any PostgreSQL database using a standard connection string.
  • •Executes custom SELECT queries and returns results in a structured format, with only SELECT queries allowed to prevent database modifications.
  • •Lists tables, provides table schema details, and filters records by simple equality conditions.
  • •Provides database statistics including size, table count, and largest tables.

BEST FOR

  • •Exploring database structure and asking which tables are available.
  • •Inspecting the schema of a specific table.
  • •Counting records in a table or checking overall database size.

ABOUT POSTGRES-MCP-SERVER-AADARSHJAIN

PostgreSQL MCP Server is cataloged as an MCP server attributed to aadarshjain. A Model Context Protocol server that connects to a PostgreSQL database and exposes data discovery and querying capabilities as MCP tools. It is categorized under databases storage. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for PostgreSQL MCP Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Does the server allow queries that modify the database?

No, it only allows SELECT queries to prevent database modifications.

How are database connection credentials handled?

Credentials are provided via command line and not stored.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 98ab3909d895 · 采集于 2026-11-13 10:51:46 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

Certified by mcpreview.com

PostgreSQL MCP Server

A Model Context Protocol (MCP) server implementation for PostgreSQL database exploration and querying.

Table of Contents

Overview

This project provides a Model Context Protocol (MCP) server that connects to a PostgreSQL database and exposes various data discovery and querying capabilities as MCP tools. These tools allow you to explore database structure, query data, and get database statistics through a standardized interface.

Features

  • Connect to any PostgreSQL database using a standard connection string
  • Execute custom SELECT queries with results returned in a structured format
  • List all tables in the connected database
  • Get detailed schema information for any table
  • Filter database records with simple equality conditions
  • Get database statistics including size, table count, and largest tables

Requirements

  • Python 3.7+
  • Required Python packages (listed in requirements.txt):
    • mcp
    • pg8000
    • sqlalchemy

Installation

  1. Clone this repository or download the source code
  2. Create a virtual environment (recommended)
  3. Install the required packages:
pip install -r requirements.txt

Usage

Basic Usage

Run the server by providing a PostgreSQL connection string:

python server.py postgresql://username:password@hostname:port/database

Using with Claude Desktop

To integrate with Claude Desktop, add the following configuration to your Claude Desktop config file:

{
  "mcpServers": {
    "postgres": {
      "command": "python",
      "args": [
        "/ABOSLUTE/PATH/TO/postgres-mcp-server/server.py",
        "postgresql://user:password@host:port/database"
      ]
    }
  }
}

After adding or making any changes to above config file, make sure to relaunch the claude desktop by force quitting it.

Configuration File Location

The Claude Desktop configuration file is typically located at:

  • macOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Available Tools

The server provides the following MCP tools:

Tools

execute_query

Execute a custom SELECT SQL query and return the results.

list_tables

List all tables in the current PostgreSQL database.

get_table_schema

Get the schema definition for a specified table.

filter_instances

Filter database records based on specified criteria.

get_database_stats

Get general statistics and metadata about the PostgreSQL database.

Security Considerations

  • This server only allows SELECT queries to prevent database modifications
  • Connection credentials are provided via command line and not stored
  • Consider using environment variables or a secure configuration method in production environments

Example Interaction in Claude

Once connected to Claude Desktop, you can ask questions like:

  • "What tables are available in the database?"
  • "Show me the schema for the customers table"
  • "How many records are in the orders table?"
  • "What's the total size of the database?"

Output

Claude will use the appropriate MCP tools to answer these questions by querying your PostgreSQL database.

Troubleshooting

  • If connection fails, verify your PostgreSQL connection string is correct

  • Check that your PostgreSQL server allows connections from your client machine

  • Server Not Found: Ensure the paths in your configuration file are correct and absolute

    Use absolute path for command by running where python

    For example - "command": "python" should be written a "command": "/Users/username/miniconda3/bin/python"

  • Permission Issues: Make sure the Claude Desktop app has permission to execute the script

  • Server Crashes: Check the server logs for errors and ensure all dependencies are installed

Contact

Feel free to raise issue on this repository.

SSE and Streamable-HTTP postgres-mcp-server is under development....

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for PostgreSQL MCP Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/postgres-mcp-server-aadarshjain)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related databases storage MCP Servers

Alternative and complementary servers in the same category

View all in databases storage →
AIStor MCP server
mcp-server-aistor•minio

This is a Model Context Protocol (MCP) server for interacting with AIStor object stores.

Repository stats unavailable
Databases & Storage
InfluxDB v2 MCP Server
influxdb-mcp-server•idoru

A Model Context Protocol (MCP) server that exposes access to an InfluxDB v2 instance using the InfluxDB OSS API v2.

Repository stats unavailable
Databases & Storage