# Kaiva Postgres MCP

> Kaiva Postgres MCP is an open-source MCP server for databases. Read-only PostgreSQL MCP server that refuses writes, as a swap for the archived one. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, Self-hosted
- **Repository:** https://github.com/ai-kaiva/postgres-mcp
- **MCP Registry name:** ai.kaiv/postgres
- **Categories:** [databases](https://ai-powered.com/categories/databases), [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-23

## About

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.

## Features

- **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

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
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.

### Claude Code: Or share it with your project (.mcp.json)

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

### Claude Desktop (claude_desktop_config.json)

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

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

### Cursor (~/.cursor/mcp.json)

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

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

### VS Code (~/.copilot/mcp-config.json)

```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.

### Codex: Add with the CLI (Terminal)

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

### Codex: Or add to config.toml (~/.codex/config.toml)

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

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

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

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

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

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

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

### Devin Desktop (~/.config/devin/mcp_config.json)

```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.

### Cline (cline_mcp_settings.json)

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

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

### Zed (Zed settings.json)

```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.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

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

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

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

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

### Kiro (~/.kiro/settings/mcp.json)

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

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

### Other clients (your client's MCP settings (most use this shape))

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

## Tools

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.

- `query` (name suggests: reads): Run one read-only SQL statement and get rows as JSON.
- `list_tables` (name suggests: reads): List readable tables and views with type, estimated rows and comment.
- `describe_table` (name suggests: reads): Show a table's columns, keys, referencing tables and indexes.

## 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.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Context7](https://ai-powered.com/mcp/context7): Context7 is a freemium MCP server for developer tools.
- [Chrome DevTools MCP](https://ai-powered.com/mcp/chrome-devtools-mcp-2): Chrome DevTools MCP is an open-source MCP server for browser automation.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [awesome-mcp-servers](https://ai-powered.com/mcp/awesome-mcp-servers-2): awesome-mcp-servers is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.

---
Source: https://ai-powered.com/mcp/kaiva-postgres-mcp
