Skip to main content

Module http_listener

Module http_listener 

Source
Expand description

marshal’s own minimal plain-HTTP listener for the Claude Code /hook/* endpoints.

Deliberately separate from myko’s listener. Stock myko serves /myko/mcp (WS + HTTP MCP) on its own port and we do not fork it to bolt on extra routes. The hooks need a dumb plain-HTTP endpoint a curl one-liner POSTs raw hook JSON to, so marshal binds a second port and shares the server’s Arc<CellServerCtx> — same registry, same event log, no second source of truth.

The HTTP handling is intentionally tiny: HTTP/1.1, Content-Length bodies only (curl --data-binary @- always sends one), one request per connection, Connection: close. Hook bodies are a few hundred bytes; anything fancier would be a dependency we don’t need.

Functions§

run
Run the hook listener forever. Spawn on a tokio task.