Skip to content
Conduit

mcp server

machinestate

MachineState - A single-binary Linux system state reporter with real-time JSONL streaming and a native MCP server for direct LLM integration. Built in Go and Zig from identical Markdown specs using Cl

reza-ebrahimi/machinestatecommunitylistedunreviewed

Set up

Runs on your computer. Pick your agent and operating system.

This project does not publish an install method we can turn into a config. Follow the README instead.

README

synced Oct 27, 2026

MachineState

License: MIT Go Zig

A single-binary Linux system state reporter with real-time JSONL streaming and a native MCP server for direct LLM integration. Built in Go and Zig from identical Markdown specs using Claude Opus.

Available in two implementations:

  • Go - Using gopsutil library
  • Zig - Native implementation with minimal dependencies

Both produce identical JSON output and can be used interchangeably.

Features

  • Comprehensive System Analysis

    • CPU, memory, load average, uptime, timezone
    • Disk usage and inode status
    • Network interfaces and listening ports
    • Package updates (APT, Snap)
    • Systemd service status
    • Security checks (firewall, SSH, failed logins)
    • Hardware health (battery, temperatures, crash reports)
    • Docker containers and images
    • GPU monitoring (NVIDIA, AMD, Intel)
    • Log analysis (errors, OOM events, kernel panics)
  • Multiple Output Formats

    • Terminal (colored ANSI)
    • HTML (dark theme, standalone)
    • JSON (for scripting/monitoring)
    • Markdown
  • Continuous Streaming

    • Stream data per collector as JSONL
    • Configurable intervals
    • Stop conditions: cycle count or duration
    • Collector filtering
  • Issue Detection

    • Automatic problem detection with severity levels
    • Actionable fix recommendations
  • MCP Server Integration

    • Run as Model Context Protocol (MCP) server
    • Integrate with Claude Code
    • 14 tools for querying system state
  • HTTP Server Mode

    • REST API endpoints
    • Prometheus metrics
    • Web dashboard

Quick Start

Download

# Download the latest release (Go version)
curl -LO https://github.com/reza-ebrahimi/machinestate/releases/latest/download/machinestate-go-linux-amd64
chmod +x machinestate-go-linux-amd64
sudo mv machinestate-go-linux-amd64 /usr/local/bin/machinestate

Build from Source

Go:

cd go/
go build -o machinestate .
sudo cp machinestate /usr/local/bin/

Zig:

cd zig/
zig build -Doptimize=ReleaseFast
sudo cp zig-out/bin/machinestate /usr/local/bin/

Docker

# Build and run Go version
docker build -f Dockerfile.go -t machinestate:go .
docker run -d -p 8080:8080 -v /proc:/host/proc:ro -v /sys:/host/sys:ro machinestate:go

# Or use docker-compose (runs both on ports 8080 and 8081)
docker-compose up -d

Usage

# Generate terminal report (default)
machinestate

# Generate HTML report
machinestate --format html > report.html

# Generate JSON output
machinestate --format json | jq '.issues'

# Stream JSONL output
machinestate --stream

# Run HTTP server
machinestate --http 8080

# Run as MCP server (for Claude Code)
machinestate --mcp

Options

FlagDescription
--formatOutput format: terminal, html, json, markdown, all
--outputOutput file path
--streamEnable continuous streaming mode (JSONL)
--intervalStreaming interval in seconds (default: 5)
--durationMax streaming duration in seconds
--countNumber of streaming cycles
--collectorsComma-separated collectors to stream
--configPath to YAML config file
--httpRun HTTP server on port
--mcpRun as MCP server
--versionShow version

HTTP Server

machinestate --http 8080
EndpointDescription
/Web dashboard (auto-refresh 30s)
/healthHealth check
/api/reportFull system report JSON
/api/issuesDetected issues
/api/systemCPU, memory, load
/api/diskFilesystem usage
/api/networkInterfaces, ports
/metricsPrometheus format

MCP Server (Claude Code)

# Add to Claude Code
claude mcp add-json machinestate '{"type":"stdio","command":"/path/to/machinestate","args":["--mcp"]}'

Available tools: get_system_report, get_issues, get_system_info, get_disk_info, get_network_info, get_package_info, get_service_info, get_security_info, get_hardware_info, get_docker_info, get_snap_info, get_gpu_info, get_log_info, stream_system_report

Configuration

Create ~/.config/machinestate/config.yaml:

disk_warning_percent: 80
disk_critical_percent: 90
memory_warning_percent: 90
battery_health_warning: 80
battery_health_critical: 50
uptime_warning_days: 30
gpu_temp_warning: 80
gpu_temp_critical: 90

System Requirements

  • OS: Linux (any distribution with systemd)
  • Tested on: Ubuntu, Debian, Fedora, Arch Linux
  • Optional tools: apt, snap, docker, nvidia-smi, journalctl

The tool gracefully degrades when optional tools are unavailable.

Performance

MetricGoZig
Binary Size11 MiB4.6 MiB
Startup Time4.0 ms0.79 ms
Full Report~4.2 s~3.1 s

Most execution time is spent on CPU sampling and external commands.

Development

make all          # Build both implementations
make test         # Run tests
make validate     # Validate JSON output against schema
make benchmark    # Run performance benchmarks
make docker-build # Build Docker images

License

MIT License - Copyright (c) 2026 Reza Ebrahimi

↑↓ navigate openesc close