节点开发MCP服务器
用于本地工作区文件操作和git命令的轻量级MCP服务器。
工具
| 工具 | 描述 | 输入(JSON) |
|---|---|---|
| start_work | 从env设置远程URL,提取最新更改,创建和推送分支,并安装依赖项 | { "branch": "feature-branch", "currentWorkingDirectory": ".", "installWithLegacyPeerDependencies": false, "startPoint": "main", "commitMessage": "Bootstrap workspace" } |
| read_file | 读取工作区文件夹中的文件内容 | { "name": "path/to/file.txt" } |
| write_file | 将内容写入工作区文件夹中的文件 | { "name": "path/to/file.txt", "content": "...", "commitMessage": "Update notes" } |
| delete_file | 从工作区文件夹中删除文件 | { "name": "path/to/file.txt", "commitMessage": "Remove obsolete file" } |
| create_folder | 在工作区文件夹中创建一个文件夹 | { "name": "path/to/folder", "commitMessage": "Add new folder" } |
| delete_folder | 从工作区文件夹中删除文件夹 | { "name": "path/to/folder", "commitMessage": "Remove deprecated folder" } |
| copy_folder | 复制工作区文件夹中的文件夹 | { "name": "path/to/folder", "newName": "path/to/new-folder", "commitMessage": "Copy folder" } |
| search_content | 使用ripgrep(rg)在工作区中搜索文件内容 | { "pattern": "TODO", "flags": "i", "path": "src" } |
| apply_patch | 在工作区中应用统一的差异补丁 | { "patch": "diff --git a/foo.txt b/foo.txt\n...", "dryRun": false, "commitMessage": "Apply patch" } |
| search_entrys | 使用正则表达式在工作区中搜索文件和文件夹 | { "pattern": "src/.*\\.ts$", "flags": "i" } |
| list_dir | 列出工作区文件夹或子文件夹中的文件和文件夹 | { "name": "path/to/folder" } 或 {} |
| vcs_status | 获取存储库的状态 | {} |
| vcs_diff | 获取存储库差异 | { "staged": false, "file": "path/to/file.txt" } 或 { "base": "main", "head": "HEAD" } |
| vcs_log | 显示提交日志 | { "limit": 10 } |
| install_dependences | 在工作区中安装所有依赖项 | { "currentWorkingDirectory": ".", "commitMessage": "Update dependencies" } |
| install_package | 在工作区中安装单个包 | { "currentWorkingDirectory": ".", "name": "lodash@4.17.21", "commitMessage": "Add lodash" } |
| run_build | 在工作区中运行构建脚本 | { "currentWorkingDirectory": ".", "commitMessage": "Build artifacts" } |
| run_script | 在工作区中运行脚本 | { "currentWorkingDirectory": ".", "script": "test", "commitMessage": "Run tests" } |
笔记:
PROJECT_REPO和GITHUB_TOKEN必须进行设置,以便git远程/推送操作可以进行身份验证。currentWorkingDirectory必须解析到工作区根目录内的目录。使用.对于工作区根目录。- 命令工具在响应中包括stdout/stderr,并将长输出修剪到最后300行。
