# Lomberk

> Lomberk is an MCP server for databases. Postgres gateway that blocks destructive SQL, holds risky writes and can undo applied ones. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Platforms:** CLI
- **Website:** https://ege-usta.github.io/lomberk/
- **Repository:** https://github.com/ege-usta/lomberk
- **MCP Registry name:** io.github.ege-usta/lomberk
- **Categories:** [databases](https://ai-powered.com/categories/databases), [security](https://ai-powered.com/categories/security)
- **Listing updated:** 2026-11-23

## About

Lomberk sits between an agent and PostgreSQL so the agent never holds the database password. It runs agent SQL as a low-privilege role, refuses DDL using Postgres's own parser, rejects writes without a WHERE clause, and allows only an allowlist of pure built-in functions. Writes that touch more rows than a limit, or hit protected tables, are rolled back and queued for a person who reads the exact SQL.

Undo works from a trigger that records each changed row, cascades included. Rows are restored parents first, and undo stops and names the row if it changed after the checkpoint or the schema drifted. Checkpoints form an append-only SHA-256 chain that `lomberk verify-ledger` can check.

The site lists limits: cloud tokens held by an agent are out of scope, superusers can disable triggers, and tables with rules or classic inheritance are refused. It reports 18.3 ms for a captured write.

## Features

- **Destructive SQL blocked:** DDL and unbounded writes are refused.
- **Held risky writes:** Large or protected-table changes wait for a person.
- **Undo with FK order:** Deleted rows return parents first.
- **Hash-chained ledger:** Verify the checkpoint ledger for tampering.
- **Least-privilege roles:** `lomberk setup` creates two roles and installs it.
- **Client config line:** Prints setup for Claude Code, Cursor, VS Code, Codex.

## Good for

- Let an agent write to Postgres without raw credentials
- Review risky updates before they apply
- Reverse a bad DELETE without a point-in-time restore
- Audit agent writes with a verifiable ledger

## Install

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

```sh
claude mcp add lomberk --env LOMBERK_CONFIG='<LOMBERK_CONFIG>' --env LOMBERK_AGENT_DSN='<LOMBERK_AGENT_DSN>' --env LOMBERK_ADMIN_DSN='<LOMBERK_ADMIN_DSN>' -- uvx lomberk
```

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": {
    "lomberk": {
      "command": "uvx",
      "args": [
        "lomberk"
      ],
      "env": {
        "LOMBERK_CONFIG": "<LOMBERK_CONFIG>",
        "LOMBERK_AGENT_DSN": "<LOMBERK_AGENT_DSN>",
        "LOMBERK_ADMIN_DSN": "<LOMBERK_ADMIN_DSN>"
      }
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "lomberk": {
      "command": "uvx",
      "args": [
        "lomberk"
      ],
      "env": {
        "LOMBERK_CONFIG": "<LOMBERK_CONFIG>",
        "LOMBERK_AGENT_DSN": "<LOMBERK_AGENT_DSN>",
        "LOMBERK_ADMIN_DSN": "<LOMBERK_ADMIN_DSN>"
      }
    }
  }
}
```

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

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

```json
{
  "mcpServers": {
    "lomberk": {
      "command": "uvx",
      "args": [
        "lomberk"
      ],
      "env": {
        "LOMBERK_CONFIG": "<LOMBERK_CONFIG>",
        "LOMBERK_AGENT_DSN": "<LOMBERK_AGENT_DSN>",
        "LOMBERK_ADMIN_DSN": "<LOMBERK_ADMIN_DSN>"
      }
    }
  }
}
```

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

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

```json
{
  "mcpServers": {
    "lomberk": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "lomberk"
      ],
      "env": {
        "LOMBERK_CONFIG": "<LOMBERK_CONFIG>",
        "LOMBERK_AGENT_DSN": "<LOMBERK_AGENT_DSN>",
        "LOMBERK_ADMIN_DSN": "<LOMBERK_ADMIN_DSN>"
      }
    }
  }
}
```

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 lomberk --env LOMBERK_CONFIG='<LOMBERK_CONFIG>' --env LOMBERK_AGENT_DSN='<LOMBERK_AGENT_DSN>' --env LOMBERK_ADMIN_DSN='<LOMBERK_ADMIN_DSN>' -- uvx lomberk
```

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

```toml
[mcp_servers.lomberk]
command = "uvx"
args = ["lomberk"]
env = { LOMBERK_CONFIG = "<LOMBERK_CONFIG>", LOMBERK_AGENT_DSN = "<LOMBERK_AGENT_DSN>", LOMBERK_ADMIN_DSN = "<LOMBERK_ADMIN_DSN>" }
```

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

```json
{
  "mcpServers": {
    "lomberk": {
      "command": "uvx",
      "args": [
        "lomberk"
      ],
      "env": {
        "LOMBERK_CONFIG": "<LOMBERK_CONFIG>",
        "LOMBERK_AGENT_DSN": "<LOMBERK_AGENT_DSN>",
        "LOMBERK_ADMIN_DSN": "<LOMBERK_ADMIN_DSN>"
      }
    }
  }
}
```

Or run: gemini mcp add -s user -e LOMBERK_CONFIG='<LOMBERK_CONFIG>' -e LOMBERK_AGENT_DSN='<LOMBERK_AGENT_DSN>' -e LOMBERK_ADMIN_DSN='<LOMBERK_ADMIN_DSN>' lomberk uvx -- lomberk

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

```json
{
  "mcpServers": {
    "lomberk": {
      "command": "uvx",
      "args": [
        "lomberk"
      ],
      "env": {
        "LOMBERK_CONFIG": "<LOMBERK_CONFIG>",
        "LOMBERK_AGENT_DSN": "<LOMBERK_AGENT_DSN>",
        "LOMBERK_ADMIN_DSN": "<LOMBERK_ADMIN_DSN>"
      }
    }
  }
}
```

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

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

```json
{
  "mcpServers": {
    "lomberk": {
      "command": "uvx",
      "args": [
        "lomberk"
      ],
      "env": {
        "LOMBERK_CONFIG": "<LOMBERK_CONFIG>",
        "LOMBERK_AGENT_DSN": "<LOMBERK_AGENT_DSN>",
        "LOMBERK_ADMIN_DSN": "<LOMBERK_ADMIN_DSN>"
      }
    }
  }
}
```

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": {
    "lomberk": {
      "command": "uvx",
      "args": [
        "lomberk"
      ],
      "env": {
        "LOMBERK_CONFIG": "<LOMBERK_CONFIG>",
        "LOMBERK_AGENT_DSN": "<LOMBERK_AGENT_DSN>",
        "LOMBERK_ADMIN_DSN": "<LOMBERK_ADMIN_DSN>"
      }
    }
  }
}
```

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

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "lomberk": {
      "command": "uvx",
      "args": [
        "lomberk"
      ],
      "env": {
        "LOMBERK_CONFIG": "<LOMBERK_CONFIG>",
        "LOMBERK_AGENT_DSN": "<LOMBERK_AGENT_DSN>",
        "LOMBERK_ADMIN_DSN": "<LOMBERK_ADMIN_DSN>"
      }
    }
  }
}
```

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": {
    "lomberk": {
      "command": "uvx",
      "args": [
        "lomberk"
      ],
      "env": {
        "LOMBERK_CONFIG": "<LOMBERK_CONFIG>",
        "LOMBERK_AGENT_DSN": "<LOMBERK_AGENT_DSN>",
        "LOMBERK_ADMIN_DSN": "<LOMBERK_ADMIN_DSN>"
      }
    }
  }
}
```

The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.

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

```json
{
  "mcpServers": {
    "lomberk": {
      "command": "uvx",
      "args": [
        "lomberk"
      ],
      "env": {
        "LOMBERK_CONFIG": "<LOMBERK_CONFIG>",
        "LOMBERK_AGENT_DSN": "<LOMBERK_AGENT_DSN>",
        "LOMBERK_ADMIN_DSN": "<LOMBERK_ADMIN_DSN>"
      }
    }
  }
}
```

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

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

```json
{
  "mcpServers": {
    "lomberk": {
      "command": "uvx",
      "args": [
        "lomberk"
      ],
      "env": {
        "LOMBERK_CONFIG": "<LOMBERK_CONFIG>",
        "LOMBERK_AGENT_DSN": "<LOMBERK_AGENT_DSN>",
        "LOMBERK_ADMIN_DSN": "<LOMBERK_ADMIN_DSN>"
      }
    }
  }
}
```

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": {
    "lomberk": {
      "command": "uvx",
      "args": [
        "lomberk"
      ],
      "env": {
        "LOMBERK_CONFIG": "<LOMBERK_CONFIG>",
        "LOMBERK_AGENT_DSN": "<LOMBERK_AGENT_DSN>",
        "LOMBERK_ADMIN_DSN": "<LOMBERK_ADMIN_DSN>"
      }
    }
  }
}
```

## FAQ

### Which Postgres versions are tested?

Postgres 14 to 18.

### Does undo overwrite later changes?

No, it stops and names the row if it changed since the checkpoint.

### What does Lomberk not cover?

Cloud tokens, superusers and some tables with rules or inheritance.

### How is Lomberk installed?

Run `uvx lomberk setup`, then add the server line to your client.

### How do I add Lomberk to Claude Code?

Run this command in your terminal: claude mcp add lomberk --env LOMBERK_CONFIG='<LOMBERK_CONFIG>' --env LOMBERK_AGENT_DSN='<LOMBERK_AGENT_DSN>' --env LOMBERK_ADMIN_DSN='<LOMBERK_ADMIN_DSN>' -- uvx lomberk

### What are the best alternatives to Lomberk?

The closest alternatives to Lomberk are REA, MCP Toolbox for Databases, redamon, AiSOC and Bernstein.

## Where this comes from

- Description: written from the project's README and the project's website.
- 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.
- [MCP Toolbox for Databases](https://ai-powered.com/mcp/mcp-toolbox-for-databases-2): MCP Toolbox for Databases is an open-source MCP server for databases.
- [redamon](https://ai-powered.com/mcp/redamon): redamon is an open-source MCP server for ai models and llm tooling.
- [AiSOC](https://ai-powered.com/mcp/aisoc): AiSOC is an open-source MCP server for ai models and llm tooling.
- [Bernstein](https://ai-powered.com/mcp/bernstein): Bernstein is an open-source MCP server for developer tools.
- [SSH — policy-gated remote access](https://ai-powered.com/mcp/ssh-policy-gated-remote-access): SSH — policy-gated remote access is an open-source MCP server for security.
- [ClickHouse](https://ai-powered.com/mcp/clickhouse): ClickHouse is an open-source MCP server for databases.
- [postgres-mcp](https://ai-powered.com/mcp/postgres-mcp-4): postgres-mcp is an open-source MCP server for databases.

---
Source: https://ai-powered.com/mcp/lomberk
