feat: MCP server for Claude Desktop integration#1372
feat: MCP server for Claude Desktop integration#1372Supernova1744 wants to merge 6 commits intortk-ai:developfrom
Conversation
Next Release
…master--components--rtk chore(master): release 0.37.0
Exposes RTK's filter pipeline as a bash tool via Model Context Protocol, enabling the same 60-90% token savings in Claude Desktop that Claude Code users get via hooks. Key additions: - src/mcp/ — sync stdio JSON-RPC 2.0 server (no tokio, <10ms startup) - protocol.rs: Request/Response/Error types + MCP result structs - transport.rs: BufReader<Stdin> line-delimited reader + stdout writer - handler.rs: initialize/tools-list/tools-call/ping/shutdown dispatch - install.rs: writes rtk entry into claude_desktop_config.json (cross-platform) - rtk mcp-serve: start the server - rtk mcp-install: register in Claude Desktop config - src/core/tracking.rs: add source column (hook|mcp|direct) to SQLite with backward-compatible ALTER TABLE migration; adds record_with_source() and track_with_source() for MCP-tagged entries - tests/mcp_integration.rs: E2E tests (#[ignore]) — spawn binary, full JSON-RPC handshake over pipes, filter verification - docs/MCP.md: install, verify, troubleshoot guide - 41 unit tests covering all protocol types, handler methods, shell_split, and install helpers Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
On Windows, shell builtins (echo, dir, etc.) have no standalone binary.
RTK's run_fallback returns exit 127 when the binary isn't found. The MCP
handler now retries via `cmd /C` when RTK exits 127, making builtins
and compound expressions work cross-platform.
Also fix test_shutdown_cleanly_closes_server: shutdown returns
{"result":null} which is not is_object(); check absence of "error" instead.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- Add Claude Desktop row to Supported AI Tools table - Add Claude Desktop (MCP) section with setup steps, architecture diagram, manual config instructions, and link to docs/MCP.md - Add Claude Desktop nav link in header - Add docs/MCP.md to Documentation section Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
CI seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
📊 Automated PR Analysis
SummaryAdds an MCP server ( Review Checklist
Analyzed automatically by wshm · This is an automated analysis, not a human review. |
|
Dear @aeppling, |
Summary
rtk mcp-serve— a synchronous stdio JSON-RPC 2.0 MCP server (no tokio, <10ms startup) that exposes RTK's full filter pipeline as abashtool for Claude Desktoprtk mcp-install— one-command installer that writes the MCP server entry into Claude Desktop's config on macOS, Windows, and Linuxsourcecolumn (hook | mcp | direct) to the SQLite tracking database with a backward-compatibleALTER TABLEmigration, sortk gain --historydistinguishes Claude Desktop usage from Claude Code hook usageArchitecture
New files
src/mcp/protocol.rssrc/mcp/transport.rsBufReader<Stdin>line reader + stdout writersrc/mcp/handler.rsinitialize,tools/list,tools/call,ping,shutdownsrc/mcp/install.rsclaude_desktop_config.json, cross-platform pathstests/mcp_integration.rsdocs/MCP.mdTest plan
cargo test --bin rtk mcp) — all passcargo test --test mcp_integration -- --ignored) — all pass on Linux and Windowsinitialize → tools/list → tools/call git log -3returns RTK-filtered outputrtk mcp-installcreates config at correct path, idempotent on second runecho,dir) fall back tocmd /Cwhen RTK exits 127rtk gain --historyshowssource=mcpfor Claude Desktop commandsHow to test locally
🤖 Generated with Claude Code