PostgreSQL

PostgreSQL

MCP server with dual HTTP and Stdio transports for PostgreSQL databases.

21
Stars
7
Forks
0
Releases

Overview

An MCP server for PostgreSQL exposing database resources and query tooling via two transports: HTTP streamable and Stdio. It exposes resources to list tables and retrieve schema information, enabling read-only access to the database structure. A built-in query tool allows executing read-only SQL against the connected database. The HTTP transport supports stateful sessions, while the Stdio transport is stateless, allowing flexible integration with either web-oriented clients or CLI workflows. The server is designed for containerized deployments with Docker and Podman support, and it emphasizes production readiness with graceful shutdown, error handling, and logging. Configuration is performed through environment variables or a .env file, including PostgreSQL credentials and server settings such as PORT, HOST, and CORS_ORIGIN. The README also describes health checks and resources such as Hello World, database tables, and schemas, as well as tooling support (e.g., the query tool). The design aims to provide secure, read-only access to database resources via two transport modalities while supporting common DevOps workflows.

Details

Owner
ahmedmustahid
Language
TypeScript
License
Updated
2025-12-07

Features

Dual Transport Support

Provides both HTTP (StreamableHTTPServerTransport) and Stdio (StdioServerTransport) transports to interact with PostgreSQL databases.

Database Resources

Exposes resources such as listing tables and retrieving schema information.

Query Tool

Includes a read-only SQL query tool to execute queries against the database.

Stateful Sessions

HTTP transport supports session management, enabling stateful interactions.

Docker/Podman Deployment

Containerized deployments are available for both transports, with Podman/Docker compatibility.

Production Readiness

Features graceful shutdown, error handling, and logging for reliable operation.

Tags

MCPPostgreSQLHTTPStdiodual-transportsession-managementread-only-queriesdatabase-resourcestablesschemadockerpodmanproduction-readyhealth-check