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.1.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.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: db_adapter-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 decc6b95990226ff3e18a68e840dafc46361266517ece90bd7150d4c3acc809d
MD5 5de4c1574cd73f43806fe7a6facdecec
BLAKE2b-256 bb284304dffdfb2b3d23073c5b36b1ec877bd441d61c727b918bb187f442f947

See more details on using hashes here.

File details

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

File metadata

  • Download URL: db_adapter-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d5b68d8a5c571a00d11ef50f5bb6c8e4d286dfe68c2112c918ca826cd295705b
MD5 5a8e91d1e078e97a5209ed3db0794fd0
BLAKE2b-256 e4d6f24654c158d7e0633329ba4d45cb13abfb1cb1fc05cce0fbb44ef6b7201f

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