
Research
/Security News
Mini Shai-Hulud Campaign Hits Red Hat Cloud Services npm Packages
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.
agent-file-control-mcp-server
Advanced tools
MCP server for complete file control with base64 encoding to bypass JSON parsing issues
English | 中文
完整的文件控制 MCP 服务器,基于 Node.js/TypeScript 实现。支持两种内容编码方式,灵活处理各种文件操作场景。
npm install -g agent-file-control-mcp-server
# 或使用 npx 无需安装
npx -y agent-file-control-mcp-server
所有写入类工具支持两种编码方式:
| 编码模式 | 说明 | 适用场景 |
|---|---|---|
text(默认) | 直接字符串,JSON-RPC 自动处理转义 | 大多数文本文件、简单内容 |
base64 | Base64 编码,绕过所有特殊字符问题 | 包含大量引号/转义的代码、二进制文件 |
推荐:日常使用 text 模式(默认),遇到复杂内容时切换 base64。
编辑 ~/.config/opencode/opencode.json,在 mcp 字段中添加:
{
"mcp": {
"agent-file-control": {
"type": "local",
"command": ["npx", "-y", "agent-file-control-mcp-server"],
"enabled": true
}
}
}
编辑 ~/.claude.json,添加 mcpServers 字段:
{
"mcpServers": {
"agent-file-control": {
"type": "stdio",
"command": "npx",
"args": ["-y", "agent-file-control-mcp-server"],
"env": {}
}
}
}
或使用命令行:
claude mcp add agent-file-control -- npx -y agent-file-control-mcp-server
| 工具 | 参数 | 说明 |
|---|---|---|
afc_write_file | path, content, content_encoding, file_encoding, executable, create_dirs | 写入文件,支持双编码 |
afc_append_file | path, content, content_encoding, create_if_missing | 追加内容,支持双编码 |
| 工具 | 参数 | 说明 |
|---|---|---|
afc_search_replace | path, old_text, old_encoding, new_text, new_encoding, count | 搜索替换,支持双编码 |
afc_patch_lines | path, start_line, end_line, new_content, content_encoding | 行范围替换,支持双编码 |
| 工具 | 参数 | 说明 |
|---|---|---|
afc_read_file | path, as_b64, encoding, start_line, end_line | 读取文件,可返回 base64 |
| 工具 | 参数 | 说明 |
|---|---|---|
afc_file_info | path | 获取文件/目录元信息 |
afc_list_dir | path, recursive, max_depth, show_hidden, pattern | 列出目录内容 |
afc_copy | src, dst, overwrite | 复制文件或目录 |
afc_move | src, dst, overwrite | 移动/重命名 |
afc_delete | path, recursive | 删除文件或目录 |
afc_mkdir | path | 创建目录 |
| 工具 | 参数 | 说明 |
|---|---|---|
afc_encode_string | text | 字符串转 base64(Agent遇到复杂内容时可调用) |
afc_decode_b64 | b64, encoding | base64 转字符串 |
// 写入简单文本
{
"path": "/home/user/test.txt",
"content": "Hello World",
"content_encoding": "text"
}
当内容包含大量引号、转义符时:
// 写入复杂代码
{
"path": "/home/user/code.js",
"content": "Y29uc3QgeCA9ICJoZWxsbztcblxuY29uc29sZS5sb2coeCk7",// base64 编码
"content_encoding": "base64"
}
Agent 可调用 afc_encode_string 生成 base64:
{
"text": "const x = \"hello\";\nconsole.log(x);"
}
// 返回: Y29uc3QgeCA9ICJoZWxsbztcblxuY29uc29sZS5sb2coeCk7
| 层面 | 说明 |
|---|---|
| JSON-RPC传输 | 自动处理转义,大多数场景无需担心 |
| Agent 内部生成 | LLM生成复杂代码时可能混乱,base64 模式作为备选 |
建议:
text 模式(默认)base64 模式afc_encode_string# Claude Code
claude mcp list
claude mcp get agent-file-control
claude mcp remove agent-file-control -s user
# 在 Claude Code 中检查状态
/mcp
MIT © LeenixP
FAQs
MCP server for complete file control with base64 encoding to bypass JSON parsing issues
We found that agent-file-control-mcp-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.

Research
/Security News
The North Korean malware loader hides in a Packagist-listed package and its GitHub branch to fetch and execute remote code in a likely Contagious Interview-style lure.

Security News
The Rust project is moving toward formal rules on LLM use in contributions after months of internal debate over maintainer burden, code quality, and contributor experience.