Skip to main content
Mole configuring HTTP API

HTTP API Configuration

Enable health checks, dashboard API endpoints, and remote agent APIs. The HTTP server is your window into the mesh - use it for monitoring, status queries, and distributed operations.

Most common settings:

http:
enabled: true
address: ":8080"

Configuration

http:
enabled: true # Enable HTTP API server
address: ":8080" # Bind address (host:port)
read_timeout: 10s # Request read timeout
write_timeout: 10s # Response write timeout
token_hash: "" # bcrypt hash of API bearer token (empty = no auth)

# Endpoint controls
minimal: false # When true, only health endpoints enabled
pprof: false # /debug/pprof/* profiling endpoints
dashboard: true # /api/* dashboard endpoints
remote_api: true # /agents/* distributed APIs

Options

OptionTypeDefaultDescription
enabledboolfalseEnable the HTTP API server
addressstring:8080Bind address (:8080 or 127.0.0.1:8080)
read_timeoutduration10sMaximum time to read request
write_timeoutduration10sMaximum time to write response
token_hashstring""bcrypt hash of bearer token (empty = no auth)
minimalboolfalseOnly enable health endpoints
pprofboolfalseEnable Go profiling endpoints
dashboardbooltrueEnable dashboard API endpoints
remote_apibooltrueEnable distributed mesh APIs

Authentication

Protect the HTTP API with bearer token authentication. When token_hash is set, all non-health endpoints require a valid token.

Setup

# 1. Generate a token hash
muti-metroo hash
# Enter your chosen token when prompted

# 2. Add the hash to your config
# http:
# token_hash: "$2a$10$..."

Usage

# CLI flag
muti-metroo status --token my-secret-token

# Environment variable
export MUTI_METROO_TOKEN=my-secret-token
muti-metroo status

# curl
curl -H "Authorization: Bearer my-secret-token" http://localhost:8080/agents

# WebSocket (query parameter fallback)
wscat -c "ws://localhost:8080/agents/{id}/shell?token=my-secret-token"

Exempt Endpoints

These endpoints never require authentication (for load balancer probes):

  • /health, /healthz, /ready
  • / (splash page), /logo.png

Endpoints

Always Available

These endpoints are always enabled when http.enabled: true:

EndpointMethodDescription
/healthGETSimple health check, returns "OK"
/healthzGETDetailed health with JSON stats
/readyGETReadiness probe for load balancers
/routes/advertisePOSTTrigger immediate route advertisement

Dashboard API Endpoints

Enabled when dashboard: true:

EndpointMethodDescription
/api/topologyGETTopology data for visualization
/api/dashboardGETDashboard overview (stats, peers, routes)
/api/nodesGETDetailed node info for all agents
/api/mesh-testGET/POSTMesh connectivity test

Remote API Endpoints

Enabled when remote_api: true:

EndpointMethodDescription
/agentsGETList all known agents
/agents/{id}GETGet status from specific agent
/agents/{id}/routesGETGet route table from agent
/agents/{id}/peersGETGet peer list from agent
/agents/{id}/shellWebSocketRemote shell access
/agents/{id}/icmpWebSocketICMP ping sessions
/agents/{id}/file/uploadPOSTUpload file to agent
/agents/{id}/file/downloadPOSTDownload file from agent

Profiling Endpoints

Enabled when pprof: true:

EndpointMethodDescription
/debug/pprof/GETProfiling index
/debug/pprof/profileGETCPU profile
/debug/pprof/heapGETHeap profile
/debug/pprof/goroutineGETGoroutine stacks
Production Security

Disable pprof in production - profiling endpoints can leak sensitive information and consume significant resources.

Minimal Mode

For maximum OPSEC, enable only health endpoints:

http:
enabled: true
address: "127.0.0.1:8080" # Localhost only
minimal: true # Only /health, /healthz, /ready

When minimal: true, all endpoint flags (pprof, dashboard, remote_api) are ignored and those endpoints return HTTP 404.

Bind Address

All Interfaces

http:
address: ":8080" # Listen on all interfaces

Localhost Only

http:
address: "127.0.0.1:8080" # Local access only

Specific Interface

http:
address: "192.168.1.10:8080" # Specific IP only

Security Considerations

ConfigurationAccessUse Case
address: "127.0.0.1:8080"Local onlyDevelopment, single-user
address: ":8080" + token_hashAuthenticatedProduction with remote access
address: ":8080" + firewallControlledProduction with network controls
minimal: trueHealth onlyHigh-security field deployments
pprof: trueProfilingDebugging only, never production

Recommendations

  1. Set token_hash when the API is accessible over a network
  2. Bind to localhost in production unless remote access is required
  3. Disable pprof in production deployments
  4. Use minimal mode for field agents that don't need dashboard API
  5. Firewall the port if binding to all interfaces

Examples

Development

http:
enabled: true
address: ":8080"
pprof: true # Enable profiling for debugging
dashboard: true
remote_api: true

Production

http:
enabled: true
address: "127.0.0.1:8080"
pprof: false # Disable profiling
dashboard: true
remote_api: true

Authenticated API

http:
enabled: true
address: ":8080"
token_hash: "$2a$10$..." # muti-metroo hash
dashboard: true
remote_api: true

Field Agent (OPSEC)

http:
enabled: true
address: "127.0.0.1:8080"
minimal: true # Health endpoints only

Monitoring Integration

http:
enabled: true
address: ":8080"
minimal: false
dashboard: false # No dashboard API needed
remote_api: false # No distributed APIs
# Only /health, /healthz, /ready for load balancer probes

Environment Variables

http:
enabled: ${HTTP_ENABLED:-true}
address: "${HTTP_ADDRESS:-:8080}"
minimal: ${HTTP_MINIMAL:-false}