Claude Code hooks integrating with PoC memory
- Rust 100%
JSON-RPC 2.0 notifications are fire-and-forget and omit the `id` field entirely. The server was requiring `id: Value`, so MCP clients sending `notifications/initialized` after the handshake got a `parse error: missing field \`id\`` response back. Claude Code then treated the handshake as broken and never called `tools/list`, so none of our memory/journal/graph/channel tools showed up in the client's tool list. Make `Request.id` an `Option<Value>` with `#[serde(default)]`: - Missing id → notification (None) → no response of any kind. - Explicit null id → still a request, null response id (legal). - Parse errors still respond with id:null per spec. Update respond() / respond_error() to no-op on None so a dispatched handler that tries to reply to a notification silently does nothing instead of violating the spec. Verified with a manual handshake: initialize → notification → tools/list now round-trips cleanly. Co-Authored-By: Proof of Concept <poc@bcachefs.org> |
||
|---|---|---|
| src | ||
| Cargo.lock | ||
| Cargo.toml | ||