feat: add the judgment-pack mcp server (offline, hand-rolled, zero new deps)#12
Merged
Conversation
Expose the offline validation core to Model Context Protocol clients over stdio, so an agent can validate documents as tool calls. The server speaks MCP's newline-delimited JSON-RPC 2.0 directly -- no SDK -- keeping the runtime's dependency set unchanged and its build on Go 1.21. internal/mcp handles the initialize handshake, tools/list, tools/call, and ping, and exposes four read-only tools that delegate to the existing engine and evaluate nothing: validate, test_conformance, get_schema, and describe_runtime. It holds no credential and opens no network connection -- an MCP client reaches exactly the same core the CLI reaches. Wired as a top-level "judgment-pack mcp" subcommand. Covered by a protocol round-trip test and a CLI-wiring test, and exercised end-to-end by a no-context agent that authored a valid document purely through the tools with no protocol violations. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Brian Jin <35789537+kikashy@users.noreply.github.com>
Mark ADR-0003 accepted and record the implementation decision: the server is hand-rolled rather than built on an MCP SDK, because both Go SDKs require a Go 1.25 toolchain and pull heavy dependencies (including oauth2) that conflict with this runtime's minimal, offline, Go 1.21 posture. An SDK belongs in a future commercial, authenticated service -- a separate layer per ADR-0002 and the repository boundary -- not in the public offline runtime. Add "judgment-pack mcp" to the README command list, and note in docs/agent-testing.md that the MCP surface now exists alongside the CLI loop. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Brian Jin <35789537+kikashy@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements Phase 1 of ADR-0003: a Model Context Protocol server exposing the offline validator to any MCP client, so an agent can validate documents as tool calls.
What
internal/mcp— a hand-rolled MCP server over stdio (newline-delimited JSON-RPC 2.0): theinitializehandshake,tools/list,tools/call,ping, and error handling.validate,test_conformance,get_schema,describe_runtime.judgment-pack mcpsubcommand.Why hand-rolled (no SDK)
Both Go MCP SDKs (
modelcontextprotocol/go-sdk,mark3labs/mcp-go) require a Go 1.25 toolchain and pull heavy dependencies — includingoauth2, which a keyless offline server never uses. That conflicts with this runtime's minimal, offline, Go 1.21 posture. The MCP surface here is small (four read-only tools over stdio), so the server speaks the protocol directly and adds zero dependencies —go.mod/go.sumare unchanged and the build stays ongo 1.21. An SDK belongs in a future commercial, authenticated API/MCP service — a separate layer per ADR-0002 and the repository boundary. Recorded in ADR-0003 (now accepted).Keyless, offline, evaluates nothing — an MCP client reaches exactly the same core the CLI does.
Verification
judgment-pack mcponly through a strict MCP stdio client, authored a valid pack purely through the tools (valid on the firstvalidatecall). Zero protocol violations; correctisErrorsemantics (includingfalsefor invalid documents); all four tools behaved per schema;test_conformancereported 47/47 over MCP; diagnostics matched CLI quality (e.g.JPS-STRUCTURE-DECIMAL-OPERANDat the exact node, unresolved refs naming the id and the declared set).Docs: ADR-0003 marked accepted with the hand-roll rationale; the README and
docs/agent-testing.mdnote the command.No release.
🤖 Generated with Claude Code