磷酸mcp服务器
磷酸的官方MCP服务器
此存储库实现了 模型上下文协议(MCP) 服务器 磷化物,实现对物理机器人的自然语言交互和控制。它公开了执行动作(例如拾取对象)和从相机流式传输图像的工具。
使用 主控程序 为克劳德量身定制。
https://github.com/user-attachments/assets/2d91f716-c581-4c36-94ab-cc5a94001468
特性
- 摄像头流:检索当前网络摄像头帧
- 回放工具:从数据集中触发机器人动作(例如捡起香蕉)
- 磷化物包装:管理本地API流程和通信
入门指南
1.安装并运行phosphobot
运行以下命令安装phosphobot:
#macOS
curl -fsSL https://raw.githubusercontent.com/phospho-app/phosphobot/main/install.sh | bash
#Linux
curl -fsSL https://raw.githubusercontent.com/phospho-app/phosphobot/main/install.sh | sudo bash
#Windows
powershell -ExecutionPolicy ByPass -Command "irm https://raw.githubusercontent.com/phospho-app/phosphobot/main/install.ps1 | iex"运行phosphobot服务器:
phosphobot run2.在Claude Desktop中安装MCP服务器
确保 克劳德桌面 已安装。
使用以下方式安装phospho-mcp服务器 紫外线:
curl -LsSf https://astral.sh/uv/install.sh | sh # Install uv on MacOs or Linux
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" # On Windows
# Clone repo
git clone https://github.com/phospho-app/phospho-mcp-server.git
# Install the server
cd phospho-mcp-server/phospho-mcp-server
uv run mcp install server.py这将:
- 以以下名称启动MCP服务器
phospho - 注册所有工具
现在,打开克劳德桌面。您应该看到工具中列出的磷酸化MCP服务器。
运作原理
服务器与本地实例进行通信 磷化物 通过其REST API(默认 http://localhost:80).
/frames→ 图像馈送/recording/play→ 从数据集中触发回放
所有通话均通过 tools/phosphobot.py。如果您在其他端口上运行phosphobot,则需要修改基本URL。
______________________________________________________________________
开发和测试
要使用MCP检查器测试服务器,请运行:
uv run mcp dev server.py克劳德的相机
问:
“我桌子上有什么?”
克劳德将致电:
{
"tool": "get_camera_frame"
}克劳德的重播
问:
“把香蕉捡起来”
克劳德将致电:
{
"tool": "pickup_object",
"args": { "name": "banana" }
}______________________________________________________________________
工具
pickup_object
启动重播剧集以模拟对象操作。
@mcp.tool()
def pickup_object(name: Literal["banana", "black circle", "green cross"]) -> str- 根据对象名称启动预先录制的剧集。
get_camera_frame
从phosphobot的相机中捕获JPEG图像。
@mcp.tool()
def get_camera_frame() -> Image- 使用本地phosphobot API(
/frames) - 返回base64编码的JPEG图像
______________________________________________________________________
建筑
phospho-mcp-server/
│
├── server.py # MCP server (FastMCP) with tools
├── tools/
│ ├── phosphobot.py # Wrapper for phosphobot process and API
│ └── replay_api.py # Tool to launch a replay
├── pyproject.toml # Project configuration
└── README.md # This file这 PhosphoClient 类用于管理 phosphobot 处理生命周期,并向其本地API发送GET/POST请求。
______________________________________________________________________
