feat: MCP server for Claude Desktop integration#1372
Open
Supernova1744 wants to merge 6 commits intortk-ai:developfrom
Open
feat: MCP server for Claude Desktop integration#1372Supernova1744 wants to merge 6 commits intortk-ai:developfrom
Supernova1744 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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
- 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 <noreply@anthropic.com>
|
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. |
Collaborator
📊 Automated PR Analysis
SummaryAdds an MCP server ( Review Checklist
Analyzed automatically by wshm · This is an automated analysis, not a human review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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