# Postgres and REST twins

> Postgres and REST twins is an open-source MCP server for databases. Local Postgres and REST stand-ins that refuse out-of-contract calls and write a report. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, macOS, Linux
- **Website:** https://cmdrvl.com/twinning/
- **Repository:** https://github.com/cmdrvl/twinning
- **MCP Registry name:** com.cmdrvl/twinning
- **Categories:** databases, developer tools
- **Listing updated:** 2026-11-14

## About

Testing an agent against a real database or live API risks damage, and a loose mock hides mistakes. A twin here is generated from a Postgres schema or an OpenAPI spec and serves only that declared contract. A write that breaks a constraint comes back with the real SQLSTATE and a reason, and anything outside the contract is refused with an explanation instead of being guessed.

This MCP server is a local manager that starts and stops twins, reports health, keeps reports from stopped twins and can compare Postgres snapshots by replaying a query set, which helps check a migration. The vendor's checked REST example posts to a greeting route with a header: valid calls returned the declared greeting, while a missing header, wrong value type and unknown route returned 401, 422 and 404, and the stopped twin's report recorded all four requests.

The limits are stated plainly: a twin tests declared behaviour only and does not prove production fidelity, the manager has no MCP or Snowflake twin kinds, and the Windows archive includes the CLI but not the MCP server. Refused-SQL capture can keep literal values locally, so it is off unless needed. It is open source, runs locally over stdio and has no hosted endpoint.

## Features

- **Postgres twins:** Serve a declared subset of a Postgres schema with real SQLSTATE errors on violations.
- **REST twins:** Serve routes defined by an OpenAPI spec and refuse anything else.
- **Run reports:** Reports from stopped twins record the requests received and how they were answered.
- **Snapshot comparison:** Replays a query set against old and new snapshots to check a migration.
- **Local stdio manager:** Starts, stops and inspects twins without a hosted endpoint.
- **Checksum-verified install:** Prebuilt macOS and Linux archives come with SHA256SUMS to verify.

## Good for

- Rehearse extraction code against a stand-in before touching a real database
- Replay queries on old and new schemas to check a migration
- Test an API client against a spec-defined contract
- See exactly why an agent's call was refused

## Install

### Claude Code (Terminal)

```sh
claude mcp add twinning -- npx -y @cmdrvl/twinning-mcp
```

### Claude Desktop (claude_desktop_config.json)

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

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

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

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

```json
{
  "servers": {
    "twinning": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@cmdrvl/twinning-mcp"
      ]
    }
  }
}
```

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

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

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

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

## FAQ

### Does a passing twin test prove production behaviour?

No. The vendor says a twin tests declared behaviour only and does not establish production fidelity.

### Which platforms have the MCP server?

Prebuilt macOS and Linux archives include twinning-mcp; the Windows archive has the CLI only.

### Can it model Snowflake or MCP servers?

No. The manager supports Postgres and REST twin kinds only.

### Is there a hosted endpoint?

No. It controls twins through local stdio.

### What was tested?

The v0.7.1 bundle on Intel macOS on 2 November 2026; other platforms were not tested in that run.

### Is Postgres and REST twins free?

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

### How do I add Postgres and REST twins to Claude Code?

Run this command in your terminal: claude mcp add twinning -- npx -y @cmdrvl/twinning-mcp

### What are the best alternatives to Postgres and REST twins?

The closest alternatives to Postgres and REST twins are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [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.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/postgres-and-rest-twins
