feat: implement MCP tool calling in REPL with Windows support#26
Open
coolinger2019-wq wants to merge 1 commit intolorryjovens-hub:workingfrom
Open
feat: implement MCP tool calling in REPL with Windows support#26coolinger2019-wq wants to merge 1 commit intolorryjovens-hub:workingfrom
coolinger2019-wq wants to merge 1 commit intolorryjovens-hub:workingfrom
Conversation
- Add tool definition injection to API requests in REPL - Implement tool_calls response handling and execution loop - Support filesystem as built-in MCP tool (no external process needed) - Make mcp add command parameter optional, support --path only usage - Fix command execution on Windows (use cmd /C instead of sh -c) - Fix search tool on Windows (use findstr instead of rg) - Fix UI duplicate user input display - Clean up unused variable/import warnings
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
实现了 REPL 中的 MCP 工具调用功能,使 AI 能够调用内置工具执行文件操作、命令执行等任务。同时修复了 Windows
平台兼容性问题。
Changes
1. MCP 命令改进
mcp add的command参数改为可选,支持只用--pathfilesystem工具,自动标记为 running 并注入能力2. REPL 工具调用支持
file_read,file_write,execute_command,search)tools到 API 请求tool_calls响应3. Windows 平台兼容
execute_command工具:Windows 用cmd /C,Unix 用sh -csearch工具:Windows 用findstr,Unix 用rg或grep4. UI 优化
5. 代码清理
Test Plan
claude-code mcp add filesystem --path "D:\xxx"正常工作claude-code mcp list显示filesystem (running)execute_command执行命令file_read读取文件cmd /C)Files Changed
src/cli/mod.rs- MCP 命令参数定义src/cli/args.rs- MCP 命令处理逻辑src/cli/repl.rs- REPL 工具调用实现src/cli/ui.rs- UI 显示修复src/mcp/tools.rs- Windows 兼容性src/mcp/mod.rs- filesystem 内置工具处理src/config/mcp_config.rs- 配置结构修复