machinegrade validate MCP server
✓ 인증됨AI가 생성한 JSON, OpenAPI 응답, SQL 구문을 지정된 계약에 따라 검증하여 결정론적인 출력 품질을 보장합니다.
다른 이름 machinegrade/validate, @machinegrade/validate
- 스타
- 2
- Tools
- —
- 다운로드, 30일
- —
- 최신 버전
- 0.1.2
- 마지막 커밋
- 2026년 7월 26일
- 라이선스
- MIT
machinegrade validate MCP란?
machinegrade validate은(는) MCP server입니다. AI가 생성한 JSON, OpenAPI 응답, SQL 구문을 지정된 계약에 따라 검증하여 결정론적인 출력 품질을 보장합니다.
프로젝트 README에서 생성된 요약
machinegrade validate MCP server 정보
machinegrade validate는 자율형 에이전트를 구축하는 개발자가 AI가 생성한 코드와 데이터 구조가 엄격한 요구 사항을 충족하는지 확인할 수 있도록 지원합니다. 이 도구는 JSON, OpenAPI 응답, SQL 구문과 같은 결과물을 다운스트림 시스템에서 처리하기 전에 특정 계약에 따라 검증하는 결정론적인 방법을 제공합니다. 이 server를 사용하면 품질 관리를 위해 LLM을 판사로 사용하는 데 따르는 높은 비용과 예측 불가능성을 피할 수 있습니다.
streamable HTTP MCP 엔드포인트를 통해 원격으로 서비스에 연결하거나 stdio 어댑터를 사용하여 로컬에서 실행할 수 있습니다. 시스템 사용을 위해서는 셀프 서비스 프로세스를 통해 발급받은 API key가 필요합니다. 월 500회 호출과 분당 60회 호출 제한이 적용되는 무료 티어를 제공합니다. server는 유효성 상태, 발견된 오류, 지연 시간 측정을 포함한 판정 결과를 제공하며, 유효하지 않은 출력이라도 시스템 에러가 아닌 성공적인 HTTP 200 응답으로 반환되도록 보장합니다.
활용 사례
- 1JSON Schema 준수 여부 확인AI가 생성한 JSON 객체가 특정 스키마 구조와 일치하는지 확인합니다.
- 2OpenAPI 응답 본문 검증API 응답 본문이 특정 경로, 메서드 및 상태 코드에 대해 예상되는 스키마를 준수하는지 확인합니다.
- 3SQL 구문 정확도 체크생성된 SQL 문자열이 선택한 데이터베이스 방언에 대해 구문적으로 올바른지 확인합니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
machinegrade validate MCP 설치 방법
형식 확인: 2026년 11월 10일Cursor에 추가Goose에 추가Claude Code에 machinegrade validate MCP 설치
$ claude mcp add --env 'SANDBOX_API_KEY=<YOUR_SANDBOX_API_KEY>' validate -- npx -y @machinegrade/validateCursor에 machinegrade validate MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"validate": {
"command": "npx",
"args": [
"-y",
"@machinegrade/validate"
],
"env": {
"SANDBOX_API_KEY": "<YOUR_SANDBOX_API_KEY>"
}
}
}
}VS Code에 machinegrade validate MCP 설치
.vscode/mcp.json
{
"servers": {
"validate": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@machinegrade/validate"
],
"env": {
"SANDBOX_API_KEY": "<YOUR_SANDBOX_API_KEY>"
}
}
}
}VS Code CLI에 machinegrade validate MCP 설치
$ code --add-mcp '{"name":"validate","type":"stdio","command":"npx","args":["-y","@machinegrade/validate"],"env":{"SANDBOX_API_KEY":"<YOUR_SANDBOX_API_KEY>"}}'Claude Desktop에 machinegrade validate MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"validate": {
"command": "npx",
"args": [
"-y",
"@machinegrade/validate"
],
"env": {
"SANDBOX_API_KEY": "<YOUR_SANDBOX_API_KEY>"
}
}
}
}Codex에 machinegrade validate MCP 설치
$ codex mcp add validate --env 'SANDBOX_API_KEY=<YOUR_SANDBOX_API_KEY>' -- npx -y @machinegrade/validateCodex config.toml에 machinegrade validate MCP 설치
~/.codex/config.toml
[mcp_servers.validate] command = "npx" args = ["-y", "@machinegrade/validate"] [mcp_servers.validate.env] SANDBOX_API_KEY = "<YOUR_SANDBOX_API_KEY>"
Gemini CLI에 machinegrade validate MCP 설치
$ gemini mcp add -s user -e 'SANDBOX_API_KEY=<YOUR_SANDBOX_API_KEY>' validate npx -- -y @machinegrade/validateGemini settings.json에 machinegrade validate MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"validate": {
"command": "npx",
"args": [
"-y",
"@machinegrade/validate"
],
"env": {
"SANDBOX_API_KEY": "<YOUR_SANDBOX_API_KEY>"
}
}
}
}구성
SANDBOX_API_KEY필수비밀API key issued via POST https://api.machinegrade.dev/keys (free tier: 500 calls/month)
SANDBOX_URLBase URL of the validate API
| 이름 | 설명 | 유형 |
|---|---|---|
| SANDBOX_API_KEY | API key issued via POST https://api.machinegrade.dev/keys (free tier: 500 calls/month) | 필수비밀 |
| SANDBOX_URL | Base URL of the validate API |
자동 검사
2026년 11월 14일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 이는 보안 감사가 아닙니다. 코드를 직접 읽고 서버에 필요한 최소한의 권한만 부여하십시오. 검사 방식
- 소스 저장소 연결 및 접근 가능machinegrade/validate is public and reachablegithub.com/machinegrade/validate ↗통과
- 패키지가 이 저장소를 소스로 명시@machinegrade/validate names machinegrade/validate as sourcenpmjs.com/package/@machinegrade/validate ↗통과
- 빌드 출처(Sigstore 증명)No build attestation published for this release검사되지 않음
- 오픈 소스 라이선스 (OSI)MITspdx.org/licenses/MIT.html ↗통과
- 최근 1년 내 커밋 또는 릴리스Last commit or release 2026-07-26github.com/machinegrade/validate ↗통과
- OpenSSF Scorecard검사되지 않음
- 패키지 이름이 인기 패키지와 유사하지 않음No popular package one edit away from @machinegrade/validate통과
- 패키지 및 해당 종속성에 중요한 보안 권고 없음103 resolved dependencies checked; no critical advisoryosv.dev ↗통과
- 모델에 대한 숨겨진 지침 없음0 tool descriptions and the README read; no override phrases, credential paths or hidden characters통과
- 파괴적인 도구에 라벨 표시됨검사되지 않음
- 원격 엔드포인트가 MCP 핸드셰이크에 응답initialize answered with protocol 2025-06-18 in 54 ms통과
README
GitHub에서 보기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.
Run it locally
npm install
npm run dev
# machinegrade validate listening on http://localhost:8787
3 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/mcp
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:
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 |
|---|---|---|
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 |
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 |
|---|---|---|
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.
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"}}} // wrong
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 |
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 # production
Testing
npm test # vitest run, in-process via app.request(), MemoryStorage
npm run typecheck # tsc --noEmit
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.
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 deploy
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.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.
machinegrade validate MCP 질문
machinegrade validate MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add --env 'SANDBOX_API_KEY=<YOUR_SANDBOX_API_KEY>' validate -- npx -y @machinegrade/validate를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
machinegrade validate MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
이 server로 무엇을 검증할 수 있나요?
JSON Schema를 통한 JSON 결과물 검증, OpenAPI 명세에 따른 API 응답 본문 확인, 특정 방언에 대한 SQL 구문 검증이 가능합니다.
무료 티어가 있나요?
네, 월 500회 호출이 가능하며 분당 호출 제한은 60회인 무료 티어를 제공합니다.