Skip to main content
MCP server CX Codex

Kaiva Postgres MCP — Claude Code MCP server: setup and usage

Connects assistants to PostgreSQL with guaranteed read-only execution. Replaces the archived official Postgres MCP package without breaking existing workflows.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add kaiva-postgres-mcp -- npx -y @kaiva/postgres-mcp
Open on GitHub

What Kaiva Postgres MCP does

Serves as a direct drop-in alternative to the unsupported @modelcontextprotocol/server-postgres. It restricts incoming SQL to single read-safe statements like SELECT, SHOW, TABLE, VALUES or EXPLAIN. Calls to dangerous database internals such as server file readers, dblink, advisory locks or COPY ... TO PROGRAM are rejected upfront.

Queries run inside isolated read-only transactions using the extended query protocol. Every statement auto-terminates with a rollback and DISCARD ALL to purge temporary session state. Standard execution caps returned data at 1,000 rows with a 15-second timeout. Without --allow-superuser, connecting as a superuser to remote hosts will fail immediately.

What it helps with

  • inspect database schema, column types, and foreign key relations
  • run analytical SQL queries without risking table updates or drops
  • evaluate query performance via EXPLAIN
  • cap large result sets automatically to prevent context overflow

Example prompts for the agent

  • Inspect the columns, keys, and indexes of the users table
  • Run an EXPLAIN query on the recent subscriptions report
  • List all available database schemas and tables with row estimates

How to install Kaiva Postgres MCP

Platform CLI

claude mcp add kaiva-postgres-mcp -- npx -y @kaiva/postgres-mcp

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about Kaiva Postgres MCP

How to install Kaiva Postgres MCP in Claude Code?

Run claude mcp add kaiva-postgres-mcp -- npx -y @kaiva/postgres-mcp. Pass your connection string as an argument or export it inside DATABASE_URL.

What does Kaiva Postgres MCP do?

It gives your AI client safe inspection tools (query, list_tables, describe_table) to read database contents without write permissions.

Why replace the archived server-postgres?

Anthropic archived the original server in 2025. Unlike the original, which let chained commands bypass read-only mode after COMMIT, this server strictly enforces single statements.

Similar MCP servers

All MCP servers for Data and databases →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor