API & MCP
Everything a person can do on Opsdeck SQL Formatter & Linter, a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://opsdecksqlformatter.usefulweb.site/api/v1/calculate– run Opsdeck SQL Formatter & LinterGET https://opsdecksqlformatter.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
Opsdeck SQL Formatter & Linter
Formats SQL statements with clauses on their own lines, one select item per line, indented AND/OR conditions, subqueries and CREATE TABLE bodies, and keywords in the case you choose; comments are kept and formatting twice changes nothing. The linter flags UPDATE or DELETE without WHERE, SELECT * in views, comma joins without a condition, “= NULL”, NOT IN with a subquery, leading-wildcard LIKE, destructive statements and INSERT without a column list. It is the formatter of the Opsdeck Database desk.
| Field | Type | Default | Description |
|---|---|---|---|
sql | textarea | "select c.name, count(*) as orders, sum(o.total) total from customers c join ord | SQL |
keywordCase | select (upper, lower, preserve) | "upper" | Keyword case |
indent | integer | 2 | Indent width |
Example request
Report query with joins, grouping and a date range
curl -X POST https://opsdecksqlformatter.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{}'
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://opsdecksqlformatter.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
opsdeck_sql_formatter - Local stdio connector:
node src/mcp-stdio.ts --tool=opsdeck-sql-formatter
{
"mcpServers": {
"opsdeck-sql-formatter": { "type": "http", "url": "https://opsdecksqlformatter.usefulweb.site/mcp" }
}
}