API & MCP
Everything a person can do on Opsdeck ER Diagram from SQL DDL (SVG, Mermaid), a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://opsdeckerdiagram.usefulweb.site/api/v1/calculate– run Opsdeck ER Diagram from SQL DDL (SVG, Mermaid)GET https://opsdeckerdiagram.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
Opsdeck ER Diagram from SQL DDL (SVG, Mermaid)
Paste PostgreSQL, MySQL or SQLite DDL and get an entity-relationship diagram as SVG: tables with their columns and types, primary, foreign and unique keys, and relationships drawn in crow’s foot notation (one, zero-or-one, zero-or-many). Layered layout along foreign keys or a force-directed layout with a fixed seed, plus a Mermaid erDiagram and a text list of relationships. It is the diagram of the Opsdeck Database desk.
| Field | Type | Default | Description |
|---|---|---|---|
ddl | textarea | "-- Shop schema, version 2\nCREATE TABLE customers (\n id integer PRIMARY KEY,\ | Schema (DDL). CREATE TABLE (and CREATE INDEX / ALTER TABLE) statements. |
dialect | select (postgresql, mysql, sqlite) | "postgresql" | SQL dialect |
layout | select (layered, force) | "layered" | Layout |
seed | integer | 1 | Layout seed (force-directed). The same seed always gives the same picture; try another seed for another arrangement. |
showTypes | boolean | true | Show column types |
title | text | — | Diagram title |
Example request
Shop schema (PostgreSQL)
curl -X POST https://opsdeckerdiagram.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"ddl":"-- Shop schema, version 2\nCREATE TABLE customers (\n id integer PRIMARY KEY,\n email varchar(120) NOT NULL UNIQUE,\n full_name text,\n phone varchar(40),\n created_at timestamp DEFAULT CURRENT_TIMESTAMP,\n country char(2) NOT NULL DEFAULT 'DE'\n);\n\nCREATE TABLE products (\n sku varchar(32) PRIMARY KEY,\n title text NOT NULL,\n price numeric(10,2) NOT NULL CHECK (price >= 0)\n);\n\nCREATE TABLE orders (\n id integer PRIMARY KEY,\n customer_id integer NOT NULL REFERENCES customers (id) ON DELETE CASCADE,\n total numeric(10,2) NOT NULL DEFAULT 0,\n status varchar(20) NOT NULL DEFAULT 'new',\n shipped_at timestamp\n);\nCREATE INDEX orders_status_idx ON orders (status, shipped_at);\n\nCREATE TABLE order_items (\n order_id integer NOT NULL REFERENCES orders (id),\n sku varchar(32) NOT NULL REFERENCES products (sku),\n qty integer NOT NULL CHECK (qty > 0),\n PRIMARY KEY (order_id, sku)\n);\n","dialect":"postgresql","layout":"layered","title":"Shop schema"}'
Every result contains
inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.
MCP (Model Context Protocol)
- Streamable HTTP endpoint:
https://opsdeckerdiagram.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
opsdeck_er_diagram - Local stdio connector:
node src/mcp-stdio.ts --tool=opsdeck-er-diagram
{
"mcpServers": {
"opsdeck-er-diagram": { "type": "http", "url": "https://opsdeckerdiagram.usefulweb.site/mcp" }
}
}