Postgres and REST twins — Claude Code MCP server: install
The Postgres and REST twins MCP server for Claude Code creates local Postgres and REST stand-ins from a schema or OpenAPI spec. Requests outside the declared contract are rejected with a reason.
MIT updated 2026-11-13
claude mcp add twinning -- npx -y @cmdrvl/twinning-mcpWhat Postgres and REST twins does
The server runs local Postgres and REST twins from a SQL schema or OpenAPI specification. Clients connect with their usual driver, and writes that break a constraint return a SQLSTATE and a refusal reason. It also records a report of requests.
The Postgres twin accepts a declared SQL subset; the REST twin serves routes defined by its spec. Requests beyond either contract are refused rather than guessed. A query set can be replayed against old and candidate Postgres snapshots to inspect migration differences.
Installation through npx uses the package runner. The ready-made server is available for macOS and Linux; the Windows archive contains no MCP server.
What it helps with
- check how an extractor handles writes that violate a schema constraint
- compare query results across legacy and candidate database snapshots
- test an API client against an OpenAPI contract
Example prompts for the agent
- Start a Postgres twin from
schema.sqland show why writes that break constraints are refused. - Replay this query set against the old and candidate Postgres snapshots, then report the differences.
- Test this REST client against the OpenAPI contract and show schema-related refusals.
How to install Postgres and REST twins
Platform CLI
claude mcp add twinning -- npx -y @cmdrvl/twinning-mcpPlatform CLI
codex mcp add postgres-and-rest-twins -- npx -y @cmdrvl/twinning-mcpConfig file
{
"mcpServers": {
"postgres-and-rest-twins": {
"command": "npx",
"args": [
"-y",
"@cmdrvl/twinning-mcp"
]
}
}
}Config file
{
"servers": {
"postgres-and-rest-twins": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@cmdrvl/twinning-mcp"
]
}
}
}Platform CLI
gemini mcp add postgres-and-rest-twins npx -y @cmdrvl/twinning-mcpStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Postgres and REST twins
How do I install Postgres and REST twins in Claude Code?
Run claude mcp add postgres-and-rest-twins -- npx -y @cmdrvl/twinning-mcp. This adds the server through npx.
What does Postgres and REST twins do?
It creates local Postgres twins from a schema and REST twins from an OpenAPI spec. Requests that violate those contracts are refused with a reason.
What does Postgres and REST twins need to run?
The command-based install uses npx. The ready-made MCP server is available for macOS and Linux.