Skip to main content
Glama

local-vitals-mcp

Hardware and environment guardrail MCP server for AI coding agents (Cursor, Claude Code, Cline) to prevent runaway local resource exhaustion, locked ports, and zombie background processes.

npm version TypeScript MCP License: MIT


⚑ Why local-vitals-mcp?

When AI coding agents execute builds, spin up background headless browsers, run large test suites, or spawn local LLM workers, they often run into local host bottlenecks:

  1. Port Collisions (EADDRINUSE): A previous server didn't shut down, causing dev server commands to fail in endless loops.

  2. Zombie Background Processes: Stale headless Playwright/Puppeteer browsers and dangling test workers eat gigabytes of RAM.

  3. Hardware Exhaustion: Spawning heavy tasks when RAM > 85% or CPU > 90% locks the user's host machine.

  4. VRAM OOM Errors: Loading local embeddings or vision models without checking available GPU VRAM causes hard CUDA crashes.

local-vitals-mcp gives the agent autonomous awareness of host hardware constraints and the tools to safely resolve them.


Related MCP server: open-monitor

πŸš€ Quick Setup

1. Cursor IDE (.cursor/mcp.json)

Add the following block to your project's .cursor/mcp.json or global Cursor settings:

{
  "mcpServers": {
    "local-vitals": {
      "command": "npx",
      "args": ["-y", "local-vitals-mcp"]
    }
  }
}

2. Claude Desktop (claude_desktop_config.json)

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "local-vitals": {
      "command": "npx",
      "args": ["-y", "local-vitals-mcp"]
    }
  }
}

3. Cline (VS Code Extension)

In Cline Settings > MCP Servers, add:

  • Server Name: local-vitals

  • Command: npx

  • Args: ["-y", "local-vitals-mcp"]


πŸ› οΈ Implemented MCP Tools

Tool

Parameters

Description

get_system_vitals

None

Returns real-time RAM usage, CPU load percentage, thermals, and guardrail warnings (>85% RAM, >90% CPU).

get_gpu_vram

None

Queries GPU health, VRAM allocation (total/used/free), and utilization via nvidia-smi with fallback for Apple Silicon / integrated GPUs.

inspect_port

port: number

Identifies which PID, process name, and command line is binding a specific port across Windows, macOS, and Linux.

kill_port_process

port: number, force?: boolean

Terminates the process and its full process tree occupying that port to instantly fix EADDRINUSE errors.

clean_orphan_processes

dryRun?: boolean

Detects and cleans orphaned background processes (e.g. stale headless Playwright/Chrome browsers, zombie test workers, dead parent Node daemons).


πŸ’¬ Natural Prompt Triggers for Agents

Here are examples of how your AI coding agent uses these tools automatically:

  • "My dev server failed with Error: listen EADDRINUSE: address already in use :::3000. Please free the port and restart."
    πŸ‘‰ Agent calls kill_port_process(3000) and re-runs npm run dev.

  • "Before we start running this test suite, check if the machine has enough free memory and CPU headroom."
    πŸ‘‰ Agent calls get_system_vitals to verify threshold parameters.

  • "Do I have enough free VRAM to run a local 7B quantization model?"
    πŸ‘‰ Agent calls get_gpu_vram and inspects freeVramMB.

  • "My computer feels slow after running multiple test runs. Clean up any leftover browser sessions."
    πŸ‘‰ Agent calls clean_orphan_processes(dryRun: false).


πŸ›‘οΈ Built-in Safety Guardrails

  • Stdio Protocol Isolation: All debug and informational logs are strictly routed to stderr. stdout is exclusively reserved for JSON-RPC messages to guarantee zero transport corruption.

  • Protected System PIDs: Refuses to kill system kernel processes (PID <= 4, Windows System/Idle, Unix init/launchd).

  • Self-Preservation: Prevents suicide termination if the target PID is the MCP server process itself or its parent runner.

  • Graceful Fallbacks: If nvidia-smi or sensors are unavailable, tools return structured diagnostic JSON without crashing the server.


πŸ’» Development & Local Testing

# Clone repository
git clone https://github.com/Optimus-Prime-Blip/local-vitals-mcp.git
cd local-vitals-mcp

# Install dependencies
npm install

# Compile TypeScript
npm run build

# Run MCP server locally over stdio
npm start

πŸ“„ License

MIT Β© Arnav Yadav

Available Tools

5 tools
clean_orphan_processesB

Scans and cleans orphaned/zombie background processes commonly abandoned by AI agents (e.g. headless Playwright/Chrome instances, zombie test workers, orphaned Vite/Node daemons).

Inputs: dryRun.

get_gpu_vramA

Checks GPU health, total/used/free VRAM allocation, and utilization. Parses nvidia-smi with graceful fallback for Apple Silicon / integrated display controllers. Use before starting local LLM/CUDA workloads.

Inputs: no named parameters.

get_system_vitalsA

Returns available system RAM, CPU load percentage, thermals (if accessible), and threshold guardrails (>85% RAM, >90% CPU warnings). Use before launching heavy compilation or container builds.

Inputs: no named parameters.

inspect_portA

Finds which process PID, process name, and command line is binding a specified TCP port across Windows, macOS, and Linux. Essential for diagnosing EADDRINUSE conflicts.

Inputs: port (required).

kill_port_processA

Terminates the process currently occupying a specific TCP port to resolve EADDRINUSE errors without manual hunting. Terminate whole process tree on Windows/Linux.

Inputs: port (required), force.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: inspecting a port, killing a port's owner, sweeping orphaned processes, reading system vitals, and reading GPU/VRAM stats. The only potential overlap is between kill_port_process and clean_orphan_processes, but one is port-targeted and the other is orphan-scan-based, and the descriptions make that boundary explicit.

    Naming Consistency5/5

    All five names are snake_case with a leading verb (kill_, clean_, get_, get_, inspect_) and a clear object. The pattern is predictable and readable throughout, with no mixed conventions.

    Tool Count5/5

    Five tools is a tight, well-scoped surface for a local dev-ops diagnostics server; every tool maps to a real workflow (diagnose conflict, resolve conflict, clean up, pre-flight resource check). Nothing feels redundant or missing at the count level.

    Completeness4/5

    The core lifecycle for port conflicts and resource pre-flight checks is fully covered, including cleanup and GPU/CPU/RAM visibility. Minor gaps remain, such as disk space or a general process-list/inspect-by-name operation, which would round out the 'vitals' promise but are workable around.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      A real-time system diagnostics MCP server that gives AI agents live access to CPU, RAM, disk, network, processes, and hardware health metrics, with zero cloud dependency.
      7
      Apache 2.0
    • A
      license
      Not graded
      quality
      F
      maintenance
      Multi-machine system monitor with a built-in MCP server that enables AI agents to query health metrics, manage processes, schedule cron jobs, and run diagnostics across local and remote machines.
      133 npm
      Apache 2.0
    • F
      license
      Not graded
      quality
      D
      maintenance
      Monitors host CPU/RAM, local ports, and Docker containers, streaming live telemetry to a React dashboard over SSE. Exposes MCP tools to query system status, read environment logs, and execute remediation fixes via a local LLM agent.
      -
    • A
      license
      A
      quality
      D
      maintenance
      Provides read-only access to host system metrics (CPU, memory, disk), Docker container health/logs, and sandboxed log file analysis via MCP tools, enabling AI agents to monitor enterprise infrastructure safely.
      3
      MIT