
Deskaid
一个 MCP 服务器,提供用于在本地文件系统上读取、写入和编辑文件的工具。
Tools
deskaid
This is a multipurpose tool that supports the following subcommands: ## ReadFile file_path offset? limit? Reads a file from the local filesystem. The file_path parameter must be an absolute path, not a relative path. By default, it reads up to ${MAX_LINES_TO_READ} lines starting from the beginning of the file. You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters. Any lines longer than ${MAX_LINE_LENGTH} characters will be truncated. For image files, the tool will display the image for you. ## WriteFile file_path content Write a file to the local filesystem. Overwrites the existing file if there is one. Before using this tool: 1. Use the ReadFile tool to understand the file's contents and context 2. Directory Verification (only applicable when creating new files): - Use the LS tool to verify the parent directory exists and is the correct location ## EditFile file_path old_string new_string This is a tool for editing files. For larger edits, use the Write tool to overwrite files. Before using this tool: 1. Use the View tool to understand the file's contents and context 2. Verify the directory path is correct (only applicable when creating new files): - Use the LS tool to verify the parent directory exists and is the correct location To make a file edit, provide the following: 1. file_path: The absolute path to the file to modify (must be absolute, not relative) 2. old_string: The text to replace (must be unique within the file, and must match the file contents exactly, including all whitespace and indentation) 3. new_string: The edited text to replace the old_string The tool will replace ONE occurrence of old_string with new_string in the specified file. CRITICAL REQUIREMENTS FOR USING THIS TOOL: 1. UNIQUENESS: The old_string MUST uniquely identify the specific instance you want to change. This means: - Include AT LEAST 3-5 lines of context BEFORE the change point - Include AT LEAST 3-5 lines of context AFTER the change point - Include all whitespace, indentation, and surrounding code exactly as it appears in the file 2. SINGLE INSTANCE: This tool can only change ONE instance at a time. If you need to change multiple instances: - Make separate calls to this tool for each instance - Each call must uniquely identify its specific instance using extensive context 3. VERIFICATION: Before using this tool: - Check how many instances of the target text exist in the file - If multiple instances exist, gather enough context to uniquely identify each one - Plan separate tool calls for each instance WARNING: If you do not follow these requirements: - The tool will fail if old_string matches multiple locations - The tool will fail if old_string doesn't match exactly (including whitespace) - You may change the wrong instance if you don't include enough context When making edits: - Ensure the edit results in idiomatic, correct code - Do not leave the code in a broken state - Always use absolute file paths (starting with /) If you want to create a new file, use: - A new file path, including dir name if needed - An empty old_string - The new file's contents as new_string Remember: when making multiple file edits in a row to the same file, you should prefer to send all edits in a single message with multiple calls to this tool, rather than multiple messages with a single call each. ## LS directory_path Lists files and directories in a given path. The path parameter must be an absolute path, not a relative path. You should generally prefer the Glob and Grep tools, if you know which directories to search. Args: ctx: The MCP context command: The subcommand to execute (ReadFile, WriteFile, EditFile, LS) file_path: The path to the file or directory to operate on content: Content for WriteFile command old_string: String to replace for EditFile command new_string: Replacement string for EditFile command offset: Line offset for ReadFile command limit: Line limit for ReadFile command
README
codemcp
通过安装 codemcp,让 Claude Desktop 成为你的结对编程助手。有了它,你可以直接要求 Claude 在你电脑上的代码库中实现功能、修复 bug 和进行重构;Claude 将直接编辑文件并运行测试。告别在 Claude 的聊天窗口中来回复制粘贴代码的繁琐!
codemcp 提供了与其他 AI 编码软件(Claude Code、Cursor、Cline、Aider)类似的功能,但它在设计空间中占据了一个独特的点:
-
它旨在与 Claude Pro 一起使用,这是 Anthropic 提供的每月 20 美元的订阅服务。告别巨额 API 账单。(迎接基于时间的速率限制。)
-
它围绕安全的主动式 AI 构建,提供了一组有限的工具,这些工具对有帮助、诚实和无害的 LLM 来说不太可能被滥用,并强制执行 Git 版本控制等最佳实践,以确保所有代码更改都可以回滚。因此,你可以安全地释放 AI,并且只在最后评估是否要接受这些更改。
-
它是IDE 不可知论的:你要求 Claude 进行更改,它进行更改,然后你可以使用你最喜欢的 IDE 设置来审查更改并进行进一步的编辑。
入门
首先,安装 uv 和 安装 git,如果它们尚未安装(在 Windows 上,如果你安装了 Git,我建议重启)。
然后,在 claude_desktop_config.json
中:
{
"mcpServers": {
"codemcp": {
"command": "/Users/<username>/.local/bin/uvx",
"args": [
"--from",
"git+https://github.com/ezyang/codemcp@prod",
"codemcp"
]
}
}
}
在 Windows 上,路径需要使用双反斜杠:
C:\\Users\\<username>\\.local\\bin\\uvx.exe
修改 JSON 后,重启 Claude Desktop 应用程序。如果 MCP 成功加载,将出现一个锤子图标,单击它时将显示“codemcp”。
使用 pip 全局安装
如果你不想使用 uv,你也可以全局 pip 安装最新的 codemcp 版本,前提是你的全局 Python 安装足够新(Python 3.12)并且没有与 codemcp 冲突的 Python 依赖项。一些用户报告说这在 Windows 上更容易工作。
pip install git+https://github.com/ezyang/codemcp@prod
- 将以下配置添加到
claude_desktop_config.json
文件
{
"mcpServers": {
"codemcp": {
"command": "python",
"args": ["-m", "codemcp"]
}
}
}
- 重启 Claude Desktop
你需要手动升级 codemcp 才能使用 pip install --upgrade git+https://github.com/ezyang/codemcp@prod
获取更新
其他提示
专业提示:如果服务器加载失败,请转到 Settings > Developer > codemcp > Logs 查看 MCP 日志,它们对于调试非常有帮助。Windows 上的日志应加载到 C:\Users\<user_name>\AppData\Roaming\Claude\logs
(将 <user_name>
替换为你的用户名)。
专业提示:如果在 Windows 上,日志显示“Git executable not found. Ensure that Git is installed and available”,并且你刚刚安装了 Git,请重启你的机器(PATH 更新尚未传播。)如果这仍然不起作用,请打开 System Properties > Environment Variables > System variables > Path 并确保有一个 Git 的条目。
专业提示:如果你喜欢冒险,可以将 prod
更改为 main
。如果你想固定到特定版本,请将其替换为 0.3.0
或类似版本。
专业提示:支持仅指定 uvx
作为命令,但 uvx 必须位于你的全局 PATH 中(不仅仅是通过 shell 配置文件添加);在 OS X 上,如果你使用了自安装程序(除非你安装到 /usr/local/bin
等系统位置),通常情况并非如此。
用法
首先,你必须在你想要处理的 Git 存储库检出中创建一个 codemcp.toml
文件。如果你希望代理能够执行诸如运行格式化程序或运行测试之类的操作,请将执行它们的命令添加到 commands 部分(注意:这些命令需要适当地设置它们需要的任何虚拟环境):
format = ["./run_format.sh"]
test = ["./run_test.sh"]
接下来,在 Claude Desktop 中,我们建议创建一个 Project 并将其放入 Project Instructions 中:
Initialize codemcp with $PROJECT_DIR
其中 $PROJECT_DIR
是你想要处理的项目的路径。
然后与 Claude 聊天,了解你想要对项目进行的更改。每次 codemcp 对你的代码进行更改时,它都会生成一个提交。
要查看使用此工具的一些示例记录,请查看:
codemcp 将为每次聊天生成一个提交,并在处理你的功能时修改它。
哲学
-
当你受到速率限制时,花时间做其他事情(审查 Claude 的代码,审查其他人的代码,制定计划,参加一些会议)
-
这不是一个自主代理。至少,你必须在每次聊天后进行干预,以审查更改并请求下一个更改。虽然你可以要求在一个聊天中完成很长的事情列表,但你可能会达到 Claude Desktop 的输出限制,并且必须手动“继续”代理。接受它,并利用中断来确保 Claude 正在做正确的事情。
-
当 Claude 偏离轨道时,它会花费你的时间而不是金钱。相应地行事:如果时间是瓶颈,请仔细观察 Claude 的增量输出。
配置
以下是 codemcp.toml
支持的所有配置选项:
project_prompt = """
Before beginning work on this feature, write a short haiku. Do this only once.
"""
[commands]
format = ["./run_format.sh"]
test = ["./run_test.sh"]
project_prompt
将在你初始化聊天中的项目时加载。
commands
部分允许你配置特定工具的命令。这些名称会告诉 LLM,LLM 将决定何时运行它们。你可以在 project_prompt
中添加有关如何使用工具的说明;我们还支持更详细的语法,你可以在其中提供关于每个工具的特定说明:
[commands.test]
command = ["./run_test.sh"]
doc = "Accepts a pytest-style test selector as an argument to run a specific test."
故障排除
要使用检查器运行服务器,请使用:
PYTHONPATH=. mcp dev codemcp/__main__.py
日志写入 ~/.codemcp/codemcp.log
。可以在 ~/.codemcprc
的全局配置文件中设置日志级别:
[logger]
verbosity = "INFO" # Can be DEBUG, INFO, WARNING, ERROR, or CRITICAL
日志记录无法在每个项目的基础上配置,但这应该无关紧要,因为无论如何都很难在多个项目上并行使用 Claude Desktop。
贡献
请参阅 CONTRIBUTING.md。
类型检查
本项目使用 pyright
进行类型检查,并启用了严格模式。类型检查配置位于 pyproject.toml
中。我们使用一些策略来维护类型安全:
-
外部库的类型存根:
- 自定义类型存根位于
stubs/
目录中 pyproject.toml
中的stubPackages
配置将库映射到它们的存根包
- 自定义类型存根位于
-
针对具有挑战性的案例的文件特定忽略:
- 对于一些具有复杂动态类型模式的文件(特别是测试代码),我们使用
tool.pyright.ignoreExtraErrors
在pyproject.toml
中进行文件特定忽略 - 这比内联忽略更好,并且让我们在大多数代码库中保持类型安全
- 对于一些具有复杂动态类型模式的文件(特别是测试代码),我们使用
进行更改时,请确保通过运行以下命令来通过类型检查:
./run_typecheck.sh
推荐服务器
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Excel MCP Server
一个模型上下文协议服务器,使 AI 助手能够读取和写入 Microsoft Excel 文件,支持诸如 xlsx、xlsm、xltx 和 xltm 等格式。
Playwright MCP Server
提供一个利用模型上下文协议的服务器,以实现类人浏览器的自动化,该服务器使用 Playwright,允许控制浏览器行为,例如导航、元素交互和滚动。
MCP Package Docs Server
促进大型语言模型高效访问和获取 Go、Python 和 NPM 包的结构化文档,通过多语言支持和性能优化来增强软件开发。
Claude Code MCP
一个实现了 Claude Code 作为模型上下文协议(Model Context Protocol, MCP)服务器的方案,它可以通过标准化的 MCP 接口来使用 Claude 的软件工程能力(代码生成、编辑、审查和文件操作)。
@kazuph/mcp-taskmanager
用于任务管理的模型上下文协议服务器。它允许 Claude Desktop(或任何 MCP 客户端)在基于队列的系统中管理和执行任务。
Apple MCP Server
通过 MCP 协议与 Apple 应用(如“信息”、“备忘录”和“通讯录”)进行交互,从而使用自然语言发送消息、搜索和打开应用内容。
Gitingest-MCP
一个用于 gitingest 的 MCP 服务器。它允许像 Claude Desktop、Cursor、Cline 等 MCP 客户端快速提取关于 Github 仓库的信息,包括仓库摘要、项目目录结构、文件内容等。