Database Postgres
FreeMaintainedMCP server for PostgreSQL. Read-only by default, row caps, timeouts, secrets never logged.
About
MCP server for PostgreSQL. Read-only by default, row caps, timeouts, secrets never logged.
README
CI License: MIT npm PyPI Node >= 20
MCP servers that give AI clients safe, structured access to SQL databases.
One installable package per database engine, in TypeScript (npm) and Python
(PyPI). 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
| Engine | TypeScript (npm) | Python (PyPI) |
|---|---|---|
| SQLite | @database-mcp/sqlite npm | database-mcp-sqlite PyPI |
| libSQL | @database-mcp/libsql npm | database-mcp-libsql PyPI |
| MySQL | @database-mcp/mysql npm | database-mcp-mysql PyPI |
| MariaDB | @database-mcp/mariadb npm | database-mcp-mariadb PyPI |
| Postgres | @database-mcp/postgres npm | database-mcp-postgres PyPI |
Both 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 both install options.
Go and Rust implementations are planned.
Design principles
- Two tools, no more. A tiny tool surface keeps the model's context window
clean.
search_objectsprogressively 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"].
Flags, environment variables, and YAML config are identical across both
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
Install Database Postgres in Claude Desktop, Claude Code & Cursor
unyly install database-mcp-postgresInstalls into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.
First time? Get the CLI: curl -fsSL https://unyly.org/install | sh
Or configure manually
Run in your terminal:
claude mcp add database-mcp-postgres --env DATABASE_URL="" --env POSTGRES_DATABASE="" --env POSTGRES_HOST="" --env POSTGRES_PASSWORD="" --env POSTGRES_PASSWORD_FILE="" --env POSTGRES_USER="" -- npx -y @database-mcp/postgresStep-by-step: how to install Database Postgres
FAQ
Is Database Postgres MCP free?
Yes, Database Postgres MCP is free — one-click install via Unyly at no cost.
Does Database Postgres need an API key?
Yes, it requires environment variables: DATABASE_URL, POSTGRES_DATABASE, POSTGRES_HOST, POSTGRES_PASSWORD, POSTGRES_PASSWORD_FILE, POSTGRES_USER. Unyly injects them into the config during install.
Is Database Postgres hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Database Postgres in Claude Desktop, Claude Code or Cursor?
Open Database Postgres on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Changes
Versions and requested access over time.
- New version published
- New version published
Related MCPs
wenb1n-dev/SmartDB_MCP
A universal database MCP server supporting simultaneous connections to multiple databases. It provides tools for database operations, health analysis, SQL optim
by wenb1n-devPostgres Server
This server enables interaction with PostgreSQL databases through the Model Context Protocol, optimized for the AWS Bedrock AgentCore Runtime. It provides tools
by madhurprashPostgres
Query your database in natural language
by AnthropicPostgreSQL
Read-only database access with schema inspection.
by modelcontextprotocolRedis
Interact with Redis key-value stores.
by modelcontextprotocolSQLite
Database interaction and business intelligence capabilities.
by modelcontextprotocolmxcp
Open-source framework for building enterprise-grade MCP servers using just YAML, SQL, and Python, with built-in auth, monitoring, ETL and policy enforcement.
by raw-labstadas-github/a2asearch-mcp
MCP server to search 4,800+ MCP servers, AI agents, CLI tools and agent skills. Install: npx -y a2asearch-mcp. Ask Claude: "Find MCP servers for database access
by tadas-githubjulien040/anyquery
Query more than 40 apps with one binary using SQL. It can also connect to your PostgreSQL, MySQL, or SQLite compatible database. Local-first and private by desi
by julien040drakonkat/wizzy-mcp-tmdb
A MCP server for The Movie Database API that enables AI assistants to search and retrieve movie, TV show, and person information.
by drakonkatCompare Database Postgres with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All data MCPs
