databases

Postgres Connector

by martymarkenson

Manage PostgreSQL connections, create a Postgres database, inspect schemas, and run SQL queries. Supports setting Postgr

Connects to PostgreSQL databases for SQL query execution, table schema inspection, and database connection management through environment-based configuration

github stars

9

Environment-based configurationSecurity validation for queries

best for

  • / Database administrators querying production data
  • / Developers analyzing database schemas
  • / Data analysts running SQL queries through Claude

capabilities

  • / Execute SELECT queries on PostgreSQL databases
  • / Inspect table schemas and structure
  • / Test database connection status
  • / Manage database connections securely

what it does

Connects Claude to PostgreSQL databases to execute SQL queries and inspect table schemas. Uses environment variables for secure database authentication.

about

Postgres Connector is a community-built MCP server published by martymarkenson that provides AI assistants with tools and capabilities via the Model Context Protocol. Manage PostgreSQL connections, create a Postgres database, inspect schemas, and run SQL queries. Supports setting Postgr It is categorized under databases.

how to install

You can install Postgres Connector in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.

license

MIT

Postgres Connector is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.

readme

PostgreSQL MCP Server

<img src="icon.png" alt="Postgres Icon" width="150"/>

An MCP (Model Context Protocol) server for querying a PostgreSQL database. Execute SQL queries, view table details, and manage database connections through MCP-compatible clients.

Key Features

  • Database Connection: Connect to PostgreSQL databases with authentication
  • SQL Execution: Execute SELECT queries with security validation
  • Connection Testing: Test database connection status

Installation

Claude Desktop

Follow these steps for installation:

Step 1: Download the MCP Server

Download the postgres-connector.mcpb file from this repository (located in the root directory).

Step 2: Install the MCP Server

  1. Open Claude Desktop
  2. Navigate to Settings > Features
  3. Click "Install Extension" and select the postgres-connector.mcpb file

Installation Step 2 Screenshot placeholder: Installing the .mcpb file

Step 3: Configure Database Connection

After installation, the PostgreSQL Connector will appear in your Claude Desktop with default environment variables that you can configure with your database details.

Configuration Screen Screenshot placeholder: Database configuration interface showing environment variables

Step 4: Test the database connection

Send a query "test the database connection" Test Database Connection

Configuration

Required Database Settings

You'll need to provide the following information for your PostgreSQL database:

Environment VariableDescriptionRequiredDefault
POSTGRES_HOSTThe hostname or IP address of your PostgreSQL server✅ Yes-
POSTGRES_PORTThe port number for your PostgreSQL server❌ No5432
POSTGRES_DBThe name of the specific database to connect to✅ Yes-
POSTGRES_USERYour PostgreSQL username✅ Yes-
POSTGRES_PASSWORDYour PostgreSQL password✅ Yes-

These environment variables will be automatically available for configuration in the extension settings panel after installing the extension in Claude Desktop.

Available Tools

1. Test PostgreSQL Connection

Tool: test-postgres-connection

Tests your database connection and displays the current configuration (password hidden for security).

Example Output:

✅ Database connection successful!

Configuration:
{
  "host": "localhost",
  "port": "5432",
  "database": "myapp_production",
  "username": "postgres",
  "password": "***hidden***"
}

Connection test result: [
  {
    "test": 1
  }
]

2. Get All Tables

Tool: get-all-tables

Retrieves a list of all tables in the public schema of your database.

Example Output:

[
  {
    "table_name": "users"
  },
  {
    "table_name": "orders"
  },
  {
    "table_name": "products"
  },
  {
    "table_name": "categories"
  }
]

3. Execute SQL Query

Tool: execute-sql-query

Executes SELECT queries on your database with security validation.

Input:

  • sql: The SQL query to execute (SELECT statements only)

Example Usage:

SELECT id, name, email FROM users LIMIT 5;

Example Output:

[
  {
    "id": 1,
    "name": "John Doe",
    "email": "john@example.com"
  },
  {
    "id": 2,
    "name": "Jane Smith",
    "email": "jane@example.com"
  }
]

Security & Safety

SQL Query Validation

The PostgreSQL MCP server includes security measures:

  • READ-ONLY Operations: Only SELECT statements are permitted
  • Dangerous Keywords Blocked: DROP, DELETE, TRUNCATE, ALTER, CREATE, INSERT, UPDATE operations are automatically blocked
  • Statement-Level Validation: Each SQL statement is validated individually
  • Safe Error Handling: Database errors are caught and displayed safely

Best practice is to create a read-only database user for the postgres connector to use.

Blocked Operations

The following SQL operations are NOT ALLOWED for security:

  • DROP (deleting tables/databases)
  • DELETE (removing data)
  • TRUNCATE (clearing tables)
  • ALTER (modifying structure)
  • CREATE (creating new objects)
  • INSERT (adding data)
  • UPDATE (modifying data)

Usage Examples

Get Database Tables

Use the get-all-tables tool to retrieve all tables in your database schema.

Execute Queries

Use the execute-sql-query tool with SELECT statements:

SELECT * FROM users LIMIT 10;

Troubleshooting

Connection Issues

Problem: "Database connection failed"

  • Check: Verify your host, port, database name, username, and password
  • Check: Ensure your PostgreSQL server is running and accessible
  • Check: Verify that your database user has the necessary permissions

Problem: "Connection timeout"

  • Check: Your database server might be behind a firewall
  • Check: The host address and port number are correct
  • Check: Network connectivity to the database server

Query Issues

Problem: "Dangerous operation detected"

  • Cause: You're trying to execute a non-SELECT statement
  • Solution: Only SELECT queries are allowed for security reasons

Problem: "Query execution failed"

  • Check: Your SQL syntax is correct
  • Check: The tables and columns you're referencing exist
  • Check: Your database user has SELECT permissions on the tables

Configuration Issues

Problem: MCP server not appearing in Claude Desktop client

  • Solution: Restart Claude Desktop
  • Check: Verify the .mcpb file was installed correctly
  • Check: Look for any error messages in Claude Desktop's console

Problem: Environment variables not showing up

  • Solution: Restart Claude Desktop after installation
  • Check: Ensure the extension is enabled in Settings > Features

Problem: Cannot configure database settings

  • Solution: Make sure all required environment variables are filled out
  • Check: Verify your database credentials are correct

Technical Details

System Requirements

  • PostgreSQL database (version 9.0 or higher)
  • Network access to your PostgreSQL server

Dependencies

  • Node.js runtime
  • PostgreSQL client libraries
  • MCP (Model Context Protocol) framework

Project Structure

postgres-connector/
├── src/
│   └── server.ts          # Main MCP server implementation
├── package.json           # Node.js dependencies
├── manifest.json          # MCP extension manifest
├── icon.png              # Extension icon
└── postgres-connector.mcpb # Compiled extension bundle

License

MIT License - see the LICENSE file for details.

Author

Marty Markenson


Need help? Open an issue in this repository or reach out to martymarkenson

FAQ

What is the Postgres Connector MCP server?
Postgres Connector is a Model Context Protocol (MCP) server profile on explainx.ai. MCP lets AI hosts (e.g. Claude Desktop, Cursor) call tools and resources through a standard interface; this page summarizes categories, install hints, and community ratings.
How do MCP servers relate to agent skills?
Skills are reusable instruction packages (often SKILL.md); MCP servers expose live capabilities. Teams frequently combine both—skills for workflows, MCP for APIs and data. See explainx.ai/skills and explainx.ai/mcp-servers for parallel directories.
How are reviews shown for Postgres Connector?
This profile displays 10 aggregated ratings (sample rows for discoverability plus signed-in user reviews). Average score is about 4.5 out of 5—verify behavior in your own environment before production use.
MCP server reviews

Ratings

4.510 reviews
  • Shikha Mishra· Oct 10, 2024

    Postgres Connector is among the better-indexed MCP projects we tried; the explainx.ai summary tracks the official description.

  • Piyush G· Sep 9, 2024

    We evaluated Postgres Connector against two servers with overlapping tools; this profile had the clearer scope statement.

  • Chaitanya Patil· Aug 8, 2024

    Useful MCP listing: Postgres Connector is the kind of server we cite when onboarding engineers to host + tool permissions.

  • Sakshi Patil· Jul 7, 2024

    Postgres Connector reduced integration guesswork — categories and install configs on the listing matched the upstream repo.

  • Ganesh Mohane· Jun 6, 2024

    I recommend Postgres Connector for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.

  • Oshnikdeep· May 5, 2024

    Strong directory entry: Postgres Connector surfaces stars and publisher context so we could sanity-check maintenance before adopting.

  • Dhruvi Jain· Apr 4, 2024

    Postgres Connector has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.

  • Rahul Santra· Mar 3, 2024

    According to our notes, Postgres Connector benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.

  • Pratham Ware· Feb 2, 2024

    We wired Postgres Connector into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.

  • Yash Thakker· Jan 1, 2024

    Postgres Connector is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.