spectre-mcp
Read-only infrastructure operations MCP server for AI assistants
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.
Table of contents
- Features
- Security model
- Installation
- Configuration
- Running the server
- OpenCode configuration
- Docker deployment
- Testing
- Project structure
- Limitations
- Contributing
- License
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_):
| Variable | Default | Description |
|---|---|---|
SPECTRE_READ_ONLY_MODE |
true |
Enforce read-only operation |
SPECTRE_ALLOWED_DOCKER_RESOURCES |
(empty) | Comma-separated allowlist |
SPECTRE_ALLOWED_SYSTEMD_SERVICES |
(empty) | Comma-separated allowlist |
SPECTRE_MAX_LOG_OUTPUT_BYTES |
65536 |
Output truncation limit |
SPECTRE_COMMAND_TIMEOUT_SECONDS |
15 |
Subprocess timeout |
SPECTRE_AUDIT_LOG_PATH |
~/.spectre/audit.log |
Audit log location |
SPECTRE_LOG_LEVEL |
INFO |
Logging level |
SPECTRE_LOG_FORMAT |
text |
text or json |
SPECTRE_METRICS_ENABLED |
false |
Enable Prometheus metrics HTTP server |
SPECTRE_METRICS_PORT |
9090 |
Metrics port |
SPECTRE_MAX_CONCURRENCY |
8 |
Max 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
/procis mounted
Contributing
Contributions are welcome. Please run tests, linting, and type checks before submitting a pull request.
License
Released under the MIT License.
Metadata
Release files for spectre-infra-mcp 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spectre_infra_mcp-0.2.2.tar.gz | 26.7 kB | With provenance | Details for spectre_infra_mcp-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spectre_infra_mcp-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for spectre_infra_mcp-0.2.2-py3-none-any.whl |
Total release size: 60.1 kB
Release files / spectre_infra_mcp-0.2.2.tar.gz
| Download URL | spectre_infra_mcp-0.2.2.tar.gz |
|---|---|
| Size | 26.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c27f4cf69dbf20f677b730328f6fd2ead30ddc78f952be89e4c33888b29b381c
|
|
BLAKE2b-256 checksum How to use checksums |
8645d229beaec7467a288c5d52bc4b1a1558265bb6d7e4282258cc75f5de42d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / spectre_infra_mcp-0.2.2-py3-none-any.whl
| Download URL | spectre_infra_mcp-0.2.2-py3-none-any.whl |
|---|---|
| Size | 33.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02deb3dce635d92b6afff92a45dedc38068a6dc42a88665d693521f24b3bf19a
|
|
BLAKE2b-256 checksum How to use checksums |
24514438f9d3bd4da50c8dc661f82a125f8ede6997501a9097e014776f5f3070
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logSecurity for spectre-infra-mcp 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for spectre_infra_mcp-0.2.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.