mcp-remote-agent
Enables AI agents to remotely read/write files and execute commands on Linux servers via MCP protocol.
README
mcp-remote-agent
MCP Server for AI Agent Remote Development
Enable AI Agents to operate remote Linux servers through MCP protocol, seamlessly connecting local development environments with remote servers.
One-line Summary
Enable AI Agents (like WorkBuddy, Claude Desktop, Cursor) to directly read/write remote Linux server files and execute commands via MCP, seamlessly connecting local development with remote servers.
Analogy: VS Code Remote SSH is for humans; mcp-remote-agent is for AI.
Core Features
| Feature | Description |
|---|---|
| Remote File R/W | remote_read / remote_write / remote_stat |
| Remote Search | remote_glob search files by glob pattern |
| Command Execution | remote_bash for simple commands, remote_script for multi-line scripts |
| Batch Operations | remote_batch up to 20 operations per request |
| Async Execution | remote_exec_async + remote_task for long-running tasks |
| Config Hot Reload | remote_config modify remote config without restart |
| Dynamic Connections | Switch between multiple servers without restarting MCP |
| Health Check | Automatic remote service status detection |
| Encoding Handling | Auto base64 encode special chars, clean CRLF/BOM |
Quick Start
1. Clone the repository
git clone https://github.com/knownothing20/mcp-remote-agent.git
cd mcp-remote-agent
2. Install dependencies
npm install
3. Configure
cp mcp-remote-agent.example.json local/mcp-remote-agent.json
# Edit local/mcp-remote-agent.json, fill in all variables
Key variables:
| Variable | Description |
|---|---|
skillDir |
Absolute path to the skill installation directory |
mcpConfigPath |
Path to the target AI tool's MCP config file |
remoteUrl |
Remote daemon address |
authToken |
Client authentication token |
4. Sync configuration
node sync.cjs
5. Deploy remote daemon
# Create daemon directory on remote server
ssh USER@SERVER "mkdir -p /path/to/daemon"
# Upload server files to remote server
scp server/server.js server/mcp-remote-agent-manager.sh server/package.json USER@SERVER:/path/to/daemon/
# Upload generated .env config (created by sync.cjs in step 4)
scp local/server/.env USER@SERVER:/path/to/daemon/
# SSH to remote server
ssh USER@SERVER
cd /path/to/daemon
npm install
nohup bash mcp-remote-agent-manager.sh >> boot.log 2>&1 &
6. Restart AI tool
After configuration takes effect, restart your AI tool to activate MCP registration.
Supported AI Tools
| AI Tool | MCP Config Path (Windows) | MCP Config Path (macOS/Linux) |
|---|---|---|
| WorkBuddy | C:\Users\<user>\.workbuddy\mcp.json |
~/.workbuddy/mcp.json |
| Claude Desktop | C:\Users\<user>\AppData\Roaming\Claude\claude_desktop_config.json |
~/.config/Claude/claude_desktop_config.json |
| Cursor | <project>\.cursor\mcp.json |
<project>/.cursor/mcp.json |
| Windsurf | C:\Users\<user>\.codeium\windsurf\mcp_config.json |
~/.codeium/windsurf/mcp_config.json |
Tool List
| Tool | Function |
|---|---|
remote_health |
Check remote service reachability |
remote_read |
Read remote file (ETag cache) |
remote_write |
Write remote file (auto clean CRLF/BOM) |
remote_stat |
Get file metadata |
remote_glob |
Search by glob pattern |
remote_bash |
Execute remote command |
remote_script |
Execute multi-line script |
remote_batch |
Batch operations |
remote_exec_async |
Async execution |
remote_task |
Query async task |
remote_config |
Config hot reload |
remote_status |
Connection diagnostics |
For detailed usage, see SKILL.md
Directory Structure
mcp-remote-agent/
├── SKILL.md # Complete documentation
├── README.md # This file (English)
├── README_CN.md # Chinese documentation
├── index.js # MCP server main program
├── package.json # Client dependencies
├── mcp-remote-agent.example.json # Config template
├── sync.cjs # Variable sync script
├── test.cjs # Test script
├── .gitignore # Git ignore config
├── LICENSE # MIT License
├── CHANGELOG.md # Version changelog
├── local/ # Local config directory
│ ├── README.md # Configuration guide
│ ├── mcp-remote-agent.json # Main config (copy from example)
│ ├── connections.json.example # Multi-server config example
│ └── server/
│ └── .env # Server config (auto-generated)
└── server/
├── server.js # Daemon process
├── mcp-remote-agent-manager.sh # Process guardian script
├── setup-autostart.sh # Autostart config script
├── dashboard.html # Web Dashboard UI
├── .env.example # Server config template
└── package.json # Server dependencies
Configuration Files
| File | Location | Description |
|---|---|---|
mcp-remote-agent.json |
local/ |
Main configuration (copy from mcp-remote-agent.example.json) |
connections.json |
local/ |
Multi-server connections (optional, see connections.json.example) |
.env |
server/ |
Server configuration (auto-generated by sync.cjs) |
See local/README.md for detailed configuration guide.
Dashboard
mcp-remote-agent provides a Web Dashboard for monitoring and management:
Enable Dashboard
Set in local/mcp-remote-agent.json:
{
"variables": {
"serverEnableDashboard": "true"
}
}
Access Dashboard
After starting the service, visit:
http://your-server:3183/http://your-server:3183/dashboard
Dashboard Features
| Feature | Description |
|---|---|
| Service Status | View Node.js, dependencies, port, disk status |
| Audit Statistics | View request stats, success rate, by type/client analysis |
| Error Logs | View recent error logs |
| Config Management | View and modify server config (requires Admin Token) |
Autostart Configuration
Method 1: Using setup-autostart.sh (Recommended)
# SSH to remote server
ssh USER@SERVER
cd /path/to/daemon
# Install autostart
bash setup-autostart.sh install
# Check status
bash setup-autostart.sh status
# Uninstall autostart
bash setup-autostart.sh uninstall
Method 2: Manual crontab configuration
# Edit crontab
crontab -e
# Add the following line
@reboot /path/to/daemon/mcp-remote-agent-manager.sh # mcp-remote-agent autostart
Method 3: Using systemd (Optional)
Create /etc/systemd/system/mcp-remote-agent.service:
[Unit]
Description=mcp-remote-agent daemon
After=network.target
[Service]
Type=simple
User=your-user
WorkingDirectory=/path/to/daemon
ExecStart=/bin/bash /path/to/daemon/mcp-remote-agent-manager.sh
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Then enable:
sudo systemctl enable mcp-remote-agent
sudo systemctl start mcp-remote-agent
Security Features
- Workspace Isolation: File operations restricted within
WORKSPACE_ROOT - Token Authentication: Client token + admin token
- Path Restrictions: Prevent unauthorized access
- Script Interpreter Whitelist: Only allow safe interpreters
- Command Execution Limits: Configurable
ALLOW_BASH_EXECandALLOWED_COMMANDS
Version History
See CHANGELOG.md
License
MIT License - See LICENSE
Contributing
Issues and Pull Requests are welcome!
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。