ExMCP.ACP.Adapters.Claude (ex_mcp v0.9.0)
View SourceAdapter for Claude Code CLI.
Translates between ACP JSON-RPC and Claude's stream-json NDJSON protocol.
Ported from Arbor's CliTransport + StreamParser.
Claude CLI Protocol
- Input: NDJSON on stdin with
{"type":"user","message":{...},"session_id":"..."} - Output: NDJSON on stdout with event types:
stream_event,assistant,user,result - Args:
--output-format stream-json --input-format stream-json --verbose
ACP Mapping
| Claude Event | ACP Message |
|---|---|
stream_event (text_delta) | session/update notification (text) |
stream_event (thinking_delta) | session/update notification (thinking) |
assistant | accumulate content blocks |
assistant (tool_use) | session/update notification (tool_call) |
user (tool_result) | session/update notification (tool_result) |
result | prompt response result |
Features
- Session resume via
--resume <session_id>flag - Thinking block streaming with deduplication
- Multi-turn tool use cycle tracking
- Usage tracking with cache token support
- Configurable thinking budget
Limitations
- No session persistence/listing (sessions managed by Claude CLI)
- No mode switching (Claude CLI uses
--dangerously-skip-permissions) - No session cancel (would need SIGINT to Port subprocess)
- No runtime config changes (static at launch)