Repository avatar
Developer Tools
v0.2.3
active

spectre-mcp

io.github.bigwalkdoe/spectre-mcp

Read-only infrastructure operations MCP server for Linux hosts and Docker.

Documentation

spectre-mcp

Read-only infrastructure operations MCP server for AI assistants

License: MIT Python 3.12+ Tests MCP Compatible Glama

Spectre MCP gives models a secure, structured way to inspect and diagnose Linux hosts, Docker, systemd services, security posture, and backups — without any write or remediation capability.

MCP Registry: mcp-name: io.github.bigwalkdoe/spectre-mcp


Table of contents

Features

  • Host: CPU, memory, load, uptime, disk usage, inode exhaustion, OS/kernel info, network interfaces
  • Docker: daemon health, container inventory, health/restart counts, inspection, bounded logs, images, volumes
  • Services: systemd status, journal search, failure diagnostics
  • Security: listening ports, firewall status, SSH audit, TLS certificate expiry, baseline checks
  • Backups: status, age, destination verification, Restic repository status
  • Diagnostics: incident_diagnose, security_baseline, backup_audit, infrastructure_report

Security model

  • Read-only by default — no write or remediation operations
  • No unrestricted shell execution or arbitrary Python evaluation
  • Allowlisted commands with validated, non-shell parameters
  • Secret redaction (passwords, tokens, API keys, common patterns)
  • Path traversal prevention and safe filesystem access
  • Command timeouts and bounded output
  • Audit logging of every tool invocation
  • Permission architecture ready for future controlled remediation

Installation

git clone https://github.com/bigwalkdoe/spectre-mcp.git
cd spectre-mcp
python -m venv .venv
source .venv/bin/activate
pip install -e .

Copy the example environment file and adjust:

cp .env.example .env

Configuration

All settings are environment-based (prefix SPECTRE_):

VariableDefaultDescription
SPECTRE_READ_ONLY_MODEtrueEnforce read-only operation
SPECTRE_ALLOWED_DOCKER_RESOURCES(empty)Comma-separated allowlist
SPECTRE_ALLOWED_SYSTEMD_SERVICES(empty)Comma-separated allowlist
SPECTRE_MAX_LOG_OUTPUT_BYTES65536Output truncation limit
SPECTRE_COMMAND_TIMEOUT_SECONDS15Subprocess timeout
SPECTRE_AUDIT_LOG_PATH~/.spectre/audit.logAudit log location
SPECTRE_LOG_LEVELINFOLogging level
SPECTRE_LOG_FORMATtexttext or json
SPECTRE_METRICS_ENABLEDfalseEnable Prometheus metrics HTTP server
SPECTRE_METRICS_PORT9090Metrics port
SPECTRE_MAX_CONCURRENCY8Max concurrent tool invocations
SPECTRE_RESTIC_REPOSITORY(empty)Restic repository path
SPECTRE_BACKUP_DIRECTORIES(empty)Comma-separated backup paths
SPECTRE_TLS_CERT_PATHS(empty)Comma-separated certificate paths

Running the server

spectre-mcp

The server uses stdio transport and exposes no network port.

OpenCode configuration

{
  "mcp": {
    "spectre-mcp": {
      "type": "local",
      "command": ["spectre-mcp"],
      "environment": {
        "SPECTRE_READ_ONLY_MODE": "true"
      },
      "enabled": true
    }
  }
}

Docker deployment

Build:

docker build -t spectre-mcp .

Run over stdio:

docker run -i --rm spectre-mcp

docker-compose.yml provides a default no-port deployment. Docker socket and host filesystem mounts are not enabled by default — document and enable them only in trusted environments.

Production deployment

See docs/production.md for environment reference, Docker, and Kubernetes manifests (k8s/deployment.yaml).

Testing

pytest
python scripts/smoke_test.py

Lint and type check:

ruff check .
mypy spectre_mcp

Project structure

spectre_mcp/
├── server.py
├── config.py
├── security/
├── tools/
├── integrations/
├── models/
└── audit/

Limitations

  • Read-only MVP; remediation is not implemented
  • Some integrations require system utilities and permissions
  • Host metrics inside containers reflect the container unless host /proc is mounted

Contributing

Contributions are welcome. Please run tests, linting, and type checks before submitting a pull request.

License

Released under the MIT License.