Repository navigation
feat: spec-conformant MCP server and CLI fixes - #16
Merged
9thLevelSoftware merged 1 commit intoOct 1, 2026
Merged
Conversation
MCP server (rewritten, protocol 2025-11-25): - Negotiate the protocol version (echo a supported one, else our newest); advertise the Tasks capability only where the revision has it. - Implement the spec's experimental Tasks utility instead of the ad-hoc methods: task-augmented `clodex_build` (execution.taskSupport), plus tasks/get, tasks/result (blocks, returns the tool result), tasks/list (opaque cursors) and tasks/cancel, with spec shapes and -32602 errors. `tasks/update` was never part of the spec and is removed. - JSON-RPC hygiene: errors keep the request id, notifications and stray responses get no reply, ping, parse/invalid-request codes, batch refused, unexpected exceptions become -32603 with the id. - Argument problems are tool-level errors (isError) so the model can fix them; an unknown tool is a protocol error; the workflow is built lazily so a bad call creates no state. - Requests run in arrival order (clients may pipeline stateful calls); only long-running work (sync plan/build/audit, tasks/result waits) moves to a worker thread so ping/poll/cancel are never blocked. A cancelled-request notification or EOF releases a waiting tasks/result. - Repo root from CLODEX_REPO_ROOT or the git root; version from __version__; clodex_build exposes workspace and approval_profile. - Wire messages validated against the official SDK's 2025-11-25 schema models (optional `mcp` test extra; CI installs it). CLI: - `audit --base REF` / `--commit SHA` (and --diff as the explicit default); an empty diff reports nothing-to-audit instead of running reviewers. - Plain-text output without --json (doctor shows [ok]/[FAIL]/[warn] lines with fixes); exit codes 0 ok / 1 blocked / 2 usage / 3 failed / 4 cancelled; unknown run ids and bad refs are one-line errors (CLODEX_DEBUG=1 for the traceback). - Every command finds the repo root from any subdirectory instead of using the cwd. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
5 of 6 tasks
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.
Summary
Stacked on #15 (PR 7 of the modernization plan).
MCP server (rewritten)
clodex_build(execution.taskSupport: optional) +tasks/get,tasks/result(blocks, returns the tool result with related-task_meta),tasks/list(opaque cursors),tasks/cancel(-32602 for unknown / already-terminal).run_idis the task id.tasks/updateremoved.ping, -32700/-32600, batch refused, exceptions → -32603 with the id.isError) so the model can self-correct; unknown tool = protocol error; workflow built lazily (a bad call no longer creates state).tasks/resultwaits) runs on a thread, so ping/poll/cancel never block.notifications/cancelledand EOF release a waitingtasks/result. (My first version ran everything on a pool and broke pipelined calls — caught by the existing tests.)CLODEX_REPO_ROOTor the git root; version from__version__;clodex_buildexposesworkspace/approval_profile;clodex_auditexposesbase/commit.CLI
audit --base REF | --commit SHA(+--diffas the explicit default); empty diff →nothing-to-audit.--json(doctor shows[ok]/[FAIL]/[warn]+ fixes); exit codes 0 ok / 1 blocked / 2 usage / 3 failed / 4 cancelled; unknown run ids and bad refs are one-line errors (CLODEX_DEBUG=1for the traceback).Test plan
mcp)execution, ping, tool errors and unknown-tool errors_v2025_11_25wire models. Note: SDK v2 deliberately has no high-level 2025-11-25tasks/*client routing ("tasks/* deliberately absent" in its method table; the 2026-07-28 revision reworked them), so task messages are validated against its models directly. Supporting 2026-07-28 is not done here.clodex audit --commit HEADwith real claude + codex (Claude approved, Codex raised a substantive finding →blocked, exit 1); bad ref → one-line error, exit 2; realdoctorhuman output🤖 Generated with Claude Code