大脑执行服务器
一种基于队列的执行服务器,用于监视和处理Brain MCP命令队列中的作业。
特性
- 监视器
/Users/bard/mcp/memory_files/command_queue/pending对于工作 - 执行shell命令和Python脚本
- 支持JSON和文本文件作业格式
- 将已完成的作业移动到
completed/或failed/目录 - 5分钟安全超时
- 将所有操作记录到
daemon.log
作业格式
JSON格式
{
"command": "which",
"args": ["node"],
"description": "Check if node is in PATH"
}或者:
{
"task_id": "unique_id",
"command": "python3 /path/to/script.py",
"purpose": "Description of the job",
"result_file": "optional_output.txt"
}文本格式
包含shell命令的纯文本文件(.txt或.sh):
cd /path/to/dir && python script.py安装与使用
- 启动服务器:
cd /Users/bard/Code/mcp-execution-server
python3 server.py- 监视队列:
python3 /Users/bard/mcp/memory_files/command_queue/queue_viewer.py- 将作业添加到队列:
# JSON job
echo '{"command": "echo", "args": ["Hello from queue!"]}' > /Users/bard/mcp/memory_files/command_queue/pending/test_job.json
# Text job
echo 'ls -la /Users/bard/Code' > /Users/bard/mcp/memory_files/command_queue/pending/list_code.txt使用LaunchControl在后台运行
创建启动代理以自动运行服务器:
Label
com.brain.execution-server
ProgramArguments
/usr/bin/python3
/Users/bard/Code/mcp-execution-server/server.py
WorkingDirectory
/Users/bard/Code/mcp-execution-server
RunAtLoad
KeepAlive
StandardOutPath
/Users/bard/mcp/memory_files/command_queue/server.log
StandardErrorPath
/Users/bard/mcp/memory_files/command_queue/server.error.log
队列目录
- 待定:
/Users/bard/mcp/memory_files/command_queue/pending/-等待处理的作业 - 完成:
/Users/bard/mcp/memory_files/command_queue/completed/-已成功执行作业 - 失败:
/Users/bard/mcp/memory_files/command_queue/failed/-失败或超时的作业 - 日志:
/Users/bard/mcp/memory_files/command_queue/daemon.log-服务器活动日志
安全说明
此服务器执行队列中的任意代码。确保对队列目录具有适当的权限。
