{"openapi":"3.1.0","info":{"title":"FMF SQL Check","version":"1.0.0","description":"Check SQL before you run it: syntax validation with the real PostgreSQL 18 parser and the real SQLite engine (MySQL / MariaDB via node-sql-parser, measured against real MySQL 8.4 and MariaDB 11.8 servers), with the exact error position; 18 lint rules that catch real bugs (UPDATE/DELETE without WHERE, = NULL, NOT IN with NULLs, LIMIT without ORDER BY, comma joins, injection tautologies, non-sargable filters, destructive DDL); and a formatter for 19 dialects that refuses to return output unless it provably means the same query (same PostgreSQL parse tree, same tokens). The SQL is never executed. Docs: https://sql-check.fmf-x402.workers.dev/docs — copy-paste examples for the mppx CLI, curl, the TypeScript SDK (mppx) and the Python SDK (pympp), plus an MCP config. Machine-readable: https://sql-check.fmf-x402.workers.dev/llms.txt and https://sql-check.fmf-x402.workers.dev/openapi.json. MCP (Streamable HTTP): https://sql-check.fmf-x402.workers.dev/mcp. Fleet of sister services: https://mpp-docs.fmf-x402.workers.dev, https://mpp-agent-data.fmf-x402.workers.dev, https://mpp-tools.fmf-x402.workers.dev, https://mpp-ai.fmf-x402.workers.dev, https://mpp-browser.fmf-x402.workers.dev, https://mpp-research.fmf-x402.workers.dev, https://mpp-chain.fmf-x402.workers.dev, https://mpp-stt.fmf-x402.workers.dev, https://mpp-compat.fmf-x402.workers.dev, https://mpp-domain.fmf-x402.workers.dev, https://mpp-utils.fmf-x402.workers.dev, https://mtg-sim.fmf-x402.workers.dev, https://controlplane-x402.fmf-x402.workers.dev, https://pokemon-tcg-sim.fmf-x402.workers.dev, https://yugioh-sim.fmf-x402.workers.dev, https://mpp-cryptotax.fmf-x402.workers.dev, https://mpp-biz.fmf-x402.workers.dev, https://lorcana-sim.fmf-x402.workers.dev, https://onepiece-sim.fmf-x402.workers.dev, https://hearthstone-sim.fmf-x402.workers.dev, https://chess-sim.fmf-x402.workers.dev, https://dota2-sim.fmf-x402.workers.dev, https://cs2-sim.fmf-x402.workers.dev. Engines bundled in the worker: libpg_query (PostgreSQL 18 parser, BSD/PostgreSQL licence via libpg-query, MIT), SQLite via sql.js (public domain / MIT), node-sql-parser (Apache-2.0), sql-formatter (MIT). No database access; your SQL is never executed or stored. Operated by FMF Tools (fmf-tools@agentmail.to). Pay per call; invalid input returns 402 and is not charged.","x-guidance":"POST JSON (or GET with query params) to any /mpp/* route and pay the 402 challenge with MPP on Tempo (USDC.e or pathUSD) or x402 v2 on Base (USDC). Invalid input (including malformed JSON) is a free 400. An upstream failure returns 402 with an error, or 429/503 with Retry-After, and you are not charged. If you omit a documented input param, the route uses the default listed in this document and in the 402 challenge.","contact":{"name":"FMF Tools","url":"https://sql-check.fmf-x402.workers.dev/docs","email":"fmf-tools@agentmail.to"},"x-docs":"https://sql-check.fmf-x402.workers.dev/docs","x-mcp":"https://sql-check.fmf-x402.workers.dev/mcp","x-llms":"https://sql-check.fmf-x402.workers.dev/llms.txt","x-fmf-id":"sql-check","x-related":{"name":"FMF Recipes","what":"Which paid API to call for any agent task","find":"https://agent-recipes.fmf-x402.workers.dev/mpp/recipes/find","price_usd":0.003,"empty_call_ok":true,"mcp":"https://agent-recipes.fmf-x402.workers.dev/mcp","llms":"https://agent-recipes.fmf-x402.workers.dev/llms.txt"},"x-also":{"name":"FMF Tools Etsy Movers","what":"Today's top 20 Etsy shops by sales acceleration from the FMF Tools Etsy Pulse panel (no input)","find":"https://etsy-movers.fmf-x402.workers.dev/etsy/movers/today","price_usd":0.01,"empty_call_ok":true,"mcp":"https://etsy-movers.fmf-x402.workers.dev/mcp","llms":"https://etsy-movers.fmf-x402.workers.dev/llms.txt"}},"servers":[{"url":"https://sql-check.fmf-x402.workers.dev"}],"paths":{"/v1/sql/validate":{"post":{"operationId":"_v1_sql_validate","summary":"Validate SQL syntax (real PostgreSQL / SQLite parsers)","description":"Is this SQL syntactically valid? PostgreSQL is checked by the PostgreSQL 18 parser itself (libpg_query) and SQLite by the SQLite engine, so the answer matches the database; MySQL and MariaDB use node-sql-parser (agreement with real MySQL 8.4 / MariaDB 11.8 servers is published). Returns valid, statement count and types, or the error message with position, line, column and the text near it. Unknown tables or columns are not syntax errors. The SQL is never executed. Price $0.001 per call.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sql":{"type":"string","description":"One or more statements (up to 200,000 characters) (default: SELECT id, name FORM users WHERE active)","default":"SELECT id, name FORM users WHERE active"},"dialect":{"type":"string","description":"postgresql (default) | sqlite | mysql | mariadb","default":"postgresql"}}},"example":{"sql":"SELECT id FROM users WHERE email = 'a@b.co' LIMIT 1","dialect":"postgresql"}}}},"x-payment-info":{"protocols":[{"mpp":{"method":"tempo","intent":"charge","currency":"0x20C000000000000000000000b9537d11c60E8b50"}},{"x402":{"scheme":"exact","network":"eip155:8453","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"}}],"price":{"mode":"fixed","currency":"USD","amount":"0.001"}},"responses":{"200":{"description":"Result","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid input or malformed JSON; free, not charged"},"402":{"description":"Payment required (MPP, Tempo USDC.e or pathUSD); also returned with an error message, not charged, for an upstream failure"}}}},"/v1/sql/lint":{"post":{"operationId":"_v1_sql_lint","summary":"Lint SQL for bugs, safety and performance","description":"Find real problems before a query runs: UPDATE / DELETE without WHERE, = NULL comparisons, NOT IN (subquery) NULL trap, LIMIT without ORDER BY, comma (cartesian) joins, INSERT without a column list, always-true injection signatures (OR 1=1), stacked statements, destructive DDL, non-sargable filters (LOWER(col) = ...), leading-wildcard LIKE, large OFFSET, ORDER BY ordinals, UNION vs UNION ALL, SELECT *, COUNT(col). Each finding has rule, severity, line, column, snippet and a fix. Includes the syntax check. The SQL is never executed. Price $0.002 per call.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sql":{"type":"string","description":"sql (default: SELECT * FROM orders WHERE shipped_at = NULL LIMIT 10; DELETE FROM sessions)","default":"SELECT * FROM orders WHERE shipped_at = NULL LIMIT 10; DELETE FROM sessions"},"dialect":{"type":"string","description":"postgresql (default) | sqlite | mysql | mariadb","default":"postgresql"},"min_severity":{"type":"string","description":"error | warning | info (default info = everything)"},"disable":{"type":"array","description":"rule ids to skip"}}},"example":{"sql":"UPDATE accounts SET balance = 0","dialect":"mysql","min_severity":"warning"}}}},"x-payment-info":{"protocols":[{"mpp":{"method":"tempo","intent":"charge","currency":"0x20C000000000000000000000b9537d11c60E8b50"}},{"x402":{"scheme":"exact","network":"eip155:8453","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"}}],"price":{"mode":"fixed","currency":"USD","amount":"0.002"}},"responses":{"200":{"description":"Result","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid input or malformed JSON; free, not charged"},"402":{"description":"Payment required (MPP, Tempo USDC.e or pathUSD); also returned with an error message, not charged, for an upstream failure"}}}},"/v1/sql/format":{"post":{"operationId":"_v1_sql_format","summary":"Format SQL (verified to mean the same query)","description":"Pretty-print SQL for 19 dialects (postgresql, mysql, sqlite, bigquery, snowflake, transactsql, redshift, trino, spark, duckdb, ...): keyword case, indent, tabular styles, expression width. Before returning, every output is checked: same token sequence as the input (comments kept), and for PostgreSQL the same parse tree from the real PostgreSQL parser. If a check fails the output is refused and you are not charged. Price $0.001 per call.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sql":{"type":"string","description":"sql (default: select u.id,count(o.id) n from users u left join orders o on o.user_id=u.id where u.active group by u.id having count(o.id)>3 order by n desc)","default":"select u.id,count(o.id) n from users u left join orders o on o.user_id=u.id where u.active group by u.id having count(o.id)>3 order by n desc"},"dialect":{"type":"string","description":"postgresql (default) | sql | sqlite | mysql | mariadb | bigquery | snowflake | redshift | transactsql | trino | spark | duckdb | clickhouse | db2 | hive | plsql | tidb | singlestoredb | n1ql","default":"postgresql"},"keyword_case":{"type":"string","description":"upper (default) | lower | preserve"},"function_case":{"type":"string","description":"preserve (default) | upper | lower"},"indent":{"type":"string","description":"2 (default), 4 or tab"},"indent_style":{"type":"string","description":"standard | tabularLeft | tabularRight"},"expression_width":{"type":"integer","description":"expression_width"},"logical_operator_newline":{"type":"string","description":"before (default) | after"},"semicolon":{"type":"boolean","description":"end with a semicolon"}}},"example":{"sql":"select a,b from t where x=1","dialect":"mysql","keyword_case":"upper","indent":4}}}},"x-payment-info":{"protocols":[{"mpp":{"method":"tempo","intent":"charge","currency":"0x20C000000000000000000000b9537d11c60E8b50"}},{"x402":{"scheme":"exact","network":"eip155:8453","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"}}],"price":{"mode":"fixed","currency":"USD","amount":"0.001"}},"responses":{"200":{"description":"Result","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid input or malformed JSON; free, not charged"},"402":{"description":"Payment required (MPP, Tempo USDC.e or pathUSD); also returned with an error message, not charged, for an upstream failure"}}}}},"externalDocs":{"description":"Copy-paste examples (CLI, curl, TypeScript, Python, MCP)","url":"https://sql-check.fmf-x402.workers.dev/docs"},"components":{"securitySchemes":{"Payment":{"type":"http","scheme":"Payment","description":"MPP Payment credential on Tempo (USDC.e or pathUSD). Clients such as mppx handle the 402 challenge automatically. See https://mpp.dev/sdk"}}},"tags":[{"name":"paid","description":"Pay-per-call MPP routes. Unpaid requests receive 402. Invalid input is not charged."},{"name":"discovery","description":"Free discovery surfaces: /docs, /llms.txt, /openapi.json, /mcp, /health, /stats."}]}