How sandstrompl/whyreach works
whyreach is a read-only Docker connectivity diagnosis tool, exposed through a CLI and an MCP server. A request is validated and permission-checked, resolved into a source and destination, then the engine gathers Docker and network-namespace evidence, evaluates rules, and returns findings with proof and fixes. The product also supports environment inspection, standalone probes, doctor checks, and report saving. The README documents the overall workflow; sampled source and the SOURCE INDEX support the cited internal links, but some subsystem details remain unsampled.
Main entry points: engine.go Diagnosis engine · policy.go Safety policy · cli.go CLI commands · server.go MCP tools
Components 16
User interfaces
- CLI commands
internal/cli/cli.go - MCP tools
internal/mcpserver/server.go
Policy and orchestration
- Safety policy
internal/policy/policy.go - Configuration
internal/config/config.go - Diagnosis engine
internal/engine/engine.go - Target parsing
internal/target/target.go
Network evidence
- Docker metadata
internal/collect/docker/containers.go - Host network facts
internal/collect/host/host.go - Probe executors
internal/executor/executor.go - Probe container
internal/executor/probecontainer.go - DNS and TCP probes
internal/probe/dns.go
Diagnosis and results
- Evidence store and views
internal/evidence/view.go - Cause rules
internal/rules/wr007_localhost.go - Report generation
internal/report/bundles.go
Other components
- Developer or agent
- Docker Engine
Connections 19
- Developer or agent → CLI commands: runs commands
- Developer or agent → MCP tools: calls tools
- CLI commands → Safety policy: submits requests
internal/cli/cli.go - MCP tools → Safety policy: routes tool calls
internal/mcpserver/server.go - Safety policy → Configuration: uses settings
internal/policy/policy.go - Safety policy → Target parsing: parses targets
internal/policy/policy.go - Safety policy → Diagnosis engine: runs diagnosis
internal/policy/policy.go - Diagnosis engine → Docker metadata: collects metadata
- Diagnosis engine → Host network facts: collects host facts
- Diagnosis engine → Probe executors: runs checks
- Probe executors → DNS and TCP probes: executes checks
internal/executor/executor.go - Probe executors → Probe container: delegates probing
internal/executor/executor.go - Probe container → Docker Engine: creates probe container
internal/executor/probecontainer.go - Diagnosis engine → Evidence store and views: records observations
- Diagnosis engine → Cause rules: evaluates findings
internal/engine/engine.go - Cause rules → Evidence store and views: reads evidence
internal/rules/wr007_localhost.go - CLI commands → Report generation: renders reports
- MCP tools → Report generation: saves reports
internal/mcpserver/server.go - Docker metadata → Docker Engine: reads metadata