Skip to main content

MCP server that provides PostgreSQL database access tools for AI agents (read-only)

Project description

MCP Database Server

MCP server that provides read-only PostgreSQL database access for AI agents.

Tools

Tool Description
list_tables List all tables with row counts
describe_table Get schema: columns, types, foreign keys, indexes
run_select_query Execute read-only SELECT queries

INSERT/UPDATE/DELETE are blocked for safety.

Configuration

Variable Required Default Description
DATABASE_POSTGRESQL_HOST Yes PostgreSQL host
DATABASE_POSTGRESQL_PORT Yes PostgreSQL port
DATABASE_POSTGRESQL_USERNAME Yes Database user
DATABASE_POSTGRESQL_PASSWORD No Database password
DATABASE_POSTGRESQL_NAME Yes Database name
DATABASE_POSTGRESQL_SCHEMA No public Schema for table discovery

Usage

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "db": {
      "command": "uvx",
      "args": ["db-adapter"],
      "env": {
        "DATABASE_POSTGRESQL_HOST": "localhost",
        "DATABASE_POSTGRESQL_PORT": "5432",
        "DATABASE_POSTGRESQL_USERNAME": "postgres",
        "DATABASE_POSTGRESQL_PASSWORD": "postgres",
        "DATABASE_POSTGRESQL_NAME": "mydb"
      }
    }
  }
}

opencode

Add to opencode.json:

{
  "mcp": {
    "db": {
      "type": "local",
      "command": ["uvx", "db-adapter"],
      "enabled": true,
      "environment": {
        "DATABASE_POSTGRESQL_HOST": "localhost",
        "DATABASE_POSTGRESQL_PORT": "5432",
        "DATABASE_POSTGRESQL_USERNAME": "postgres",
        "DATABASE_POSTGRESQL_PASSWORD": "postgres",
        "DATABASE_POSTGRESQL_NAME": "mydb"
      }
    }
  }
}

Environment variables can be omitted to inherit from your shell.

Requirements

  • Python >= 3.10
  • PostgreSQL database

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

db_adapter-1.0.0.tar.gz (67.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

db_adapter-1.0.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file db_adapter-1.0.0.tar.gz.

File metadata

  • Download URL: db_adapter-1.0.0.tar.gz
  • Upload date:
  • Size: 67.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for db_adapter-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c5c1c3ac2ea9821af92defe03362c258a5e01a55f1324cff605c0020821698ca
MD5 e1eed95b375a61ad0bc23c3ac50ca475
BLAKE2b-256 7265a48e72bfbb4fdc5afbc7e21454ef13ff8c29c41341b88af0cd17089ea1f7

See more details on using hashes here.

File details

Details for the file db_adapter-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: db_adapter-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for db_adapter-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b4028c454a132ae3ef38027befc58d0ceddc7cccffaeebbf9b3cbcb234d868a
MD5 01826e9d2fd7ee1f22094b3e2b25d669
BLAKE2b-256 582abd7fe5e5cad3a967449db539a55f19946f1cff4b80353d303e5151a1060d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page