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.2.tar.gz (67.0 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.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: db_adapter-1.0.2.tar.gz
  • Upload date:
  • Size: 67.0 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.2.tar.gz
Algorithm Hash digest
SHA256 c65865b08e29f4087cba62c8a61d70a948e765073ebd09689545698f640a54c5
MD5 8226ac0217a9958c8c1279f0a556e3cb
BLAKE2b-256 420e8cb4adb770f6f3c1567e06add444faac99f97c38cee68bf35c6c3bf40cb0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: db_adapter-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3fd439ae0106efde9bbe7dc15a724318e42839f33a39f1f796a2a35e66638bdd
MD5 a7af79c2ee9ad2ba822ace329905a93a
BLAKE2b-256 29ba4f01da02b2f4f0980990c3a238ca69c940b00805d590fa366979f31f3038

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