MCP-compatible server exposing 20 infrastructure management and knowledge tools for the Sanchez Family network. Provides Docker, Traefik, DNS, network, service, documentation, and diagnostic capabilities to any AI agent or MCP client on the network.
The server acts as the single programmatic interface between AI agents (Claude Code, n8n workflows) and the production infrastructure running on rod-server (10.0.1.6). It bridges the gap between natural language tool calls and low-level Docker/Traefik/DNS APIs.
Network inventory, port checks, connectivity tests
src/tools/services.js
Secondary
Service catalog and HTTP health checks
src/tools/docs.js
Secondary
Architecture docs, service info, troubleshooting guides
src/tools/diagnose.js
Secondary
Multi-step service and DNS diagnostics
src/data/infrastructure.json
Auxiliary
Static knowledge base (hosts, services, topology, troubleshooting)
Docker Socket
External
Docker Engine API via /var/run/docker.sock
Traefik API
External
Traefik dashboard API at http://traefik:8080/api
Pi-hole
External
DNS config files (read-only mounts) + HTTP API
MCP Proxy
External
Upstream proxy at mcp.home:3100 (API key auth)
Tools
20
Tool Categories
7
Runtime
Node.js 20
Port
3200
Source Files
9
Network
hosting_web
2. Runtime Architecture
Diagram A: Runtime Request Flow
Request Flow
Claude Code (or any MCP client) sends an HTTP POST to /call with a tool name and parameters -- either directly to infra-mcp.home:3200 or via the MCP Proxy at mcp.home:3100 (which adds API key authentication).
The Express server (index.js) dispatches the request to the appropriate tool module based on the tool name prefix (docker, traefik, dns, network, service, docs, diagnose).
Each tool module queries its backend: Docker tools use the dockerode library over the Unix socket, Traefik tools query the HTTP dashboard API, DNS tools read mounted config files or the Pi-hole HTTP API, and knowledge tools read from the static infrastructure.json.
Results are returned as MCP-compatible content blocks ({"content": [{"type": "text", "text": "..."}]}), ready for consumption by any MCP client.
3. Public Interfaces
HTTP Endpoints
Method
Path
Auth
Description
GET
/health
None
Server status, tool count, uptime
GET
/tools
None
List all 20 tools with MCP schemas
GET
/docs
None
Auto-generated API documentation
POST
/call
None (direct) / API key (proxy)
Execute a tool: {"tool":"name","params":{}}
POST
/tools/list
None
MCP JSON-RPC 2.0 tool listing
POST
/tools/call
None
MCP JSON-RPC 2.0 tool execution
Access URLs
Method
URL
Auth
Direct (LAN)
https://infra-mcp.home
None
Direct (public)
https://infra-mcp.sanchezfamily.ca
None
Via MCP Proxy
https://mcp.home/mcp/infra/...
X-API-Key header
MCP Tools (20)
Docker Tools (4)
Tool Name
Description
Parameters
docker_list_containers
List all Docker containers with status, ports, networks, and image info
all (boolean, optional)
docker_container_logs
Get recent logs from a Docker container
name (string, required), lines (number, optional)
docker_container_stats
Get CPU, memory, and network stats for a container
name (string, required)
docker_compose_status
Get status of all Docker Compose projects and containers
None
Traefik Tools (3)
Tool Name
Description
Parameters
traefik_list_routers
List all HTTP routers with rules, entrypoints, and TLS config
None
traefik_list_services
List all services with backend URLs and health status
None
traefik_overview
Dashboard overview with router, service, middleware counts
None
DNS Tools (3)
Tool Name
Description
Parameters
dns_list_records
List all Pi-hole custom DNS records (IP-to-domain)
None
dns_list_local_domains
List all local .home domain mappings from dnsmasq
None
dns_query_stats
Pi-hole DNS query statistics and blocking status
None
Network Tools (3)
Tool Name
Description
Parameters
network_inventory
Full network inventory: hosts, IPs, topology, firewall rules
None
network_check_port
Check if a port is open on a host (TCP connect, 3s timeout)
Test full DNS resolution chain: Pi-hole, registration, external DNS, HTTPS
domain (string, required)
4. Repository Structure
_infra_mcp/
CLAUDE.md # Comprehensive API docs and usage guide
Dockerfile # Node.js 20 Alpine, production build
package.json # 3 dependencies (express, axios, dockerode)
docs/
ARCHITECTURE.html # Previous architecture doc
src/
index.js # Express server, tool dispatcher, MCP endpoints
data/
infrastructure.json # Static knowledge base (hosts, services, topology)
tools/
docker.js # 4 tools: list, logs, stats, compose status
traefik.js # 3 tools: routers, services, overview
dns.js # 3 tools: records, local domains, query stats
network.js # 3 tools: inventory, port check, connectivity
services.js # 2 tools: catalog, health check
docs.js # 3 tools: architecture, service info, troubleshooting
diagnose.js # 2 tools: service diagnostics, DNS resolution
Module Architecture
Each tool module exports a uniform interface:
tools -- Array of MCP tool definitions with name, description, and inputSchema
call(name, params) -- Async function that dispatches to the correct handler by tool name
The main index.js aggregates all modules into a flat registry, mapping each tool name to its module's call function. This keeps tool modules fully independent with no cross-dependencies.
TLS agent with rejectUnauthorized: false for self-signed certs
External Services
Service
Connection
Required
Failure Impact
Docker Engine
/var/run/docker.sock
Yes
All docker_* tools and container diagnostics fail
Traefik Dashboard API
http://traefik:8080/api
Yes
All traefik_* tools and routing diagnostics fail
Pi-hole Config Files
Mounted at /pihole-config/
Partial
dns_list_records and dns_list_local_domains return errors; other tools unaffected
Pi-hole HTTP API
http://pihole:80/admin/api.php
Partial
dns_query_stats fails; may require auth token
Network (ping/dig)
System commands
Optional
network_test_connectivity and diagnose_dns_resolution may degrade
7. Data Sources
Source
Type
Mount / Connection
Tools Using It
Docker Socket
Unix socket
/var/run/docker.sock (read-only)
docker_*, diagnose_service
Traefik API
HTTP
http://traefik:8080/api (Docker network)
traefik_*, diagnose_*
Pi-hole custom.list
File
/pihole-config/custom.list (read-only)
dns_list_records
Pi-hole dnsmasq conf
File
/pihole-config/02-local-domains.conf (read-only)
dns_list_local_domains
Pi-hole HTTP API
HTTP
http://pihole:80/admin/api.php (Docker network)
dns_query_stats
infrastructure.json
Static JSON
Built into image at src/data/
network_*, service_*, docs_*, diagnose_*
CLAUDE.md
File
/docs/CLAUDE.md (read-only mount)
docs_architecture
Updating the knowledge base: The static infrastructure.json is baked into the Docker image at build time. After adding new hosts, services, or changing network configuration, edit src/data/infrastructure.json, rebuild the image, and restart the container.
8. Constraints and Risks
Item
Severity
Description
Docker socket access
Medium
Read-only mount of /var/run/docker.sock allows container inspection but not management. The socket is still a privileged resource -- container compromise could read container metadata.
No authentication on direct access
Medium
Direct access to infra-mcp.home has no API key requirement. Mitigated by Traefik lan-only middleware restricting access to 10.0.1.0/24 and Docker subnets.
Static knowledge base
Low
infrastructure.json is baked into the image. Adding new services requires a rebuild. Network/service changes are not reflected until the image is rebuilt.
Pi-hole API auth
Low
dns_query_stats may fail if Pi-hole requires an authentication token. The tool gracefully returns an error message.
Shell command injection
Low
network_test_connectivity and diagnose_dns_resolution pass user input to exec() for ping/dig. Input validation is minimal -- currently relies on LAN-only access restriction.
No tests
Low
No unit or integration tests. The server is validated through manual health checks and end-to-end tool calls.