machinegrade-validate
The machinegrade-validate server validates AI-generated artifacts against contracts before acting on them:
Validate JSON against a JSON Schema: Submit any JSON value with a JSON Schema to check conformance — all errors collected and returned.
Validate OpenAPI response bodies: Check a response body against a schema in an OpenAPI spec for a given
path,method, and HTTPstatuscode.Validate SQL syntax: Submit a SQL statement with a dialect (e.g.,
mysql,postgresql) to check for syntax errors.Structured verdicts: Every call returns
{ valid, errors, latency_ms }with HTTP 200 — an invalid artifact is a normal outcome, not an exception.Self-service API key issuance via
POST /keys.Metadata endpoints:
/v1/manifestfor capability summary,/openapi.yamlfor the full contract.Integrations: REST API, Python, and MCP (local stdio and remote HTTP streamable).
Free tier: 500 calls/month, 60 calls/minute; paid tier available (EUR 0.002/call beyond free).
Open source (MIT) and self-hostable on Cloudflare Workers.
Validates SQL strings for MySQL dialect.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@machinegrade-validatevalidate this JSON artifact against the user schema"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
machinegrade validate
Validate AI-generated artifacts against a contract before you act on them:
json_schema— validateartifactagainst a JSON Schema (all errors collected).openapi_response— validate a response body against the response schema for a givenpath+method+statusin 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.
Why
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.
Related MCP server: Fixzi MCP server
Run it locally
npm install
npm run dev
# machinegrade validate listening on http://localhost:87873 runnable examples
1. curl
# Get an API key (live service — works as-is)
curl -s -X POST https://api.machinegrade.dev/keys \
-H 'content-type: application/json' \
-d '{"email": "you@example.com"}'
# => {"key":"sk_..."}
# Validate a JSON artifact against a JSON Schema
curl -s -X POST https://api.machinegrade.dev/v1/validate \
-H 'content-type: application/json' \
-H 'X-Api-Key: sk_...' \
-d '{
"type": "json_schema",
"artifact": {"name": "Ada", "age": 30},
"contract": {
"schema": {
"type": "object",
"required": ["name", "age"],
"properties": {"name": {"type": "string"}, "age": {"type": "number"}}
}
}
}'
# => {"valid":true,"errors":[],"latency_ms":1}2. Python (requests)
import requests
base = "http://localhost:8787"
key = requests.post(f"{base}/keys", json={"email": "you@example.com"}).json()["key"]
resp = requests.post(
f"{base}/v1/validate",
headers={"X-Api-Key": key},
json={
"type": "sql",
"artifact": "SELECT id, name FROM users WHERE id = 1",
"contract": {"dialect": "mysql"},
},
)
print(resp.status_code, resp.headers.get("X-Calls-Remaining"), resp.json())3. MCP config snippet
mcp/server.ts exposes a single tool, validate, that forwards to
POST /v1/validate. Point an MCP-compatible client at it:
{
"mcpServers": {
"machinegrade-validate": {
"command": "npx",
"args": ["tsx", "mcp/server.ts"],
"cwd": "/path/to/validate",
"env": {
"SANDBOX_URL": "http://localhost:8787",
"SANDBOX_API_KEY": "sk_..."
}
}
}
}Connect remotely
The production service also exposes an MCP endpoint directly — no local process, no npm install — via streamable HTTP at:
POST https://api.machinegrade.dev/mcpIt'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:
claude mcp add --transport http validate https://api.machinegrade.dev/mcp --header "X-Api-Key: sk_..."The stdio adapter via npm (@machinegrade/validate, see above) remains
available for local/offline use or clients without HTTP transport
support.
Claude Desktop: one-click install
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:
curl -s -X POST https://api.machinegrade.dev/keys \
-H 'content-type: application/json' \
-d '{"email": "you@example.com"}'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.
API
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 |
|
|
|
| header | verdict, header |
| — | capability manifest |
| header | funnel: keys_issued, active_callers, repeat_callers_7d, limit_hits, paid_requests |
| header | records interest in paid access |
| — | static docs |
| MCP streamable HTTP, header | see "Connect remotely" above |
Pricing
Free tier: 500 calls/month per key, 60 calls/minute rate limit.
Paid tier: EUR 0.002/call beyond the free tier — opens soon. Request paid access via
POST /v1/paid-request(requiresX-Api-Key); you'll be notified when it's live.
Errors
Every error is typed JSON — {code, message, hint, docs_url} — never a
free-form string:
Code | HTTP status | When |
| 401 |
|
| 402 | Free-tier monthly limit (500 calls) exceeded |
| 400 |
|
| 400 | Request body doesn't match the documented shape |
| 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.
Sending the artifact
artifact must be a JSON value, not a JSON-encoded string:
{"type": "json_schema", "artifact": {"name": "Ada"}, "contract": {"schema": {"type": "object"}}} // correct
{"type": "json_schema", "artifact": "{\"name\": \"Ada\"}", "contract": {"schema": {"type": "object"}}} // wrongFor 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 |
|
| decoded to |
|
| left alone, |
|
| left alone, |
|
| left alone — no top-level |
Storage
src/storage.ts defines a Storage interface with two implementations:
MemoryStorage— full in-memory implementation, used fornpm run devand the test suite.D1Storage— real Cloudflare D1 binding, backed byschema.sql(keys,eventstables). Used in production; the Workers entry point insrc/index.tsbuilds it from theDBbinding on first request.
Apply schema.sql to a new D1 database with:
wrangler d1 execute machinegrade-validate-db --file=schema.sql # local
wrangler d1 execute machinegrade-validate-db --file=schema.sql --remote # productionTesting
npm test # vitest run, in-process via app.request(), MemoryStorage
npm run typecheck # tsc --noEmitTests 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.
Deploy
The service runs on Cloudflare Workers (Hono + D1 + Workers Static Assets). To self-host on a fresh Cloudflare account:
wrangler d1 create machinegrade-validate-db # copy the returned database_id into wrangler.toml
wrangler d1 execute machinegrade-validate-db --file=schema.sql --remote
wrangler secret put ADMIN_TOKEN
wrangler deployThen 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.yamlandGET /llms.txtare served by theASSETSbinding ([assets]inwrangler.toml, pointing atpublic/) — Cloudflare serves them directly, without invoking the Worker. The routes insrc/index.tsare a fallback for local Node dev/tests, where there's no ASSETS binding.The
json_schemaandopenapi_responsevalidators use@cfworker/json-schema, notajv: ajv compiles schemas vianew 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.
Status
Early stage, honestly so: this service is live and free-tier usage is real, and we're measuring whether it earns a paid tier. What you can rely on:
The API contract (
/v1/validaterequest/response shapes, typed error codes, verdict semantics) is stable — breaking changes only with a versioned path (/v2/...), never silently.The free tier (500 calls/month) stays.
If we ever sunset the service, keys keep working for 90 days after the announcement, and the validators are open source in this repo — you can self-host the same behavior.
Feedback and integration stories are the most valuable thing you can give
us right now: open an issue or use POST /v1/paid-request if you need
more than the free tier.
Available Tools
1 toolvalidateBInspect
Validate an artifact against a contract (json_schema | openapi_response | sql) via the machinegrade validate API.
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | Which validator to run. | |
| artifact | Yes | The artifact to validate, as a JSON value — not a JSON-encoded string. json_schema/openapi_response: the object/array/value itself. sql: the SQL statement as a string. | |
| contract | No | Validator-specific contract. json_schema: { schema }. openapi_response: { spec, path, method, status }. sql: { dialect }. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It only states the action ('validate') without disclosing any behavioral traits such as side effects, rate limits, authentication needs, or return format. The mention of 'via the machinegrade validate API' adds little transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence that efficiently communicates the core purpose. Every part contributes meaning; no unnecessary words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given three parameters, no output schema, and no annotations, the description is incomplete. It does not explain the return value, error handling, or provide usage examples. A validation tool typically benefits from clarifying output (e.g., boolean, error details) to guide the agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema descriptions cover 100% of parameters, so baseline is 3. The description adds no extra meaning beyond the schema. It reiterates the enum values but does not provide additional context or examples.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool validates an artifact against a contract, listing the three supported validator types (json_schema, openapi_response, sql). It uses a specific verb 'validate' and resource 'artifact', making the purpose unambiguous even without a title.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this tool vs alternatives, but no siblings exist to confuse. The description implicitly covers usage by listing the three validation types. However, it does not explain when each type is appropriate or provide any exclusion criteria.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
1 tool update
v0.1.2- Changed
validate3 fields changed- changed
Input schema / properties / artifact / descriptionPrevious value: -"The artifact to validate (object for json_schema/openapi_response, SQL string for sql)."New value: +"The artifact to validate, as a JSON value — not a JSON-encoded string. json_schema/openapi_response: the object/array/value itself. sql: the SQL statement as a string." - added
Input schema / properties / artifact / typeAdded value: +[ + "object", + "array", + "string", + "number", + "boolean", + "null" +] - added
Input schema / properties / contract / typeAdded value: +"object"
1 tool update
v0.1.1- First observed
validate
TDQS
With only one tool, there is no possibility of confusion or overlap. The single tool's purpose is clearly and uniquely defined.
The single tool name 'validate' is concise, follows a verb-action pattern expected for a validation server, and is fully consistent within the set.
Having only one tool feels thin for a server that could potentially offer multiple validation operations or contract management. While the tool covers the core validation task, the scope seems limited.
The tool comprehensively addresses the server's stated purpose of validating artifacts against contracts, supporting three common validation types (json_schema, openapi_response, sql) through a single API.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Check AI work against requirements and return structured verdicts, findings, and repair steps.
Preflight QA for AI-agent deliverables with structured verdicts and repair guidance.
Pre-execution governance for AI agents. Deterministic PASS/FAIL/REVIEW verdicts, replayable proof.
Verified AI-agent outcomes: secret scanning, JSON cleanup, dedupe, anomaly and schema checks.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceValidates AI-generated code against actual codebases to catch hallucinations, dead code, and API mismatches before runtime.241MIT
- FlicenseNot gradedqualityBmaintenanceMonitor AI output schemas and API contracts for breaking changes — validate LLM JSON responses against defined schemas on a schedule-
- AlicenseNot gradedqualityAmaintenanceEnables deterministic semantic verification of agent-generated SQL queries against a git-versioned contract, blocking incorrect queries and returning structured feedback for self-correction.MIT

EVIDIQ Rubric MCPofficial
AlicenseNot gradedqualityBmaintenanceDetermines whether a deliverable meets its contract using deterministic rules, criteria, and signed attestations.1MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/machinegrade/validate'
If you have feedback or need assistance with the MCP directory API, please join our Discord server