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

Uploaded Python 3

File details

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

File metadata

  • Download URL: db_adapter-1.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 8c419f0919c8a61a459e5c79744dba9801e14042481597aac268e8f92df1d557
MD5 86b7c51d5837ab84998b926040d4c955
BLAKE2b-256 8f3cd9b68f3f12ee2c3ffc415b28a7f1bea9b1c88f6df5c00ca6e39a27420a70

See more details on using hashes here.

File details

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

File metadata

  • Download URL: db_adapter-1.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aaf51a9df5cc66cbc141ba8a2ce984304b3ac6c0fbc358f280c8225ee5095ff8
MD5 154df957388c5e5950a9ddf1f18a2122
BLAKE2b-256 b61dce5ff743e9f31c04873884ad5199e3560a8dec6cb9bf875df8c68c12e855

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