Skip to content
MCP server

Kaiva Postgres MCP

Read-only PostgreSQL MCP server that refuses writes, as a swap for the archived one

Runs locally

Kaiva Postgres MCP is an open-source MCP server for databases. It runs locally on your machine and is started by your AI client.

Pricing
Open source
Platforms
CLI, Self-hosted
Runs
Locally
What it can do
Read-only
Version
0.1.1
Listing updated

Similar MCP servers

Install

Add with the CLI

Run in a terminal

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

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

Or share it with your project

Add to .mcp.json

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@kaiva/postgres-mcp"
      ]
    }
  }
}

Claude Code setup guide

Add to claude_desktop_config.json

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@kaiva/postgres-mcp"
      ]
    }
  }
}

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

Claude Desktop setup guide

Install in CursorOpens Cursor, which asks you to confirm. Or add it by hand:

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@kaiva/postgres-mcp"
      ]
    }
  }
}

Use .cursor/mcp.json in a project to share it with the project.

Cursor setup guide

Install in VS CodeOpens VS Code, which asks you to confirm. Or add it by hand:

Add to ~/.copilot/mcp-config.json

{
  "mcpServers": {
    "postgres": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@kaiva/postgres-mcp"
      ]
    }
  }
}

Or put the same entry in .mcp.json at your workspace root to share it.

VS Code setup guide

Add with the CLI

Run in a terminal

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

Or add to config.toml

Add to ~/.codex/config.toml

[mcp_servers.postgres]
command = "npx"
args = ["-y", "@kaiva/postgres-mcp"]

Codex setup guide

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@kaiva/postgres-mcp"
      ]
    }
  }
}
  • Gemini CLI and Antigravity

    Gemini CLI

    Add to ~/.gemini/settings.json

    {
      "mcpServers": {
        "postgres": {
          "command": "npx",
          "args": [
            "-y",
            "@kaiva/postgres-mcp"
          ]
        }
      }
    }

    Or run: gemini mcp add -s user postgres npx -- -y @kaiva/postgres-mcp

    Antigravity

    Add to ~/.gemini/config/mcp_config.json

    {
      "mcpServers": {
        "postgres": {
          "command": "npx",
          "args": [
            "-y",
            "@kaiva/postgres-mcp"
          ]
        }
      }
    }

    Use .agents/mcp_config.json to add it to one workspace only.

    Gemini CLI and Antigravity setup guide

  • Devin Desktop (formerly Windsurf)

    Add to ~/.config/devin/mcp_config.json

    {
      "mcpServers": {
        "postgres": {
          "command": "npx",
          "args": [
            "-y",
            "@kaiva/postgres-mcp"
          ]
        }
      }
    }

    On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

    Devin Desktop setup guide

  • Cline

    Add to cline_mcp_settings.json

    {
      "mcpServers": {
        "postgres": {
          "command": "npx",
          "args": [
            "-y",
            "@kaiva/postgres-mcp"
          ]
        }
      }
    }

    Open it from the MCP Servers icon → Configure → Configure MCP Servers.

    Cline setup guide

  • Zed

    Add to Zed settings.json

    {
      "context_servers": {
        "postgres": {
          "command": "npx",
          "args": [
            "-y",
            "@kaiva/postgres-mcp"
          ]
        }
      }
    }

    Open it with zed: open settings file. Merge context_servers into the settings you already have.

    Zed setup guide

  • JetBrains AI Assistant and Junie

    AI Assistant

    Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add

    {
      "mcpServers": {
        "postgres": {
          "command": "npx",
          "args": [
            "-y",
            "@kaiva/postgres-mcp"
          ]
        }
      }
    }

    Junie

    Add to ~/.junie/mcp/mcp.json

    {
      "mcpServers": {
        "postgres": {
          "command": "npx",
          "args": [
            "-y",
            "@kaiva/postgres-mcp"
          ]
        }
      }
    }

    Use .junie/mcp/mcp.json to share it with a project.

    JetBrains AI Assistant and Junie setup guide

  • Kiro

    Add to ~/.kiro/settings/mcp.json

    {
      "mcpServers": {
        "postgres": {
          "command": "npx",
          "args": [
            "-y",
            "@kaiva/postgres-mcp"
          ]
        }
      }
    }

    Use .kiro/settings/mcp.json to add it to one workspace only.

    Kiro setup guide

Using several servers? Build one config file with the MCP config generator.

About Kaiva Postgres MCP

Positioned as a drop-in replacement for the archived @modelcontextprotocol/server-postgres: you change the package name in your client config and the query tool, its sql input and the table schema resources stay the same. The README argues the old server's read-only transaction can be escaped, for example with a second statement after COMMIT or COPY ... TO PROGRAM under a superuser login, and says both ran against version 0.6.2 in its own test while this server refuses them.

Each call is checked before it is sent: a single SELECT, WITH, VALUES, TABLE, SHOW or EXPLAIN statement, with functions such as dblink and file functions blocked. It then runs alone inside a read-only transaction that is always rolled back, with a 15-second statement limit, 3 seconds waiting for a lock, and the first 1,000 rows returned. Tables from every schema are listed, and dates print exactly as PostgreSQL shows them.

The README is candid about limits: the refused-function list is a second guard, not a sandbox, and the strongest protection is a login that cannot write, for which it gives the SQL to create one. A --check flag reports what a login can do. It runs locally over stdio and is MIT licensed.

Tools this server provides (3)

Taken from the project documentation; the running server may differ.

From the tool list in its README, going by the names, all 3 tools only read data.

From the server's own tool labels and tool names; not verified by us.

queryName suggests: reads
Run one read-only SQL statement and get rows as JSON.
list_tablesName suggests: reads
List readable tables and views with type, estimated rows and comment.
describe_tableName suggests: reads
Show a table's columns, keys, referencing tables and indexes.

What it does

Single-statement guard
Allows only one read statement per call and checks it before sending.
Read-only transaction
Runs inside a read-only transaction that is always rolled back.
Time and row limits
15 seconds per statement and 1,000 rows by default, both adjustable.
Superuser warning
Warns on a local superuser login and refuses one on a remote database unless allowed.
Login check
The --check flag reports what the connected login can do.
All schemas listed
Lists tables and views from every schema, not just public.
Several install routes
npx, a Claude Code plugin, a Gemini CLI extension, or Docker.

Good for

  • Replace the archived Postgres MCP server in Claude Code or Cursor
  • Let an assistant explore a development database without write access
  • Inspect table structure, keys and indexes through an assistant
  • Run ad hoc read queries with a capped result size

Pricing

Open source

MIT licensed, free to run locally

More servers for the same service

Kaiva Postgres MCP FAQ

Is Kaiva Postgres MCP a drop-in for the old server?

The README says yes: change the package name; the query tool, sql input and table resources are unchanged.

Is the read-only check enough on its own?

No. The README says a login that cannot write is the strongest guard and gives SQL for creating one.

How many rows come back?

The first 1,000 by default, configurable from 1 to 10,000 with --max-rows.

What licence is Kaiva Postgres MCP?

MIT.

Is Kaiva Postgres MCP free?

Yes. Kaiva Postgres MCP is open source, so you can use and self-host it for free.

How do I add Kaiva Postgres MCP to Claude Code?

Run this command in your terminal: claude mcp add postgres -- npx -y @kaiva/postgres-mcp

What are the best alternatives to Kaiva Postgres MCP?

The closest alternatives to Kaiva Postgres MCP are REA, Context7, Chrome DevTools MCP, Codebase Memory and GitHub.

Where this comes from

  • Description: written from the project's README.
  • Install steps: from the official MCP Registry entry.

How AIPoweredBot checks servers