Skip to content

feat: add the judgment-pack mcp server (offline, hand-rolled, zero new deps)#12

Merged
kikashy merged 2 commits into
mainfrom
feat/mcp-server
Jul 24, 2026
Merged

feat: add the judgment-pack mcp server (offline, hand-rolled, zero new deps)#12
kikashy merged 2 commits into
mainfrom
feat/mcp-server

Conversation

@kikashy

@kikashy kikashy commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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): the initialize handshake, tools/list, tools/call, ping, and error handling.
  • Four read-only tools, each delegating to the existing core and evaluating nothing: validate, test_conformance, get_schema, describe_runtime.
  • Wired as the top-level judgment-pack mcp subcommand.

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 — including oauth2, 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 dependenciesgo.mod/go.sum are unchanged and the build stays on go 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

  • Protocol round-trip test + CLI-wiring test; full suite green; conformance 47/47; gofmt clean.
  • Independent agent-driven end-to-end test: a no-context agent, talking to judgment-pack mcp only through a strict MCP stdio client, authored a valid pack purely through the tools (valid on the first validate call). Zero protocol violations; correct isError semantics (including false for invalid documents); all four tools behaved per schema; test_conformance reported 47/47 over MCP; diagnostics matched CLI quality (e.g. JPS-STRUCTURE-DECIMAL-OPERAND at 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.md note the command.

No release.

🤖 Generated with Claude Code

kikashy and others added 2 commits July 24, 2026 18:44
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>
@kikashy
kikashy merged commit 0e6876b into main Jul 24, 2026
4 checks passed
@kikashy
kikashy deleted the feat/mcp-server branch July 24, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant