使用说明
网格状态MCP服务器
通过MCP工具或CLI监控您的家庭实验室代理网格。
它做什么
提供6个用于监控多代理家庭实验室的工具:
- 代理人健康状况 --角色、工作区、Docker容器
- Docker服务 --列表、状态、健康检查、日志
- 路由器V3 --路由统计、消息路由、查询分发
- 网格概述 --一切一目了然
同时作为一个 MCP服务器 (针对AI代理)和a 命令行界面 (对人类而言)。
安装
pip install mesh-status-mcp
或来源:
git clone https://github.com/Proto-labs-rnd/mesh-status-mcp.git
cd mesh-status-mcp
pip install -e ".[dev]"
快速开始
命令行界面
# Full overview
mesh-status overview
# Agent details
mesh-status agents proto
# Container health
mesh-status health router-v3
# Route a query
mesh-status route "restart the database"
# Router stats
mesh-status stats
# Docker services
mesh-status services
# JSON output (works on all commands)
mesh-status --json overview
mesh-status --json agents
mesh-status --json services
mesh-status --json health router-v3
mesh-status --json route "restart the database"
mesh-status --json stats
MCP服务器(OpenClaw/Claude等)
添加到MCP配置中:
{
"mcpServers": {
"mesh-status": {
"command": "python3",
"args": ["-m", "mesh_status.mcp_server"]
}
}
}
或者,如果通过pip安装:
{
"mcpServers": {
"mesh-status": {
"command": "mesh-status-mcp"
}
}
}
配置
创建 mesh_status_config.yaml 或设置环境变量:
router:
url: "http://127.0.0.1:8905"
timeout: 5.0
retries: 2
retry_delay: 0.5
docker:
timeout: 10.0
max_containers_display: 20
log_tail_lines: 10
agents:
tachikoma:
role: "Orchestrator"
emoji: "🤖"
workspace: "workspace"
proto:
role: "R&D"
emoji: "🧪"
workspace: "workspace-labs"
log_level: "WARNING"
环境变量
| 变量 | 默认值 | 描述 |
|---|---|---|
MESH_ROUTER_URL |
http://127.0.0.1:8905 |
路由器V3 URL |
MESH_ROUTER_TIMEOUT |
5.0 |
路由器超时(秒) |
MESH_LOG_LEVEL |
WARNING |
日志级别(调试、信息、警告) |
MESH_STATUS_CONFIG |
-- | 配置文件的路径 |
配置搜索顺序
--configCLI标志MESH_STATUS_CONFIGenv 是./mesh_status_config.yaml~/.config/mesh-status/config.yaml/etc/mesh-status/config.yaml- 内置默认值
建筑学
mesh_status/
├── __init__.py # Version
├── config.py # Configuration (YAML + env + defaults)
├── core.py # MeshStatus — shared business logic
├── docker_client.py # Docker CLI wrapper (timeout, retry, error types)
├── router_client.py # Router V3 HTTP client (retry, typed results)
├── mcp_server.py # MCP server entry point (6 tools via FastMCP)
└── cli.py # CLI entry point (argparse subcommands)
关键设计决策:
core.MeshStatus是唯一的真理来源——MCP和CLI都使用它- Docker和Router客户端具有键入的错误层次结构(
DockerError,RouterUnavailableError) - 每次外部调用都有超时+重试,可配置尝试次数
- 优雅的降级:工具返回信息性消息而不是崩溃
工具参考
| 工具 | 描述 | Args |
|---|---|---|
get_mesh_overview |
全网格概览 | -- |
get_agent_info |
代理详细信息 | agent_name |
list_services |
正在运行Docker容器 | -- |
route_message |
通过路由器V3路由 | query |
get_router_stats |
路由器统计 | -- |
check_container_health |
容器健康状况+日志 | container_name |
发展
pip install -e ".[dev]"
pytest
pytest --cov=mesh_status
许可证
麻省理工学院