Homelab MCP Server
Manage Docker infrastructure across multiple homelab hosts including Unraid, Proxmox, and bare metal servers. Enables container lifecycle management, log retrieval, resource monitoring, and Docker operations across your entire homelab from a single interface.
README
homelab-mcp-server
MCP (Model Context Protocol) server for managing Docker infrastructure across multiple homelab hosts. Designed for use with Claude Code and other MCP-compatible clients.
Features
- Multi-host support: Manage containers across Unraid, Proxmox, bare metal servers, and more
- Auto-detect local Docker: Automatically adds local Docker socket if available
- Container lifecycle: Start, stop, restart, pause/unpause containers
- Log retrieval: Fetch logs with time filters, grep, and stream selection
- Resource monitoring: Real-time CPU, memory, network, and I/O statistics
- Smart search: Find containers by name, image, or labels across all hosts
- Detailed inspection: Full container configuration and state information
- Dual transport: stdio for Claude Code, HTTP for remote access
Tools
| Tool | Description |
|---|---|
homelab_list_containers |
List containers with filtering by state, name, image, labels |
homelab_container_action |
Start/stop/restart/pause/unpause containers |
homelab_get_logs |
Retrieve container logs with time and grep filters |
homelab_container_stats |
Get CPU, memory, network, I/O statistics |
homelab_inspect_container |
Detailed container configuration and state |
homelab_host_status |
Check connectivity and container counts per host |
homelab_search_containers |
Search containers by name, image, or labels |
homelab_docker_info |
Get Docker version, resources, and system info per host |
homelab_docker_df |
Get Docker disk usage (images, containers, volumes, cache) |
homelab_prune |
Remove unused Docker resources (requires force=true) |
homelab_host_resources |
Get host CPU, memory, disk usage via SSH |
Installation
# Clone or copy the server files
cd homelab-mcp-server
# Install dependencies
npm install
# Build
npm run build
Configuration
Create a config file at one of these locations (checked in order):
- Path in
HOMELAB_CONFIG_FILEenv var ./homelab.config.json(current directory)~/.config/homelab-mcp/config.json~/.homelab-mcp.json
Example Config
{
"hosts": [
{
"name": "unraid",
"host": "unraid.local",
"port": 2375,
"protocol": "http",
"tags": ["media", "storage"]
},
{
"name": "proxmox-docker",
"host": "192.168.1.100",
"port": 2375,
"protocol": "http",
"tags": ["vms"]
},
{
"name": "local",
"host": "localhost",
"protocol": "http",
"dockerSocketPath": "/var/run/docker.sock"
}
]
}
Copy homelab.config.example.json as a starting point:
cp homelab.config.example.json ~/.config/homelab-mcp/config.json
# or
cp homelab.config.example.json ~/.homelab-mcp.json
Note: If
/var/run/docker.sockexists and isn't already in your config, it will be automatically added as a host using your machine's hostname. This means the server works out-of-the-box for local Docker without any configuration.
Host Configuration Options
| Field | Type | Description |
|---|---|---|
name |
string | Unique identifier for the host |
host |
string | Hostname or IP address |
port |
number | Docker API port (default: 2375) |
protocol |
"http" | "https" | Connection protocol |
dockerSocketPath |
string | Path to Docker socket (for local connections) |
tags |
string[] | Optional tags for filtering |
Enabling Docker API on Hosts
Unraid
Docker API is typically available at port 2375 by default.
Standard Docker (systemd)
Edit /etc/docker/daemon.json:
{
"hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:2375"]
}
Or override the systemd service:
sudo systemctl edit docker.service
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375
⚠️ Security Note: Exposing Docker API without TLS is insecure. Use on trusted networks only, or set up TLS certificates.
Usage
With Claude Code
Add to ~/.claude/claude_code_config.json:
{
"mcpServers": {
"homelab": {
"command": "node",
"args": ["/absolute/path/to/homelab-mcp-server/dist/index.js"],
"env": {
"HOMELAB_CONFIG_FILE": "/home/youruser/.config/homelab-mcp/config.json"
}
}
}
}
Or if your config is in one of the default locations, you can skip the env entirely:
{
"mcpServers": {
"homelab": {
"command": "node",
"args": ["/absolute/path/to/homelab-mcp-server/dist/index.js"]
}
}
}
Then in Claude Code:
> /mcp
> List all running containers on unraid
> Restart the plex container
> Show me the logs from sonarr with errors in the last hour
> Which containers are using the most memory?
HTTP Mode
For remote access or multi-client scenarios:
# Start HTTP server
node dist/index.js --http
# Server runs on http://127.0.0.1:3000/mcp
# Health check: http://127.0.0.1:3000/health
Environment variables for HTTP mode:
PORT: Server port (default: 3000)HOST: Bind address (default: 127.0.0.1)
CLI Help
node dist/index.js --help
Example Interactions
List containers
User: What containers are running on my homelab?
Claude: [calls homelab_list_containers with state="running"]
I found 47 running containers across your hosts:
🟢 plex (unraid) - Image: linuxserver/plex | Up 3 days
🟢 sonarr (unraid) - Image: linuxserver/sonarr | Up 3 days
🟢 radarr (unraid) - Image: linuxserver/radarr | Up 3 days
...
Check logs
User: Show me any errors from nginx in the last hour
Claude: [calls homelab_get_logs with container_id="nginx", since="1h", grep="error"]
Found 3 error entries in nginx logs:
[14:23:15] 2024/12/15 14:23:15 [error] connect() failed...
Resource monitoring
User: Which containers are using the most CPU?
Claude: [calls homelab_container_stats]
Top CPU consumers:
| Container | Host | CPU% | Memory |
|-----------|------|------|--------|
| plex | unraid | 45.2% | 2.1 GB |
| handbrake | unraid | 23.8% | 1.4 GB |
Development
# Watch mode for development
npm run dev
# Build
npm run build
# Test with MCP Inspector
npx @modelcontextprotocol/inspector node dist/index.js
Architecture
homelab-mcp-server/
├── src/
│ ├── index.ts # Entry point, transport setup
│ ├── types.ts # TypeScript interfaces
│ ├── constants.ts # Configuration constants
│ ├── tools/
│ │ └── index.ts # MCP tool definitions
│ ├── services/
│ │ ├── docker.ts # Docker API client
│ │ └── ssh.ts # SSH host resource monitoring
│ └── schemas/
│ └── index.ts # Zod validation schemas
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.md
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。