trayfeel
TrayFeel
面向 AI 智能体的即插即用 CD/DVD 托盘情感执行器。
TrayFeel 将 Linux 光驱转变为物理肢体语言通道:open、close、pulse、wiggle,以及一系列命名情感——以 Python 库、CLI、MCP 服务器和可选 HTTP 守护进程的形式提供。
Linux 优先。MIT 许可。纯 Python ioctl 路径(无需 eject 二进制文件)。
要求
Python 3.10+
Linux 系统,配备支持
OPEN_TRAY/CLOSE_TRAY的/dev/sr*光驱用户属于
cdrom组(Ubuntu/Debian 上通常如此)
sudo usermod -aG cdrom "$USER"
# log out and back in, then:
groups # should list cdrom安装
pip install trayfeel
# or from a checkout:
pip install -e ".[dev]"可选环境变量(参见 .env.example):
变量 | 用途 |
| 强制指定设备路径(默认:第一个 |
| HTTP 守护进程的 Bearer 令牌 |
| 可选的 |
| 守护进程绑定地址(默认 |
快速入门
trayfeel list-drives
trayfeel doctor
trayfeel status
trayfeel pulse
trayfeel emote laugh
trayfeel emote nod_yes --dry-run
trayfeel catalogPython:
from trayfeel import Tray
with Tray() as tray:
print(tray.status())
tray.run("pulse")
tray.emote("wave")安全
TrayFeel 默认拒绝鲁莽动作:
每台设备的独占 flock 锁(
~/.cache/trayfeel/…)速率限制(默认每分钟 30 次动作)
动作之间的最小间隔(默认 200 毫秒)
光盘保护——当光盘存在时,拒绝猛击模式(
pulse、wiggle、nod等),除非force=True多次开合循环后的冷却时间
当你有意接受风险时,可使用 --force / force=True 覆盖。
情感
trayfeel/emotions/catalog.yaml 中的命名编排:
laugh, giggle, gasp, surprise, shrug, think, ponder, nod_yes, shake_no, applause, sulk, pout, excited, bored, angry, curious, wave, heartbeat, sigh, celebrate, confused, acknowledge, reject, greet, farewell, error, success, idle_breath
trayfeel emote celebrate
trayfeel emote think --dry-run原语
open, close, toggle, lock, unlock, status, pulse, wiggle, hold_open, nod, double_tap, spin_up, spin_down, sleep, wait
MCP 服务器
trayfeel mcp
# or: python -m trayfeel mcp工具:tray_status、tray_list_drives、tray_primitive、tray_emote、tray_catalog、tray_doctor。
Claude Desktop
添加到 claude_desktop_config.json:
{
"mcpServers": {
"trayfeel": {
"command": "trayfeel",
"args": ["mcp"]
}
}
}Cursor
添加一个指向相同命令(trayfeel mcp 或 python -m trayfeel mcp)的 MCP 服务器条目。确保环境具有 cdrom 组权限。
用于 OpenAI / Claude 函数调用的工具模式位于 examples/openai_tools.json 和 examples/claude_tools.json。智能体技能说明:examples/agent_skill.md。
HTTP 守护进程
适用于无法附加 stdio MCP 的局域网智能体:
export TRAYFEEL_TOKEN="$(openssl rand -hex 16)"
trayfeel daemon --host 0.0.0.0 --port 8765方法 | 路径 | 请求体 |
GET |
| — |
GET |
| — |
GET |
| — |
POST |
|
|
POST |
|
|
当配置了令牌时,发送 Authorization: Bearer $TRAYFEEL_TOKEN。
视觉(可选)
如果设置了 TRAYFEEL_CAMERA=/dev/video0 且安装了 ffmpeg,trayfeel vision 将通过 V4L2 捕获一帧,并返回尽力而为的亮度/边缘启发式结果。缺少摄像头或 ffmpeg 时返回 ok: false 并附带原因——它绝不会导致进程崩溃。
库结构
trayfeel/
core.py # Tray, Emoter
primitives.py # motion primitives
safety.py # flock, rate limits, disc guards
hardware/linux.py
emotions/ # catalog.yaml + engine
mcp_server.py
daemon.py
cli.py许可证
MIT——版权所有(c)2026 TrayFeel 贡献者
This server cannot be deployed
Maintenance
Related MCP Connectors
Shared control plane for AI coding agents — tasks, memory, decisions, file locks. 12 tools.
Remote Linux boxes for coding agents: Docker, a browser, screenshots, logs, human takeover.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Machine-readable utilities and datasets for AI agents.