mcpField
D
database-mcp-postgres

database-mcp-postgres

Local
github.com/arifulislamatDatabases5Updated 2w ago

About database-mcp-postgres

database-mcp-postgres is an MCP server for AI clients that need structured access to PostgreSQL. It combines SQL execution and schema discovery with default read-only safeguards and options to install through npm, PyPI, or Rust crates.

Key features

  1. 01SQL execution with execute_sql
  2. 02Schema discovery with search_objects
  3. 03Read-only mode enforced by SQL guard and database session
  4. 04Row limits and statement timeouts
  5. 05Credentials configured outside chat and redacted from logs

Use cases

  1. 01Inspect PostgreSQL tables, columns, indexes, and foreign keys
  2. 02Run bounded, read-only SQL queries for AI-assisted analysis

MCP support

Exposes execute_sql and search_objects to MCP clients for PostgreSQL queries and schema discovery. Read-only mode, row caps, and timeouts are enabled by default.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository
Packages
npm@database-mcp/postgres0.5.0
pypidatabase-mcp-postgres0.2.0
cargodatabase-mcp-rs-postgres0.2.0

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

database-mcp

CI License: MIT npm PyPI crates.io Node >= 22

MCP servers that give AI clients safe, structured access to SQL databases.

One installable package per database engine, in TypeScript (npm), Python (PyPI), and Rust (crates.io). Every package exposes the same minimal two-tool surface, execute_sql and search_objects, with guardrails on by default: read-only mode, row caps, and statement timeouts.

Packages

EngineTypeScript (npm)Python (PyPI)Rust (crates.io)
SQLite@database-mcp/sqlite npmdatabase-mcp-sqlite PyPIdatabase-mcp-rs-sqlite crates.io
libSQL@database-mcp/libsql npmdatabase-mcp-libsql PyPIdatabase-mcp-rs-libsql crates.io
MySQL@database-mcp/mysql npmdatabase-mcp-mysql PyPIdatabase-mcp-rs-mysql crates.io
MariaDB@database-mcp/mariadb npmdatabase-mcp-mariadb PyPIdatabase-mcp-rs-mariadb crates.io
Postgres@database-mcp/postgres npmdatabase-mcp-postgres PyPIdatabase-mcp-rs-postgres crates.io

All three lines are published and pass the same language-agnostic conformance suite against real databases in CI, so behavior is identical regardless of language. Every engine is also listed on the MCP Registry with all three install options: npm, PyPI, and cargo.

Rust crates are named database-mcp-rs-<engine> because the plain names are taken on crates.io; the command each one installs is still database-mcp-<engine>. Go is planned.

Design principles

  • Two tools, no more. A tiny tool surface keeps the model's context window clean. search_objects progressively discloses schema: call it with no arguments to list tables, with a table name to get columns, indexes, and foreign keys.
  • Safe by default. Read-only mode is enforced in two layers: a conservative SQL guard, plus a session-level read-only setting in the database itself. Rows are capped (default 1000) and statements time out (default 30s).
  • Configured at launch, never via chat. Connection details come from flags, a YAML config file, or environment variables. Credentials are never accepted through a tool call.
  • Secrets never appear in logs. Passwords live in non-printable secret types, DSNs are sanitized before logging, and a redaction filter guards the log boundary.

Quick start

Pick your engine's package; each README has the full config surface. SQLite via npm:

{
  "mcpServers": {
    "sqlite": {
      "command": "npx",
      "args": ["-y", "@database-mcp/sqlite", "--dsn", "/absolute/path/to/database.db"]
    }
  }
}

Or via PyPI: use "command": "uvx" and "args": ["database-mcp-sqlite", "--dsn", "/absolute/path/to/database.db"].

Or as a native binary, with no Node or Python runtime: run cargo install database-mcp-rs-sqlite, then use "command": "database-mcp-sqlite" with the same args minus the package name.

Flags, environment variables, and YAML config are identical across all three lines.

Networked engines take credentials from the environment (MYSQL_*, MARIADB_*, POSTGRES_*/DATABASE_URL, LIBSQL_URL/LIBSQL_AUTH_TOKEN), *_FILE mounted secrets, or a YAML file via --config. Never from a chat prompt.

Contributing

See CONTRIBUTING.md. The short version: the conformance suite is the definition of done. A change is mergeable only when conformance/run.mjs passes against every affected server.

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.