编码代理MCP服务器
一个全面的模型上下文协议(MCP)服务器,提供编码代理功能,包括文件操作、终端命令、搜索功能和实用程序操作。
特性
🗂️ 文件操作
- 读/写文件:读取文件内容并使用编码支持写入/覆盖文件
- 高级文件编辑:多种编辑方法,包括:
- 支持正则表达式的字符串替换 - 基于行号的编辑 - 基于字符的精确定位编辑 - 基于差异的编辑(统一和XML格式)
- 文件管理:创建、复制、移动和删除文件
- 目录操作:使用递归选项列出、创建和删除目录
💻 终端操作
- 命令执行:使用工作目录控件运行终端命令
- 实时流媒体:实时流命令输出
- 环境管理:获取并过滤环境变量
- 命令发现:查找命令路径(which/where功能)
- 超时控制:为长时间运行的命令设置执行超时
🔍 搜索操作
- 文本搜索:在支持正则表达式的文件中搜索模式
- 文件搜索:使用glob支持按名称模式查找文件
- 查找与替换:跨多个文件批量查找和替换
- 重复检测:按内容、名称或大小查找重复文件
- 高级选项:区分大小写、整词匹配、上下文行
🛠️ 公用事业运营
- 延误:等待指定的时间段
- 系统信息:获取详细的系统和运行时信息
- UUID生成:生成UUID(v1和v4)
- 文本编码:Base64、URL和HTML编码/解码
- 哈希:使用MD5、SHA1、SHA256、SHA512生成哈希值
- JSON格式:使用键排序格式化和验证JSON
- 正则表达式验证:测试和验证正则表达式
- 文件统计:计算综合文件统计信息
🛠️ 安装
需求
- Node.js>=v18.0.0
- 光标、Windsurf、Claude Desktop或其他MCP客户端
Install in Cursor
首选 Settings → Cursor Settings → MCP → Add new global MCP server
将以下配置粘贴到游标中 ~/.cursor/mcp.json 文件是推荐的方法。您还可以通过创建以下内容在特定项目中安装 .cursor/mcp.json 在您的项目文件夹中。看 光标MCP文档 了解更多信息。
{
"mcpServers": {
"coding-agent": {
"command": "npx",
"args": ["coding-agent-mcp"]
}
}
}Alternative: Use Bun
{
"mcpServers": {
"coding-agent": {
"command": "bunx",
"args": ["coding-agent-mcp"]
}
}
}Alternative: Use Deno
{
"mcpServers": {
"coding-agent": {
"command": "deno",
"args": ["run", "--allow-env=NO_DEPRECATION,TRACE_DEPRECATION", "--allow-net", "--allow-read", "--allow-write", "npm:coding-agent-mcp"]
}
}
}Install in Windsurf
将此添加到您的Windsurf MCP配置文件中。看 Windsurf MCP文件 了解更多信息。
{
"mcpServers": {
"coding-agent": {
"command": "npx",
"args": ["coding-agent-mcp"]
}
}
}Install in Trae
使用手动添加功能并填写该MCP服务器的JSON配置信息。 有关更多详细信息,请访问 Trae文件.
{
"mcpServers": {
"coding-agent": {
"command": "npx",
"args": ["coding-agent-mcp"]
}
}
}Install in VS Code
将此添加到您的VS Code MCP配置文件中。看 VS代码MCP文档 了解更多信息。
{
"mcp": {
"servers": {
"coding-agent": {
"type": "stdio",
"command": "npx",
"args": ["coding-agent-mcp"]
}
}
}
}Install in Visual Studio 2022
您可以按照以下步骤在Visual Studio 2022中配置编码代理MCP Visual Studio MCP服务器文档.
将此添加到Visual Studio MCP配置文件中(请参阅 Visual Studio文档 详细信息):
{
"mcp": {
"servers": {
"coding-agent": {
"type": "stdio",
"command": "npx",
"args": ["coding-agent-mcp"]
}
}
}
}有关更多信息和故障排除,请参阅 Visual Studio MCP服务器文档.
Install in Zed
将此添加到您的Zed settings.json。参见 Zed上下文服务器文档 了解更多信息。
{
"context_servers": {
"coding-agent": {
"command": {
"path": "npx",
"args": ["coding-agent-mcp"]
},
"settings": {}
}
}
}Install in Gemini CLI
看 Gemini CLI配置 了解详情。
- 打开Gemini CLI设置文件。位置是
~/.gemini/settings.json(其中~是您的主目录)。
- 将以下内容添加到
mcpServers对象在你settings.json文件:
{
"mcpServers": {
"coding-agent": {
"command": "npx",
"args": ["coding-agent-mcp"]
}
}
}如果 mcpServers 对象不存在,请创建它。
Install in Claude Code
运行此命令。看 克劳德代码MCP文档 了解更多信息。
claude mcp add coding-agent -- npx coding-agent-mcpInstall in Claude Desktop
将此添加到您的Claude桌面 claude_desktop_config.json 文件。看 克劳德桌面MCP文档 了解更多信息。
{
"mcpServers": {
"coding-agent": {
"command": "npx",
"args": ["coding-agent-mcp"]
}
}
}Install in Cline
您可以通过以下方式轻松安装Coding Agent Cline MCP服务器市场 按照以下说明:
- 打开 克莱恩.
- 点击汉堡菜单图标(☰)进入 MCP服务器 部分。
- 使用搜索栏 市场 选项卡查找 *编程代理*.
- 点击 安装 按钮。
或者,将此配置添加到您的Cline MCP设置中:
{
"mcpServers": {
"coding-agent": {
"command": "npx",
"args": ["coding-agent-mcp"],
"disabled": false,
"autoApprove": []
}
}
}Install in BoltAI
打开应用程序的“设置”页面,导航到“插件”,然后输入以下JSON:
{
"mcpServers": {
"coding-agent": {
"command": "npx",
"args": ["coding-agent-mcp"]
}
}
}保存后,您可以直接使用这些工具。更多信息请访问 BoltAI的文档网站对于iOS上的BoltAI, 请参阅本指南.
Using Docker
如果你更喜欢在Docker容器中运行MCP服务器:
- 构建Docker镜像:
首先,创建一个 Dockerfile 在项目根目录中(或您喜欢的任何位置):
Click to see Dockerfile content
FROM node:18-alpine
WORKDIR /app
# Install the latest version globally
RUN npm install -g coding-agent-mcp
# Expose default port if needed (optional, depends on MCP client interaction)
# EXPOSE 3000
# Default command to run the server
CMD ["coding-agent-mcp"]然后使用标签(例如。, coding-agent-mcp). 确保Docker桌面(或Docker守护进程)正在运行。 在保存的同一目录中运行以下命令 Dockerfile:
docker build -t coding-agent-mcp .- 配置您的MCP客户端:
更新MCP客户端的配置以使用Docker命令。
_cline_mcp_settings.json示例:_
{
"mcpServers": {
"coding-agent": {
"autoApprove": [],
"disabled": false,
"timeout": 60,
"command": "docker",
"args": ["run", "-i", "--rm", "coding-agent-mcp"],
"transportType": "stdio"
}
}
}_注意:这是一个示例配置。请参阅本自述中前面的MCP客户端的具体示例(如Cursor、VS Code等),以调整结构(例如。, mcpServers 对比 servers).此外,请确保图像名称在 args 匹配期间使用的标签 docker build 命令。_
Install on Windows
Windows上的配置与Linux或macOS略有不同(_Cline 在示例中使用_).同样的原则也适用于其他编辑;请参阅配置 command 和 args.
{
"mcpServers": {
"coding-agent": {
"command": "cmd",
"args": ["/c", "npx", "coding-agent-mcp"],
"disabled": false,
"autoApprove": []
}
}
}Install in Augment Code
要在增强代码中配置编码代理MCP,您可以使用图形界面或手动配置。
A.使用增强代码UI
- 点击汉堡菜单。
- 选择 设置.
- 导航到 工具 部分。
- 点击 +添加MCP 按钮。
- 输入以下命令:
npx coding-agent-mcp- 命名MCP: 编程代理.
- 点击 添加 按钮。
添加MCP服务器后,您可以直接在Augment Code中开始使用Coding Agent的全面编码功能。
______________________________________________________________________
B.手动配置
- 按Cmd/Ctrl Shift P或转到增强面板中的汉堡包菜单
- 选择编辑设置
- 在“高级”下,单击settings.json中的“编辑”
- 将服务器配置添加到
mcpServers数组中augment.advanced对象
"augment.advanced": {
"mcpServers": [
{
"name": "coding-agent",
"command": "npx",
"args": ["coding-agent-mcp"]
}
]
}添加MCP服务器后,重新启动编辑器。如果您收到任何错误,请检查语法以确保不缺少右括号或逗号。
Install in Roo Code
将此添加到Roo Code MCP配置文件中。看 Roo代码MCP文档 了解更多信息。
{
"mcpServers": {
"coding-agent": {
"command": "npx",
"args": ["coding-agent-mcp"]
}
}
}Install in Zencoder
要在Zencoder中配置编码代理MCP,请执行以下步骤:
- 转到Zencoder菜单(…)
- 从下拉菜单中,选择代理工具
- 点击添加自定义MCP
- 从下面添加名称和服务器配置,并确保点击安装按钮
{
"command": "npx",
"args": ["coding-agent-mcp"]
}添加MCP服务器后,您可以轻松地继续使用它。
Install in Amazon Q Developer CLI
将此添加到您的Amazon Q Developer CLI配置文件中。看 Amazon Q Developer CLI文档 了解更多详情。
{
"mcpServers": {
"coding-agent": {
"command": "npx",
"args": ["coding-agent-mcp"]
}
}
}Install in Qodo Gen
看 Qodo Gen文档 了解更多详情。
- 在VSCode或IntelliJ中打开Qodo Gen聊天面板。
- 单击“连接更多工具”。
- 单击+添加新MCP。
- 添加以下配置:
{
"mcpServers": {
"coding-agent": {
"command": "npx",
"args": ["coding-agent-mcp"]
}
}
}Install in JetBrains AI Assistant
看 JetBrains AI助手文档 了解更多详情。
- 在JetBrains IDE中
Settings→Tools→AI Assistant→Model Context Protocol (MCP) - 点击
+ Add. - 点击
Command在对话框的左上角,从列表中选择As JSON选项 - 添加此配置并单击
OK
{
"mcpServers": {
"coding-agent": {
"command": "npx",
"args": ["coding-agent-mcp"]
}
}
}- 点击
Apply以保存更改。 - 同样的方式,可以为JetBrains Junie添加编码代理
Settings→Tools→Junie→MCP Settings
Install in Warp
看 Warp模型上下文协议文档 了解详情。
- 导航
Settings>AI>Manage MCP servers. - 通过单击添加新的MCP服务器
+ Add按钮。 - 粘贴下面给出的配置:
{
"coding-agent": {
"command": "npx",
"args": ["coding-agent-mcp"],
"env": {},
"working_directory": null,
"start_on_launch": true
}
}- 点击
Save以应用更改。
Install in Opencode
将其添加到您的Opencode配置文件中。看 开放代码MCP文档 文档以获取更多信息。
{
"mcp": {
"coding-agent": {
"type": "local",
"command": ["npx", "coding-agent-mcp"],
"enabled": true
}
}
}Install in Copilot Coding Agent
将编码代理与复制品编码代理结合使用
将以下配置添加到 mcp 复制品编码代理配置文件存储库的部分->设置->复制品->编码代理->MCP配置:
{
"mcpServers": {
"coding-agent": {
"type": "stdio",
"command": "npx",
"args": ["coding-agent-mcp"]
}
}
}有关更多信息,请参阅 .
Install in Kiro
看 Kiro模型上下文协议文档 了解详情。
- 导航
Kiro>MCP Servers - 通过单击添加新的MCP服务器
+ Add按钮。 - 粘贴下面给出的配置:
{
"mcpServers": {
"coding-agent": {
"command": "npx",
"args": ["coding-agent-mcp"],
"env": {},
"disabled": false,
"autoApprove": [
"read_file",
"list_directory",
"get_working_directory",
"get_environment",
"search_text",
"search_files",
"get_system_info"
]
}
}
}- 点击
Save以应用更改。
Install in OpenAI Codex
看 OpenAI 代码专家 了解更多信息。
将以下配置添加到OpenAI Codex MCP服务器设置中:
[mcp_servers.coding-agent]
args = ["coding-agent-mcp"]
command = "npx"Install from Source
对于开发或自定义构建:
git clone https://github.com/sukarth/coding-agent-mcp.git
cd coding-agent-mcp
npm install
npm run build
npm start或者配置您的MCP客户端以使用本地版本:
{
"mcpServers": {
"coding-agent": {
"command": "node",
"args": ["/path/to/coding-agent-mcp/dist/index.js"],
"disabled": false
}
}
}可用工具
总计:4个类别的27个工具
文件操作(10个工具)
read_file-使用编码支持读取文件内容write_file-将内容写入文件(覆盖现有内容)create_file-创建包含可选内容的新文件并覆盖保护edit_file-使用4种方法编辑文件(替换、行号、字符匹配、差异)delete_file-安全删除文件copy_file-使用覆盖控制将文件复制到新位置move_file-使用覆盖控件移动/重命名文件list_directory-列出目录内容(递归/非递归)create_directory-使用递归选项创建目录delete_directory-使用递归选项删除目录
终端操作(5个工具)
run_command-使用工作目录和超时控制执行终端命令run_command_stream-执行命令,实时流式输出get_environment-获取并过滤环境变量get_working_directory-获取当前工作目录which_command-查找命令路径(跨平台which/where)
搜索操作(4个工具)
search_text-使用正则表达式、区分大小写、上下文在文件中搜索文本模式search_files-使用glob支持按名称模式搜索文件find_and_replace-使用干运行模式跨文件批量查找和替换search_duplicates-按内容、名称或大小查找重复文件
公用设施操作(8个工具)
delay-等待指定时间(毫秒或秒)get_system_info-获取系统信息(基本或详细)generate_uuid-生成UUID(v1和v4,单个或多个)encode_decode-编码/解码文本(Base64、URL、HTML)hash_text-生成文本哈希值(MD5、SHA1、SHA256、SHA512)format_json-使用键排序格式化和验证JSONvalidate_regex-验证和测试正则表达式calculate_file_stats-计算综合文件统计
文件编辑方法
这 edit_file 该工具支持多种编辑方法:
1.字符串替换
{
"method": "replace",
"target": "old text",
"replacement": "new text"
}2.行号
{
"method": "line-numbers",
"startLine": 5,
"endLine": 7,
"replacement": "new content"
}3.字符匹配
{
"method": "character-match",
"startChar": 100,
"endChar": 150,
"replacement": "new content"
}4.基于差异
{
"method": "diff",
"diffContent": "unified diff content",
"diffFormat": "unified"
}性能和限制
- 文件大小:高效处理高达10MB的文件
- 命令超时:默认30秒(可配置)
- 搜索结果:默认情况下限制为100场比赛
- 并发操作:针对单线程使用进行了优化
- 内存使用:典型值约50MB,峰值约100MB
发展
设置
git clone https://github.com/sukarth/coding-agent-mcp.git
cd coding-agent-mcp
npm install构建
npm run build测试
npm test
npm run test:watch # Watch mode发展模式
npm run dev📚 开发使用示例
安装后,MCP服务器提供4类27个工具。以下是一些如何在代码中使用这些工具的实际示例。
注: 以下示例显示了MCP客户端如何使用callTool功能。这些代码示例旨在在MCP客户端环境(如Cursor、Kiro、Claude Desktop等)中使用,该环境提供callToolAPIMCP客户端自动处理与服务器的所有通信。除非您正确设置了MCP客户端SDK和服务器,否则这些示例在常规Node.js脚本中不起作用。
🗂️ 文件操作示例
读取和写入文件
// Read a configuration file
await callTool('read_file', {
path: 'package.json',
encoding: 'utf8'
});
// Create a new file with content
await callTool('create_file', {
path: 'src/config.ts',
content: 'export const API_URL = "https://api.example.com";',
overwrite: false
});
// Write data to a file (overwrites existing)
await callTool('write_file', {
path: 'output/results.json',
content: JSON.stringify({ status: 'success', data: [] }, null, 2)
});高级文件编辑
// Replace all occurrences of a string
await callTool('edit_file', {
path: 'src/constants.ts',
method: 'replace',
target: 'localhost:3000',
replacement: 'production.example.com'
});
// Edit specific lines
await callTool('edit_file', {
path: 'README.md',
method: 'line-numbers',
startLine: 15,
endLine: 17,
replacement: '## Updated Section\n\nThis content has been updated.'
});
// Precise character-based editing
await callTool('edit_file', {
path: 'src/app.js',
method: 'character-match',
startChar: 245,
endChar: 267,
replacement: 'newFunctionName'
});目录操作
// List directory contents recursively
await callTool('list_directory', {
path: './src',
recursive: true,
includeHidden: false
});
// Create nested directories
await callTool('create_directory', {
path: 'src/components/ui/buttons',
recursive: true
});
// Copy files with overwrite protection
await callTool('copy_file', {
source: 'template.config.js',
destination: 'project.config.js',
overwrite: false
});💻 终端操作示例
命令执行
// Run tests in a specific directory
await callTool('run_command', {
command: 'npm test',
workingDirectory: './my-project',
timeout: 60000
});
// Install dependencies with environment variables
await callTool('run_command', {
command: 'npm install',
workingDirectory: './frontend',
env: { NODE_ENV: 'development' }
});
// Stream long-running command output
await callTool('run_command_stream', {
command: 'npm run build:watch',
workingDirectory: './app',
timeout: 300000
});环境和系统信息
// Get Node.js related environment variables
await callTool('get_environment', {
filter: 'NODE'
});
// Find where a command is located
await callTool('which_command', {
command: 'git'
});
// Get current working directory
await callTool('get_working_directory', {});🔍 搜索操作示例
文本搜索
// Find TODO comments in source code
await callTool('search_text', {
pattern: 'TODO|FIXME|HACK',
directory: './src',
recursive: true,
caseSensitive: false,
contextLines: 2
});
// Search for function definitions
await callTool('search_text', {
pattern: 'function\\s+\\w+\\(',
directory: './lib',
filePattern: '*.js',
wholeWord: false,
maxResults: 50
});文件搜索
// Find all TypeScript files
await callTool('search_files', {
pattern: '*.ts',
directory: './src',
recursive: true,
type: 'file'
});
// Find configuration files
await callTool('search_files', {
pattern: '*config*',
directory: '.',
includeHidden: true,
maxResults: 20
});查找和替换
// Update import statements (dry run first)
await callTool('find_and_replace', {
findPattern: 'import.*from [\'"]lodash[\'"]',
replaceWith: 'import * as _ from "lodash"',
directory: './src',
filePattern: '*.ts',
dryRun: true
});
// Replace API endpoints across the project
await callTool('find_and_replace', {
findPattern: 'https://old-api.example.com',
replaceWith: 'https://new-api.example.com',
directory: './src',
recursive: true,
dryRun: false
});重复检测
// Find duplicate files by content
await callTool('search_duplicates', {
directory: './assets',
method: 'content',
recursive: true,
minSize: 1024
});
// Find files with duplicate names
await callTool('search_duplicates', {
directory: './src',
method: 'name',
filePattern: '*.js'
});🛠️ 公用设施操作示例
时间和延误
// Add a delay between operations
await callTool('delay', {
seconds: 2
});
// Precise millisecond delay
await callTool('delay', {
milliseconds: 1500
});系统信息
// Get basic system info
await callTool('get_system_info', {
detailed: false
});
// Get detailed system information
await callTool('get_system_info', {
detailed: true
});文本处理
// Generate UUIDs for database records
await callTool('generate_uuid', {
version: 4,
count: 5
});
// Encode sensitive data
await callTool('encode_decode', {
text: 'sensitive-api-key',
method: 'base64-encode'
});
// Generate file checksums
await callTool('hash_text', {
text: 'file content here',
algorithm: 'sha256',
encoding: 'hex'
});JSON和正则表达式
// Format and validate JSON
await callTool('format_json', {
json: '{"name":"test","values":[1,2,3]}',
indent: 2,
sortKeys: true
});
// Test regex patterns
await callTool('validate_regex', {
pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$',
testString: 'user@example.com',
flags: 'i'
});$',$',$',$',$',$',$',$',$',$',$',$',$',$',$',$',$',$',$',$',$',$',$',$',$',$',$',
testString: 'user@example.com',
flags: 'i'
});文件统计
// Analyze project file statistics
await callTool('calculate_file_stats', {
directory: './src',
recursive: true,
filePattern: '*'
});🔄 工作流示例
项目设置自动化
// 1. Create project structure
await callTool('create_directory', { path: 'my-app/src/components', recursive: true });
await callTool('create_directory', { path: 'my-app/tests', recursive: true });
// 2. Copy template files
await callTool('copy_file', {
source: 'templates/package.json',
destination: 'my-app/package.json'
});
// 3. Install dependencies
await callTool('run_command', {
command: 'npm install',
workingDirectory: './my-app'
});
// 4. Run initial build
await callTool('run_command', {
command: 'npm run build',
workingDirectory: './my-app'
});代码重构
// 1. Find all files using old API
const searchResult = await callTool('search_text', {
pattern: 'oldApiFunction',
directory: './src',
recursive: true
});
// 2. Replace with new API (dry run first)
await callTool('find_and_replace', {
findPattern: 'oldApiFunction\\(',
replaceWith: 'newApiFunction(',
directory: './src',
dryRun: true
});
// 3. Apply changes
await callTool('find_and_replace', {
findPattern: 'oldApiFunction\\(',
replaceWith: 'newApiFunction(',
directory: './src',
dryRun: false
});
// 4. Run tests to verify
await callTool('run_command', {
command: 'npm test',
workingDirectory: '.'
});贡献
- 分叉存储库
- 创建要素分支
- 进行更改
- 添加新功能的测试
- 确保所有测试通过
- 提交拉取请求
许可证
MIT许可证-请参阅 许可证 文件以获取详细信息。
更新日志
看 更改日志.md 查看详细的版本历史。
v1.0.1-最新版本
- 微小的内部改进和维护更新
- 更新的文档和使用示例
______________________________________________________________________
由...制作❤️ 通过 苏卡思·阿查里亚
