PostgreSQL MCP Server
PostgreSQL administration, querying and data changes from an MCP client over stdio
Schema summaries and SQL queries against YugabyteDB or PostgreSQL, with guarded optional writes
Official · yugabyte Python Local · stdio Databases
30 popularity score ★ 11 ↓ 48/mo
Opens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.
It needs YUGABYTEDB_URL. Replace each <NAME> with your value.
claude mcp add yugabytedb -e YUGABYTEDB_URL=<YUGABYTEDB_URL> -- uvx yugabytedb-mcp-server@2.0.0rc2{
"mcpServers": {
"yugabytedb": {
"command": "uvx",
"args": [
"yugabytedb-mcp-server@2.0.0rc2"
],
"env": {
"YUGABYTEDB_URL": "<YUGABYTEDB_URL>"
}
}
}
}{
"mcpServers": {
"yugabytedb": {
"command": "uvx",
"args": [
"yugabytedb-mcp-server@2.0.0rc2"
],
"env": {
"YUGABYTEDB_URL": "<YUGABYTEDB_URL>"
}
}
}
}{
"servers": {
"yugabytedb": {
"type": "stdio",
"command": "uvx",
"args": [
"yugabytedb-mcp-server@2.0.0rc2"
],
"env": {
"YUGABYTEDB_URL": "<YUGABYTEDB_URL>"
}
}
}
}[mcp_servers.yugabytedb]
command = "uvx"
args = ["yugabytedb-mcp-server@2.0.0rc2"]
[mcp_servers.yugabytedb.env]
YUGABYTEDB_URL = "<YUGABYTEDB_URL>"gemini mcp add --scope user -e YUGABYTEDB_URL=<YUGABYTEDB_URL> yugabytedb uvx -- yugabytedb-mcp-server@2.0.0rc2YUGABYTEDB_URL |
Required: libpq connection string for the database: host, port, dbname, user, password. |
|---|---|
YB_MCP_ENABLE_WRITE_QUERY |
Optional: Set to true to turn on the run_write_query tool (off by default). |
YB_MCP_REQUIRE_WHERE_ON_UPDATE |
Optional: Refuse UPDATE statements that have no WHERE clause. |
YB_MCP_REQUIRE_WHERE_ON_DELETE |
Optional: Refuse DELETE statements that have no WHERE clause. |
YB_MCP_STATEMENT_TIMEOUT_MS |
Optional: Statement timeout applied to every write. |
YB_MCP_TRANSPORT |
Optional: stdio (default) or http. |
MCP_HOST |
Optional: Bind address in HTTP mode; defaults to 127.0.0.1. |
MCP_AUTH_PROVIDER |
Optional: cognito or oidc to require sign-in in HTTP mode. |
MCP_BASE_URL |
Optional: Public URL of the server, needed when auth is enabled. |
MCP_ALLOWED_ORIGINS |
Optional: Comma-separated allowed Origin values; defaults to MCP_BASE_URL. |
YB_AWS_SSL_ROOT_CERT_SECRET_ARN |
Optional: AWS Secrets Manager secret holding the database TLS root certificate. |
YB_LOG_LEVEL |
Optional: Log level for the server's stderr logs (default INFO). |
YugabyteDB MCP Server is Yugabyte's own MCP server for its distributed SQL database, and it also works with plain PostgreSQL because it connects through a standard libpq connection string. It gives an assistant three tools: one that describes the tables, columns and row counts in a schema, one that runs SELECT statements inside a read-only transaction and hands back the rows as JSON, and one that runs data-changing statements.
The write tool is switched off unless you start the server with --enable-write-query or YB_MCP_ENABLE_WRITE_QUERY=true. When it is on, every statement is checked against a blocklist before it runs: database and schema creation or dropping, role and privilege changes, functions and procedures, COPY, extensions, server settings, file-reading built-ins, search_path changes and multi-statement input are all refused, and you can also make it reject UPDATE or DELETE without a WHERE clause. Writes run under a statement timeout. The tool is also marked destructive, so clients such as Claude Desktop ask for confirmation on each call.
By default it runs locally over stdio. It can also run as a Streamable HTTP service for shared use, with optional AWS Cognito or generic OIDC sign-in, per-user SET ROLE mapping to database roles, and Origin checking. It can fetch the database's TLS root certificate from AWS Secrets Manager.
| Runtime | Python 3.10+ |
|---|
Python 3.10 or newer, with uv (for uvx) or pip/pipx. A reachable YugabyteDB or PostgreSQL database and a database user whose credentials go in the YUGABYTEDB_URL connection string. For shared HTTP deployments: a reverse proxy for TLS and an AWS Cognito or OIDC provider.
Only version 2.0.0rc2 is published, a release candidate, so a plain install does not pick it up: pin the version or allow pre-releases, as its README notes. Writing is off by default. The write guardrail list is described by its makers as best-effort, not exhaustive; CREATE TABLE AS SELECT and SELECT INTO are allowed. Multi-statement queries and psql meta-commands are refused. HTTP mode will not start on a non-loopback address without an auth provider unless MCP_ALLOW_UNAUTHENTICATED is set, which is meant for development only. HTTPS has to be provided by a proxy in front of it.
Suits developers and data teams on YugabyteDB, or on PostgreSQL, who want an assistant to explore a schema and answer questions with SQL, from the database vendor itself. Read-only by default, it fits pointing at a real database with a least-privilege role; turn on writes only where a blocklist plus client confirmation is enough protection. Teams can host one shared instance with Cognito or OIDC sign-in mapped to database roles. Those who want a stable release rather than a release candidate, or who need to work with databases other than PostgreSQL-compatible ones, should look elsewhere.
summarize_databaserun_read_only_queryrun_write_query