davsclaus opened a new pull request, #23494: URL: https://github.com/apache/camel/pull/23494
## Summary _Claude Code on behalf of Claus Ibsen_ Adds an embedded MCP (Model Context Protocol) server to the Camel TUI, allowing AI coding agents (Claude Code, etc.) to observe and control the live terminal session. Uses JDK's built-in `HttpServer` with the Streamable HTTP transport (spec 2025-03-26) — zero new dependencies. - Embedded MCP server on port 8123 (configurable via `--mcp-port`), bound to 127.0.0.1 only - 6 MCP tools: `tui_get_screen`, `tui_get_events`, `tui_get_state`, `tui_show_caption`, `tui_navigate`, `tui_send_keys` - Auto-generated `.mcp.json` for zero-config Claude Code discovery - MCP Log viewer (F2 menu) with master/detail layout showing request/response JSON - Footer connection indicator: green with client name when connected, dim with red ✗ when not - Caption overlay improvements: `tui_show_caption` tool + Ctrl+Shift+T inline caption mode - Key injection for AI-driven demo recording with configurable delay - Daemon threads for clean JVM shutdown ### MCP Tools | Tool | Description | |------|-------------| | `tui_get_screen` | Returns current screen content as text (plain or ANSI) | | `tui_get_events` | Returns recent key press history with timestamps | | `tui_get_state` | Returns active tab, selected integration, integration count | | `tui_show_caption` | Shows a message on the TUI with typewriter animation | | `tui_navigate` | Switch tabs and/or select integrations by name or PID | | `tui_send_keys` | Inject key presses for demo recording (configurable delay) | ### Usage ```bash camel tui --mcp ``` Then connect Claude Code: ```bash claude mcp add --transport http camel-tui http://localhost:8123/mcp ``` ### New files - `TuiMcpServer.java` — MCP server with JSON-RPC 2.0 protocol handling - `TuiEventLog.java` — thread-safe ring buffer for key event history - `McpLogPopup.java` — master/detail log viewer for MCP activity ## Test plan - [ ] Start `camel tui --mcp`, verify "MCP :8123 ✗" appears in footer (dim, red cross) - [ ] `curl -X POST http://localhost:8123/mcp -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","clientInfo":{"name":"test"},"capabilities":{}}}'` — verify JSON response with server info - [ ] Connect Claude Code, verify footer shows green "MCP :8123 (Claude Code)" with activity dot - [ ] F2 → MCP Log shows request/response details in master/detail view - [ ] F2 → MCP Info shows tool documentation and setup instructions - [ ] Test each tool via Claude Code or curl - [ ] Quit TUI with `q` — verify clean exit (no hang from MCP threads) 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
