postgres-mcp-server

ahmedmustahid/postgres-mcp-server

3.3

If you are the rightful owner of postgres-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MCP PostgreSQL Server is a versatile server that provides both HTTP and Stdio transports for interacting with PostgreSQL databases, offering flexibility in integration across various environments.

The MCP PostgreSQL Server is designed to facilitate seamless interaction with PostgreSQL databases through dual transport methods: HTTP and Stdio. This server is particularly useful for developers and system administrators who require a flexible and robust solution for database management and querying. With its stateful session management for HTTP transport, the server ensures efficient handling of multiple client requests, making it suitable for production environments. Additionally, the server supports Docker deployments, allowing for easy containerization and scalability. The server is equipped with essential features such as listing database tables, retrieving schema information, and executing read-only SQL queries. It also includes comprehensive error handling, logging, and graceful shutdown capabilities, ensuring reliability and ease of maintenance. The MCP PostgreSQL Server is an ideal choice for those looking to integrate database functionalities into their applications with minimal setup and maximum efficiency.

Features

  • Dual Transport Support: Offers both HTTP and Stdio transport methods for flexible integration.
  • Stateful Sessions: Supports session management for HTTP transport, enhancing client interaction.
  • Docker Support: Facilitates containerized deployments for both transport methods.
  • Production Ready: Includes features like graceful shutdown, error handling, and logging.
  • Query Tool: Allows execution of read-only SQL queries against the database.

Usages

npx with Claude Desktop

{
  "mcpServers": {
    "postgres-mcp-server": {
      "command": "npx",
      "args": [
        "@ahmedmustahid/postgres-mcp-server",
        "stdio"
      ],
      "env": {
        "POSTGRES_USERNAME": "your-username",
        "POSTGRES_PASSWORD": "your-password",
        "POSTGRES_HOST": "hostname",
        "POSTGRES_DATABASE": "database-name"
      }
    }
  }
}

Tools

  1. query

    Execute read-only SQL queries against the database.