docker-mcp-server-postgres

hansipie/docker-mcp-server-postgres

3.2

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

The Docker MCP Server for PostgreSQL provides a standardized interface for database interactions, enhancing security and efficiency.

Tools
6
Resources
0
Prompts
0

Docker MCP Server PostgreSQL

Dockerization of the MCP PostgreSQL server based on antonorlov/mcp-postgres-server.

Features

  • MCP (Model Context Protocol) Server for PostgreSQL
  • Standardized interface for database interactions
  • Available tools: connect_db, query, execute, list_schemas, list_tables, describe_table
  • Enhanced security with prepared statements

Usage

1. Build and launch

# Build and start the service
docker compose up --build -d

2. Add the MCP server configuration

Add this to your agent configuration file:

{
  "mcpServers": {
    "postgres": {
      "command": "docker",
      "args": [
        "exec",
        "-i",
        "mcp-postgres-server",
        "npx",
        "mcp-postgres-server"
      ],
      "env": {
        "PG_HOST": "your_postgres_host",
        "PG_PORT": "5432",
        "PG_USER": "your_username",
        "PG_PASSWORD": "your_password",
        "PG_DATABASE": "your_database"
      }
    }
  }
}

Environment variables configuration

  1. Dockerfile ENV - Default values
  2. Claude configuration - Variables passed by Claude Desktop

Available variables

VariableDescriptionDefault
PG_HOSTPostgreSQL hostlocalhost
PG_PORTPostgreSQL port5432
PG_USERUsernamepostgres
PG_PASSWORDPassword""
PG_DATABASEDatabase namepostgres

Available tools

  1. connect_db: Database connection
  2. query: SELECT queries
  3. execute: INSERT/UPDATE/DELETE operations
  4. list_schemas: List database schemas
  5. list_tables: List tables
  6. describe_table: Table structure