# Multigres

> Multigres is an open-source MCP server for databases. Postgres diagnostics and cluster operations for Multigres, read-only by default. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** Linux, macOS, Windows, CLI, self-hosted
- **Repository:** https://github.com/joonghyuk-shin/multigres-mcp
- **MCP Registry name:** io.github.JoongHyuk-Shin/multigres-mcp
- **Categories:** [databases](https://ai-powered.com/categories/databases), [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-18

## About

Two groups of tools sit behind this server. The first connects through the Multigres gateway and offers Postgres diagnostics modeled on the tools of postgres-mcp: schema and object browsing, read-only SQL, query plans with hypothetical indexes, top queries, index advice and a broad health check covering bloat, vacuum, locks, replication and more. The second talks to multiadmin and is registered only when MULTIGRES_ADMIN_URL is set, covering cluster status, backups, node logs and, in unrestricted mode, switching a shard's primary or starting and expiring backups.

Safety is layered. The default restricted mode registers no write tools at all, and writing SQL is a separate tool so permission granted to execute_sql never covers a write. Every statement passes a parse check that allows only a single SELECT, EXPLAIN of a SELECT or SHOW, with an allow list of functions, and several independent checks each stop writes alone. A statement timeout of 25 seconds applies by default.

The README says it was tested only against a local Multigres Docker cluster built from one commit, with PostgreSQL 17.7 on Linux, and other setups are untested. It ships as an MCP Bundle with binaries for Linux, macOS and Windows, or can be built with Go 1.26.

## Features

- **Read-only by default:** Write tools are only registered when the access mode is set to unrestricted.
- **Index advice:** Compares planner costs with hypothetical indexes for a workload or up to 10 queries, creating nothing.
- **Health diagnosis:** Checks bloat, vacuum, locks, waits, cache, replication, sequences and constraints.
- **Cluster status:** Shows cells, primaries, replicas with lag, gateways and recent primary changes.
- **Backup tools:** List and verify backups with pgBackRest verify, and in unrestricted mode create or expire them.
- **Direct node reads:** Read a node's Postgres log or diagnose a single node instead of the gateway.
- **Statement validation:** Every read statement is parsed and checked before it is sent.

## Good for

- Find the slowest queries on a Multigres cluster
- Get index recommendations without creating indexes
- Check replication lag and which node is primary
- Verify backups before a failover
- Investigate the old primary after a failover

## Install

### Claude Code (Terminal)

```sh
claude mcp add multigres-mcp --env DATABASE_URI='<DATABASE_URI>' --env MULTIGRES_ADMIN_TOKEN='<MULTIGRES_ADMIN_TOKEN>' -- npx -y https://github.com/JoongHyuk-Shin/multigres-mcp/releases/download/v0.1.12/multigres-mcp-0.1.12.mcpb
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "multigres-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "https://github.com/JoongHyuk-Shin/multigres-mcp/releases/download/v0.1.12/multigres-mcp-0.1.12.mcpb"
      ],
      "env": {
        "DATABASE_URI": "<DATABASE_URI>",
        "MULTIGRES_ADMIN_TOKEN": "<MULTIGRES_ADMIN_TOKEN>"
      }
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "multigres-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "https://github.com/JoongHyuk-Shin/multigres-mcp/releases/download/v0.1.12/multigres-mcp-0.1.12.mcpb"
      ],
      "env": {
        "DATABASE_URI": "<DATABASE_URI>",
        "MULTIGRES_ADMIN_TOKEN": "<MULTIGRES_ADMIN_TOKEN>"
      }
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "multigres-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "https://github.com/JoongHyuk-Shin/multigres-mcp/releases/download/v0.1.12/multigres-mcp-0.1.12.mcpb"
      ],
      "env": {
        "DATABASE_URI": "<DATABASE_URI>",
        "MULTIGRES_ADMIN_TOKEN": "<MULTIGRES_ADMIN_TOKEN>"
      }
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "multigres-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "https://github.com/JoongHyuk-Shin/multigres-mcp/releases/download/v0.1.12/multigres-mcp-0.1.12.mcpb"
      ],
      "env": {
        "DATABASE_URI": "<DATABASE_URI>",
        "MULTIGRES_ADMIN_TOKEN": "<MULTIGRES_ADMIN_TOKEN>"
      }
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "multigres-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "https://github.com/JoongHyuk-Shin/multigres-mcp/releases/download/v0.1.12/multigres-mcp-0.1.12.mcpb"
      ],
      "env": {
        "DATABASE_URI": "<DATABASE_URI>",
        "MULTIGRES_ADMIN_TOKEN": "<MULTIGRES_ADMIN_TOKEN>"
      }
    }
  }
}
```

## Tools

- `list_schemas`: Lists the schemas.
- `list_objects`: Lists tables, views, sequences or extensions.
- `get_object_details`: Shows columns, constraints and indexes of an object.
- `execute_sql`: Runs one read-only statement.
- `explain_query`: Shows a query plan, optionally with hypothetical indexes.
- `get_top_queries`: Lists the slowest or most expensive queries.
- `analyze_workload_indexes`: Advises indexes for the workload.
- `analyze_query_indexes`: Advises indexes for up to 10 given queries.
- `diagnose`: Runs health checks.
- `cluster_status`: Shows cluster topology and status.
- `list_backups`: Lists backups of a shard.
- `verify_backups`: Runs pgBackRest verify on a shard's backups.
- `get_backup_job_status`: Shows the status of a backup job.
- `read_node_log`: Reads the end of a node's Postgres log.
- `execute_write_sql`: Runs a statement that may change data or schema.
- `switch_primary`: Asks Multigres to switch a shard's primary.
- `create_backup`: Starts a backup.
- `expire_backups`: Expires backups by the cluster retention rules.
- `set_postgres_restarts`: Turns automatic Postgres restarts on a node on or off.

## FAQ

### Can it change my data?

Not by default. The restricted mode has no write tools; unrestricted mode adds execute_write_sql and cluster operations.

### What do I need to configure?

DATABASE_URI for the Multigres gateway is required. MULTIGRES_ADMIN_URL enables the cluster tools.

### How many tools are available?

14 in restricted mode and 19 in unrestricted mode with multiadmin configured, or 9 and 10 without it.

### What has it been tested on?

A local Multigres Docker cluster with PostgreSQL 17.7 on Linux. Other setups are untested.

### Does it run restores?

No. verify_backups runs pgBackRest verify, which checks backups and archived WAL but does not run a restore.

### Is Multigres free?

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

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

Run this command in your terminal: claude mcp add multigres-mcp --env DATABASE_URI='<DATABASE_URI>' --env MULTIGRES_ADMIN_TOKEN='<MULTIGRES_ADMIN_TOKEN>' -- npx -y https://github.com/JoongHyuk-Shin/multigres-mcp/releases/download/v0.1.12/multigres-mcp-0.1.12.mcpb

### What are the best alternatives to Multigres?

The closest alternatives to Multigres 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-2): 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/multigres
