Open Source Written in Rust AI-Powered Discord

The AI-powered
process manager.

Single binary. Zero dependencies. Health probes, AI crash diagnosis, Telegram alerts, Prometheus metrics, reverse proxy, cloud fleet management, TUI dashboard — all in Rust.

mhost
$ mhost start mhost.toml
  Started 'api-server'
  Started 'worker' (2 instances)
  Started 'frontend'

$ mhost list
id   name          status       pid    cpu    mem      uptime
────────────────────────────────────────────────────────────────
a1b2 api-server    ● online    12345  12.3%  128MB    2d 14h
c3d4 worker        ● online    12346   3.1%   64MB    2d 14h
e5f6 worker        ● online    12347   2.8%   62MB    2d 14h
g7h8 frontend      ● online    12348   1.0%   32MB    1d 08h

$ mhost ai diagnose api-server
  Root Cause: Connection pool exhausted (10/10 connections)
  Fix: Increase pool_size to 25 in database.config
  Prevention: Add alert for pool utilization > 80%
0
Rust Crates
0
Tests Passing
0
CLI Commands
0
Notif. Channels
0
AI Features
Comparison

Everything PM2 does.
And everything it doesn't.

Feature
PM2
mhost
Runtime required
Node.js (150MB+)
None (14MB binary)
Health checks
Alive/dead only
HTTP, TCP, script probes
Log search
grep files manually
Built-in FTS5 full-text search
Notifications
Plugin required
8 channels built-in
Metrics
Basic
Prometheus + alerts + auto-remediation
Reverse proxy
None
Built-in with auto-TLS
Deploy
Basic
Git + hooks + rollback + history
Dashboard
Web only
Terminal TUI with sparklines
Process groups
None
Dependency ordering (topological sort)
Restart strategy
Basic
Exponential backoff + circuit breaker
AI intelligence
None
Diagnose, optimize, ask, watch (OpenAI/Claude)
Autonomous agent
None
AI agent with LLM tool calling — monitors, acts, reports to Telegram
Cloud fleet
None
SSH fleet + cloud-native API (BETA) — 10 providers, secrets, cost, drift, IaC export
Remote control
None
Telegram/Discord bot with role-based permissions
Config format
JS only
TOML, YAML, JSON
Web dashboard
pm2-web (separate)
Built-in browser UI with SSE live logs
Zero-downtime reload
Basic
Health-check gated rolling restart
Dev mode
None
File watcher + auto-restart + .env loading
Features

Built for production.
Designed for developers.

Every feature you need to manage processes in production. No plugins, no runtime dependencies.

Health Probes

HTTP, TCP, and script-based health checks. Processes only go online after probes pass. Failures trigger auto-restart.

Auto-Restart

Exponential backoff (100ms to 30s). Circuit breaker stops restart loops. Configurable per process.

Process Groups

Dependency ordering with topological sort. Start databases before APIs. Stop in reverse order.

8 Notification Channels

Telegram, Slack, Discord, Email, PagerDuty, Teams, Ntfy, Webhook. Throttling, escalation, auto-resolve.

Log Engine

FTS5 full-text search. JSON auto-parse. GELF, Loki, Elasticsearch, Syslog sinks. Retention policies.

Prometheus Metrics

CPU, memory, uptime, restarts exported to /metrics. Alert rules with auto-remediation.

Reverse Proxy

Host-based routing, load balancing (round-robin, least-conn, IP-hash), auto-TLS via Let's Encrypt.

Deploy Engine

Git pull + pre/post hooks + graceful reload. Full deploy history. One-command rollback.

TUI Dashboard

Split-pane terminal UI. Process table, CPU/memory sparklines, live log tail, vim keybindings.

💬

Chat Bot Control

Control processes from Telegram or Discord. Role-based permissions, confirmation for destructive actions.

🤖

Autonomous Agent

AI agent that monitors, diagnoses, and acts on its own. Chat with it via Telegram. Configurable autonomy levels.

📊

Web Dashboard

Real-time browser UI accessible from any device. Live SSE log streaming. Dark theme, zero dependencies.

Zero-Downtime Reload

Rolling restarts with health-check gate. New instances must pass probes before old ones are killed.

Dev Mode

Built-in file watcher + auto-restart. Replaces nodemon. Supports .env loading and custom watch paths.

Load Testing

Built-in HTTP benchmark with concurrent workers. Reports RPS, latency percentiles, and error rates.

🐦

Canary Deploys

Scale up a canary, monitor for errors, auto-promote or rollback. Configurable traffic percent and duration.

📷

Snapshots

Capture and restore full process state. Create snapshots before risky changes, restore instantly.

🔒

SSL Monitoring

Check certificate expiry for any URL. Warns when certs expire within 30 days. No external tools needed.

🔗

Public REST API

25 endpoints with bearer token auth, WebSocket streaming, and outbound webhooks with HMAC signing.

Cloud-Native APIs BETA

Direct integration with 10 cloud providers. Provision, deploy, scale, manage secrets, track costs, detect drift, and export IaC.

NEW

AI-Powered Intelligence.
Built right in.

The first process manager with built-in LLM capabilities. Diagnose crashes, query logs in English, generate configs, get optimization suggestions.

mhost ai
$ mhost ai diagnose api-server
Root Cause
Unhandled promise rejection in database.js:42. Connection pool exhausted after 15 concurrent requests exceeded the pool limit of 10.

Fix Steps
1. Increase pool size: max_connections: 25
2. Add connection timeout: idle_timeout: 30000

Prevention
Add health check for DB pool utilization. Set alert: memory > 256MB for 5m
$ mhost ai ask "which process uses the most memory?"
api-server is using 128.4 MB across 1 instance. The workers are at 64 MB each.
$ mhost ai config "node api with 2 python workers and health checks"
Generated mhost.toml
[process.api]
command = "node server.js"
instances = 1

[process.api.health.http]
url = "http://localhost:3000/health"

10 AI Commands

diagnose — crash root cause analysis
logs — natural language log search
optimize — performance recommendations
config — generate config from description
postmortem — incident report generation
watch — real-time anomaly detection
ask — ask anything about your processes
explain — config explanation in plain English
suggest — proactive improvement suggestions
setup — configure OpenAI or Claude

Supports Both Providers

OpenAI
GPT-4o, GPT-4o-mini, any chat model
Anthropic Claude
Sonnet, Haiku, Opus
# ~/.mhost/ai.json
{ "provider": "openai",
  "api_key": "${OPENAI_API_KEY}",
  "model": "gpt-4o" }
AUTONOMOUS SELF-HEALING

A DevOps engineer
that never sleeps.

An autonomous AI agent with a persistent brain. It watches your processes 24/7, diagnoses crashes before you notice, heals known issues instantly, and learns from every fix.

Live Telegram Chat
🤖
mhost Agent
● online
mhost Agent
🔴 api-server crashed (EADDRINUSE port 3000).
Checked logs — previous instance held the port.
✓ Auto-healed using playbook #1 (wait 5s + restart)
Now online (PID 45123).
scale workers to 4
mhost Agent
✅ Scaled workers from 2 → 4. All instances online.
what's using the most memory?
mhost Agent
📊 api-server: 128MB (2 inst)
workers: 64MB each (4 inst = 256MB)
Total fleet: 384MB
⚠ worker memory trending up 3%/hr — watching.
How It Works
👁

1. Observe

Polls all processes every 30s. Reads logs, checks health scores, detects anomalies.

🧠

2. Think

Brain checks memory: known pattern? Apply playbook instantly. Unknown? Consult LLM with full context.

3. Act

Restarts, scales, rolls back. Supervised mode asks you first. Autonomous mode just does it.

📚

4. Learn

Every successful fix becomes a new playbook. Next time, zero API cost. The brain gets smarter.

Fleet Health Dashboard
mhost brain status
$ mhost brain status

mhost Brain — Fleet Health
──────────────────────────────────────
api-server    ████████░░  82/100
worker        ██████████  100/100
express-api   ██████░░░░  62/100
monitor       ███░░░░░░░  28/100
mhost brain playbooks
$ mhost brain playbooks

port-conflict
  Trigger: EADDRINUSE
  Action: wait 5s + restart

crash-loop
  Trigger: 3+ crashes in 10min
  Action: stop + escalate to human

auto-api-1711843200 (auto-learned)
  Trigger: ECONNRESET
  Action: restart
Self-Healing Intelligence
📚

8 Built-in Playbooks

Port conflicts, OOM kills, connection refused, permission errors, disk full, crash loops, memory leaks. All fixed automatically — zero API calls.

📈

Health Scores (0–100)

Every process gets scored based on uptime, restarts, errors, and memory trends. Score drops below 50? The brain investigates automatically.

💡

Auto-Learning

Every successful fix becomes a new playbook. The brain remembers 500 incidents. Known patterns healed in milliseconds — no LLM needed.

🔒

3 Autonomy Levels

Autonomous — heals and notifies. Supervised — asks before acting. Manual — only responds to your messages. You choose the leash.

💥
Crash
🧠
Brain checks
memory
Known? Instant fix
No LLM call
or
🤖
Unknown? Ask LLM
With memory context
📚
Learn & remember
New playbook added
Production Ready

Built for real
production workflows.

Web dashboard, zero-downtime deploys, live log streaming, and a dev mode that replaces nodemon. Everything from development to production.

📊

Web Dashboard

mhost dashboard

Real-time browser UI accessible from any device. Process table, log viewer, action buttons, SSE live streaming. Dark theme, responsive, zero dependencies.

$ mhost dashboard --port 8080
Dashboard at http://localhost:8080

Zero-Downtime Reload

mhost reload

Restart without dropping a single request. New instances start, health checks pass, then old instances are killed. Users never notice.

$ mhost reload api-server
Reloaded 'api-server' with zero downtime
📄

Live Log Streaming

--follow

Real-time log tail like tail -f. Timestamps, process names, colored JSON parsing, grep filtering — all streaming live.

$ mhost logs api --follow --grep error
09:31:00 api Connection timeout
09:31:05 api ECONNREFUSED

Dev Mode

mhost dev

Replaces nodemon + dotenv + concurrently. File watcher, auto-restart, .env loading, colorized inline logs. One command for development.

$ mhost dev server.js --watch src/
mhost dev server.js — Watching: src/
File changed — restarting...
NEW

Manage your entire fleet.
From one terminal.

Connect to EC2, Azure, DigitalOcean, Railway, or any SSH server. Deploy, monitor, and scale across your entire infrastructure.

mhost cloud
$ mhost cloud import aws --region us-east-1 --tag env=production
  + prod-api (54.123.45.67)
  + prod-worker (54.123.45.68)
  + prod-db (54.123.45.69)
  Imported 3 servers from aws

$ mhost cloud status
Server          Status   mhost   Processes  CPU
────────────────────────────────────────────────────
prod-api        ● up     yes     4/4        45%
prod-worker     ● up     yes     3/3        72%
prod-db         ● up     yes     1/1        12%

$ mhost cloud restart all api-server
  prod-api: restarted 'api-server'
  prod-worker: restarted 'api-server'

Cloud Providers

Auto-import servers from AWS EC2, Azure VMs, DigitalOcean, Railway. One command to discover your entire fleet.

Remote Operations

Deploy configs, stream logs, restart processes, scale instances — all via SSH. No custom agents required.

AI Cloud Ops

AI provisions infrastructure, diagnoses remote servers, and plans migrations between environments.

Get Started

Install in seconds.

🍺
Homebrew
brew install maqalaqil/tap/mhost
📦
npm
npm install -g @maqalaqil93/mhost
Cargo
cargo install mhost
curl
curl -fsSL mhostai.com/install.sh | sh
PowerShell
irm mhostai.com/install.ps1 | iex
💻
From Source
git clone && cargo build --release
See It In Action

From zero to production
in 60 seconds.

~/myapp
Configuration

One file.
Your entire stack.

Define processes, health checks, groups, notifications, metrics, deploy hooks, and AI config in a single TOML, YAML, or JSON file. Environment variable expansion with ${VAR} syntax.

TOML, YAML, JSON support
Environment variable expansion
Health probes per process
Dependency groups
Notification channels
Alert rules & auto-remediation
# mhost.toml [process.api-server] command = "node server.js" instances = 4 max_memory = "512MB" grace_period = "5s" [process.api-server.health.http] url = "http://localhost:3000/health" interval = "10s" [process.worker] command = "python3 worker.py" instances = 2 cron_restart = "0 3 * * *" [groups.backend] processes = ["api-server", "worker"] [notifications.telegram] bot_token = "${TELEGRAM_TOKEN}" events = ["crash", "errored"] [alerts.high-memory] condition = "memory > 450MB for 5m" action = "restart"
Architecture

15 crates. One binary.

Modular Rust workspace. Each crate has one responsibility. The CLI and daemon compile into two binaries with zero runtime dependencies.

mhost-core Core types, state machine, JSON-RPC protocol mhost-config TOML / YAML / JSON config parsing mhost-ipc JSON-RPC over Unix socket / named pipe mhost-logs Log capture, FTS5, rotation, 4 external sinks mhost-health HTTP / TCP / script health probes mhost-notify 8 notification channels + throttle + escalation mhost-metrics Collector, time-series, Prometheus, alerts mhost-proxy Reverse proxy, TLS, ACME, load balancing mhost-deploy Git deploy, hooks, rollback, history mhost-ai LLM intelligence (OpenAI / Claude) - 10 features mhost-cloud Remote fleet management - SSH, AWS, Azure, DO, Railway mhost-bot Telegram/Discord bot - role-based control, audit log mhost-tui Terminal dashboard with sparklines (ratatui) mhost-daemon Process supervisor, state store (mhostd binary) mhost-cli CLI interface with 49 commands (mhost binary) agent.js Autonomous agent - Observe/Think/Act loop, Telegram I/O

Join the Community

Get help, share ideas, and connect with other mhost users on Discord.

Join Discord

Ready to replace PM2?

One command to install. One file to configure. Zero dependencies.