模型代码助手
一个模型上下文协议服务器,通过大型语言模型提供代码修改和生成的工具,允许用户使用结构化的XML指令创建、修改、重写和删除文件。
可用工具 (12 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
list_directory 1 个参数 需填 1 项
Lists directory contents using system ls/dir command
必填参数:path
create_directory 1 个参数 需填 1 项
Creates a new directory
必填参数:path
create_file 2 个参数 需填 1 项
Creates a new file with content
必填参数:path
delete_file 1 个参数 需填 1 项
Deletes a file
必填参数:path
modify_file 2 个参数 需填 2 项
Modifies parts of a file using string replacements
必填参数:path、replacements
rewrite_file 2 个参数 需填 2 项
Rewrites entire file content
必填参数:path、content
read_file 1 个参数 需填 1 项
Reads file content
必填参数:path
file_tree 1 个参数 需填 1 项
Lists directory tree structure with git tracking support
必填参数:path
git_status 1 个参数 需填 1 项
Shows git repository status
必填参数:repo_path
git_diff 2 个参数 需填 2 项
Shows git diff
必填参数:repo_path、target
git_log 2 个参数 需填 1 项
Shows git commit history
必填参数:repo_path
git_show 2 个参数 需填 2 项
Shows git commit details
必填参数:repo_path、revision
服务介绍
mcp-server-code-assist: 一个代码辅助 MCP 服务器
概述
这是一个用于代码修改和生成的模型上下文协议(MCP)服务器。该服务器提供了通过大型语言模型创建、修改和删除代码的工具。
工具
-
create- 创建新文件
- 输入:包含路径和内容的 XML 指令
- 返回:文件创建确认
-
modify- 通过搜索/替换修改现有文件
- 输入:包含路径、搜索模式和新内容的 XML 指令
- 返回:更改差异
-
rewrite- 完全重写一个文件
- 输入:包含路径和新内容的 XML 指令
- 返回:重写确认
-
delete- 删除文件
- 输入:包含路径的 XML 指令
- 返回:删除确认
XML 格式
<Plan>
Describe approach and reasoning
</Plan>
<file path="/path/to/file" action="create|modify|rewrite|delete">
<change>
<description>What this change does</description>
<search>
===
Original code for modification
===
</search>
<content>
===
New or modified code
===
</content>
</change>
</file>
安装
使用 uv (推荐)
uvx mcp-server-code-assist
使用 pip
pip install mcp-server-code-assist
python -m mcp_server_code_assist
配置
与 Claude Desktop 一起使用
"mcpServers": {
"code-assist": {
"command": "uvx",
"args": ["mcp-server-code-assist"]
}
}
"mcpServers": {
"code-assist": {
"command": "docker",
"args": ["run", "--rm", "-i", "--mount", "type=bind,src=/Users/username,dst=/Users/username", "mcp/code-assist"]
}
}
与 Zed 一起使用
添加到 settings.json 中:
"context_servers": {
"mcp-server-code-assist": {
"command": {
"path": "uvx",
"args": ["mcp-server-code-assist"]
}
}
},
开发
cd src/code-assist
uvx mcp-server-code-assist
# For docker:
docker build -t mcp/code-assist .
许可证
MIT 许可证。详情请参阅 LICENSE 文件。