Validate AI-generated JSON, OpenAPI responses, or SQL syntax with deterministic, typed verdicts and fix hints via HTTP or local use.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent โ or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag โ we're steadily working through the catalog.
๐ก Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Inspect callable tools, capabilities, and parameters exposed to AI agents by Validate.
Validate AI-generated artifacts against a contract before you act on them:
json_schema โ validate artifact against a JSON Schema (all errors collected).openapi_response โ validate a response body against the response schema for a given path + method + status in an OpenAPI spec.sql โ check a SQL string for syntax errors in a given dialect.Every check returns a verdict, not an error: {valid, errors, latency_ms},
HTTP 200 whether the artifact is valid or not. Only genuinely wrong requests
(bad key, unsupported type, malformed body, over your limit) get typed HTTP
errors.
Live at https://api.machinegrade.dev โ free tier, self-service key, try it in 30 seconds (first example below). Built on Hono; the same codebase runs on Cloudflare Workers (production) and plain Node (local dev), and is MIT-licensed if you'd rather self-host.
Agents that generate JSON, API responses, or SQL need a fast, cheap, machine-checkable pass/fail before they ship the result โ cheaper than a full LLM-as-judge call, and deterministic.
mcp/server.ts exposes a single tool, validate, that forwards to
POST /v1/validate. Point an MCP-compatible client at it:
The production service also exposes an MCP endpoint directly โ no local process, no npm install โ via streamable HTTP at:
It's the same single validate tool as the stdio adapter above.
initialize and tools/list work without a key (discovery is
anonymous); tools/call requires X-Api-Key (issue one via POST /keys, same as the REST API โ the free tier and limits are shared).
With Claude Code:
The stdio adapter via npm (@machinegrade/validate, see above) remains
available for local/offline use or clients without HTTP transport
support.
Download the latest .mcpb bundle from
Releases and
double-click it. Claude Desktop asks for an API key during install and stores it
in the OS keychain (macOS Keychain, Windows Credential Manager) rather than in a
config file โ nothing lands in claude_desktop_config.json.
Issue a free key (500 calls/month) first:
The bundle is a thin stdio client over the hosted API: ~34 KB, zero bundled dependencies. If you self-host, point the extension's API base URL setting at your own deployment and the tool talks to that instead.
See public/openapi.yaml for the full contract, or
/v1/manifest for a machine-readable
summary (types, limits, pricing, error codes) once the service is running.
/llms.txt is a short pointer for LLM agents.
| Endpoint | In | Out |
|---|---|---|
POST /keys | {email} | {key} |
POST /v1/validate | header X-Api-Key, body {type, artifact, contract?} | verdict, header X-Calls-Remaining |
GET /v1/manifest | โ | capability manifest |
GET /stats | header X-Admin-Token | funnel: keys_issued, active_callers, repeat_callers_7d, limit_hits, paid_requests |
POST /v1/paid-request | header X-Api-Key | records interest in paid access |
GET /openapi.yaml, GET /llms.txt | โ | static docs |
POST /mcp | MCP streamable HTTP, header X-Api-Key for tools/call | see "Connect remotely" above |
POST /v1/paid-request (requires X-Api-Key);
you'll be notified when it's live.Every error is typed JSON โ {code, message, hint, docs_url} โ never a
free-form string:
| Code | HTTP status | When |
|---|---|---|
INVALID_KEY | 401 | X-Api-Key missing or unknown |
LIMIT_EXCEEDED | 402 | Free-tier monthly limit (500 calls) exceeded |
UNSUPPORTED_TYPE | 400 | type is not json_schema, openapi_response, or sql |
MALFORMED_INPUT | 400 | Request body doesn't match the documented shape |
RATE_LIMITED | 429 | More than 60 calls/minute for a key |
A verdict ({valid, errors, latency_ms}) is never an error โ an
invalid artifact is a normal, expected outcome and returns HTTP 200.
artifact must be a JSON value, not a JSON-encoded string:
For type: "sql" the artifact is a string โ the statement itself.
Because MCP callers stringify values often enough (and did so through Claude
Desktop until the tool schema declared artifact's types), the service
tolerates the wrong form narrowly: if artifact is a string, the type is
json_schema or openapi_response, and the contract's top-level schema
declares types that exclude string, the string is JSON-decoded before
validation and the verdict carries "decoded_from_string": true. The field is
additive; {valid, errors, latency_ms} is unchanged.
It deliberately does not decode otherwise, because a string artifact is often legitimate:
| Sent | Contract schema | Result |
|---|---|---|
"42" | {"type": "number"} | decoded to 42, valid: true, decoded_from_string: true |
"42" | {"type": "string"} | left alone, valid: true |
"{\"a\":1}" | {"type": "string"} | left alone, valid: true |
"{\"a\":1}" | {"required": ["a"]} | left alone โ no top-level type, intent unknown |
src/storage.ts defines a Storage interface with two implementations:
MemoryStorage โ full in-memory implementation, used for npm run dev
and the test suite.D1Storage โ real Cloudflare D1 binding, backed by schema.sql (keys,
events tables). Used in production; the Workers entry point in
src/index.ts builds it from the DB binding on first request.Apply schema.sql to a new D1 database with:
Tests cover: key issuance, happy + fail cases for each validator, typed
401/400/402/429 errors, the metering limits (both injectable in tests so
they don't require looping hundreds of real requests), and /stats funnel
counts.
The service runs on Cloudflare Workers (Hono + D1 + Workers Static Assets). To self-host on a fresh Cloudflare account:
Then bind a custom domain (e.g. api.machinegrade.dev) to the Worker via
the Cloudflare dashboard or wrangler. CI can deploy on push to main once
CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID repo secrets are set and
the deploy job in .github/workflows/ci.yml is uncommented.
Two things worth knowing about the Workers port:
GET /openapi.yaml and GET /llms.txt are served by the ASSETS binding
([assets] in wrangler.toml, pointing at public/) โ Cloudflare serves
them directly, without invoking the Worker. The routes in src/index.ts
are a fallback for local Node dev/tests, where there's no ASSETS binding.json_schema and openapi_response validators use
@cfworker/json-schema, not ajv: ajv compiles schemas via
new Function(...), which the Workers runtime disallows, and schemas
here arrive dynamically per request (from the caller), so they can't be
precompiled at build time either.Factual signals from GitHub, npm, and our automated checks โ not a rating.
No reviews yet โ be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/machinegrade-validate)<a href="https://allmcps.com/mcp/machinegrade-validate"><img src="https://allmcps.com/api/badge/machinegrade-validate?style=directory" alt="Validate on AllMCPs" /></a>