Expand description
The argv-level entry point every agent’s plugin binary dispatches into.
The plugin binaries (re-ghidra-cc-mcp today; the agy and qwen ports later)
own nothing but a main that hands its argv here. Flag parsing, config
precedence, log initialization and the serve loop all live in this crate, so
three front ends cannot drift into three subtly different config contracts.
product is the invoked binary’s own name. It appears only in the usage
banner and error prefixes — never in an env var or a path — so each agent’s
diagnostics name the binary the user actually ran.
Functions§
- boot_
smoke 🔒 - Dev-only: boot the worker and drive attach + decompile end to end, logging
to stderr. Needs a real Ghidra install and the
GHIDRA_MCP_FIXTURE_*vars. - dispatch
- Dispatch
args(everything after argv[0]) and return the process exit code. - env 🔒
- env_
or_ 🔒none - layer 🔒
- The precedence rule itself, with the environment injected so it is testable without mutating the process environment (which races under a parallel test runner).
- layered_
config - Layer CLI flags over the environment over the agent’s settings file.
- mk 🔒
- parse_
flags 🔒 - Parse
--key valueand--key=valueinto a map. Non-flag tokens are skipped; unrecognized flags are collected rather than rejected, so they simply match nopick(..)above (forward compatibility). - run_
serve 🔒 - Layer config (CLI > env > settings file), initialize file logging, and serve.
Err(code)carries the exit code; the reason is reported on STDERR, never stdout — stdout is the MCP channel. - usage 🔒
- Version + usage, on stderr. Never stdout: an agent that launched this binary as an MCP server is reading stdout as JSON-RPC, and a usage banner there looks like a protocol violation rather than a mistyped command.