home / mcp / homelab mcp server
MCP server for homelab management - Docker, OPNsense, and TrueNAS integration
Configuration
View docs{
"mcpServers": {
"bshandley-homelab-mcp": {
"url": "https://mcp.example.com/mcp",
"headers": {
"PORT": "3005",
"API_KEY": "your-api-key-here",
"PROXMOX_HOST": "10.0.0.2",
"TRUENAS_HOST": "10.0.0.105",
"OPNSENSE_HOST": "10.0.0.1",
"TRUENAS_API_KEY": "your-key",
"CAPABILITY_LEVEL": "1",
"OPNSENSE_API_KEY": "your-key",
"PROXMOX_TOKEN_ID": "root@pam!mytoken",
"HOME_ASSISTANT_HOST": "10.0.0.103",
"HOME_ASSISTANT_PORT": "8123",
"OPNSENSE_API_SECRET": "your-secret",
"HOME_ASSISTANT_TOKEN": "your-long-lived-token",
"PROXMOX_TOKEN_SECRET": "your-secret",
"HOME_ASSISTANT_USE_HTTPS": "false"
}
}
}
}Homelab MCP Server lets you monitor and manage key homelab components through a centralized MCP interface. It supports secure, tiered capability levels to view status, perform actions, and configure sources like containers, firewalls, storage, virtualization, and service health from a single control plane.
You interact with the MCP server through an MCP client. Start with Level 1 to monitor read-only data such as container status, service health, and host metrics. If you need to take action, move up to higher capability levels and perform tasks like starting or stopping containers, restarting services, or inspecting configurations. Regularly review the planned actions before proceeding, especially at higher levels.
# Prerequisites
- Docker and Docker Compose installed on the target host
- Node.js 20+ (for local development)
- Optional: OPNsense TrueNAS Proxmox Home Assistant credentials
# 1. Clone or copy the project to your host
cd homelab-mcp
# 2. Copy example environment file
cp .env.example .env
# 3. Generate a secure API key
openssl rand -hex 32
# 4. Edit the environment file and add credentials
nano .envConfigure the MCP server settings in your environment file. Set the desired capability level, API key, port, and any optional service credentials you use (OPNsense, TrueNAS, Proxmox, Home Assistant). The server exposes an HTTP interface for remote clients as well as a local JavaScript runtime entry point if you want to run it directly inside a Node.js environment.
env
CAPABILITY_LEVEL=1 # Start with level 1 (read-only)
API_KEY=your-api-key-here # Use the generated key
PORT=3005
# OPNsense (optional)
OPNSENSE_HOST=10.0.0.1
OPNSENSE_API_KEY=your-key
OPNSENSE_API_SECRET=your-secret
# TrueNAS (optional)
TRUENAS_HOST=10.0.0.105
TRUENAS_API_KEY=your-key
# Proxmox (optional)
PROXMOX_HOST=10.0.0.2
PROXMOX_TOKEN_ID=root@pam!mytoken
PROXMOX_TOKEN_SECRET=your-secret
# Home Assistant (optional)
HOME_ASSISTANT_HOST=10.0.0.103
HOME_ASSISTANT_PORT=8123
HOME_ASSISTANT_TOKEN=your-long-lived-token
HOME_ASSISTANT_USE_HTTPS=falseBuild and start the server, then verify basic health and endpoints. You can run the server in a container or as a local Node.js process depending on your environment.
# Build TypeScript and compose images
npm install
npm run build
docker compose build
docker compose up -d
# Check logs
docker compose logs -fYou can connect Claude Desktop to the MCP server using either a remote HTTP endpoint or a local runtime config. The HTTP endpoint is the preferred remote option, while the local stdio option lets you run the server directly on your machine.
# HTTP remote config example
{
"mcpServers": {
"homelab": {
"type": "http",
"name": "homelab_mcp",
"url": "https://mcp.example.com/mcp",
"args": []
}
}
}If you use OAuth 2.0 for Claude Chat, generate client credentials and add them to your environment or the client settings so the connector can obtain access tokens automatically.
# Generate OAuth credentials
openssl rand -hex 32
openssl rand -hex 32The server exposes health and MCP endpoints to support health checks and protocol requests. You can test health and token endpoints, then perform routine MCP calls to list, inspect, or manage resources.
curl https://mcp.example.com/healthStart with read-only access and only elevate permissions when necessary. Rotate API keys regularly, monitor logs in real time, and isolate the MCP server in a restricted network segment with limited access to critical systems.
Common issues include missing API keys, incorrect capability levels, or Docker socket access problems. Review container logs to identify failures and verify that all optional service credentials are reachable.
Be aware that higher capability levels grant broader control over your infrastructure, including the ability to modify configurations or stop services. Always exercise caution and verify planned actions before execution.
# Complete env reference used by the local runtime example
CAPABILITY_LEVEL=1
API_KEY=your-api-key-here
OPNSENSE_HOST=10.0.0.1
OPNSENSE_API_KEY=your-key
OPNSENSE_API_SECRET=your-secret
TRUENAS_HOST=10.0.0.105
TRUENAS_API_KEY=your-key
PROXMOX_HOST=10.0.0.2
PROXMOX_TOKEN_ID=root@pam!mytoken
PROXMOX_TOKEN_SECRET=your-secret
HOME_ASSISTANT_HOST=10.0.0.103
HOME_ASSISTANT_PORT=8123
HOME_ASSISTANT_TOKEN=your-long-lived-token
HOME_ASSISTANT_USE_HTTPS=false
PORT=3005The API key should be kept secret and rotated periodically. Start with the lowest capability level you need, and for Level 4 ensure the stacks directory is mounted read-write as required. The MCP server requires access to the Docker socket for container management and may use self-signed certificates for OPNsense and TrueNAS connections.
List all Docker containers and their basic status
Fetch logs for a specific container
Return CPU/memory statistics for containers
Provide host system information such as CPU, memory, and disk usage
Retrieve current OPNsense firewall status
Check TrueNAS pool health and status
Fetch TrueNAS alerts and events
Get Proxmox cluster status
List all VMs and containers managed by Proxmox
Get status for a specific VM/container
Get Home Assistant version and entity counts
List all Home Assistant entities
Get a specific Home Assistant entity state and attributes
Restart a Docker container
Start a Docker container
Stop a Docker container
Restart an OPNsense service
Start a Proxmox VM/container
Stop a Proxmox VM/container
Gracefully shutdown a Proxmox VM/container
Reboot a Proxmox VM/container
Read a docker-compose.yml file
List Docker volumes
List Docker networks
Inspect container details
List TrueNAS datasets
Get details about a TrueNAS dataset
Get VM/container configuration from Proxmox
List Proxmox storage
List Proxmox cluster nodes
Get Home Assistant configuration
Retrieve Home Assistant error logs
Write or modify a docker-compose.yml file
Deploy a docker-compose stack
Remove a docker-compose stack
Execute a command inside a running container
Create a ZFS snapshot in TrueNAS
Create a VM/container snapshot in Proxmox
Delete a VM/container in Proxmox