second-desk-citadel
# Second Desk Citadel
The combined security suite: check a tool before you install it, audit the site it runs beside, pin the tool so a later change cannot slip past quietly, and recheck on a rhythm so you watch the findings close. One MCP server, eighteen tools, one verdict.
I built two security servers before this one. Trust checks a tool at the door: it verifies sealed capsules, audits MCP config files, and scans downloaded packages before anything runs. Bulwark audits a live site for the weaknesses AI attack agents walk through, and it carries a detection pack and a canary kit. Every operator I talked to needed both halves, plus two things neither server had. A tool that passed on Monday could be a different tool on Friday, and nothing noticed. And a scan is a photograph, where what you want is a watch. Citadel is the fusion: both engines in one server, a pinning layer that turns a checked folder into a watched folder, and a recheck layer that diffs every new assessment against the last one and names what got fixed, what is new, and what is still open.
The numbers up front, all of them from the test record in this repo: eighteen tools in one server. Seventy seven tests across four suites, all passing: the Trust engine suite (16), the Bulwark server suite (38), the canary suite (11), and the Citadel suite for the new layers (12). Against a throwaway fixture site with planted weaknesses and a fixture package with planted problems, one full_assessment call returned eighteen findings across the install gate and the surface layers, and a string search over the whole output confirmed no planted secret value appears anywhere in it.
## Tools
The install gate, from Trust:
| Tool | What it does |
| --- | --- |
| capsule_inspect | Reads a sealed capsule's self description: identity, purpose, capabilities, provenance, proof checks, file inventory. Executes nothing. |
| capsule_verify | Recomputes a capsule's hashes and manifest digest and, in full mode, re runs its bundled proof checks in separate processes. Verdict: VERIFIED, FAILED, or INVALID. |
| mcp_config_audit | Audits an MCP client config: commands that do not resolve, missing paths, plain text secrets named by key and never shown, shell entries, whole drive access. |
| package_audit | Scans a folder before install: executables, install scripts, network code with file and line, secret shaped strings by kind and location. |
| site_security_check | One light pass over a site you own: security headers, TLS facts, version signals, exposure path status codes. |
| trust_report | The package audit and the capsule checks for one folder, as a single verdict. |
The surface audit, from Bulwark:
| Tool | What it does |
| --- | --- |
| secret_scan | Finds hardcoded secrets in a site's public code, values always masked. |
| sourcemap_check | Reports whether source maps are publicly reachable. |
| api_surface_check | Inventories common API and exposure routes and names the ones answering with no authentication. |
| header_check | Reports security headers present and missing, plus version disclosure. |
| token_config_check | Inspects a JWT or an auth configuration for dangerous settings. Inspection only; nothing is verified or sent anywhere. |
| console_exposure_check | Looks for an exposed agent console on the target address and the common console ports. |
| defense_report | Every web check in one report, fix list ordered by the weakness list the FBI published in FLASH alert 20261113-001. |
Pin and watch, new in Citadel:
| Tool | What it does |
| --- | --- |
| pin_snapshot | Hashes every file in a folder tree into a manifest you keep. Set the CITADEL_PIN_KEY environment variable and the manifest also carries an HMAC signature over its file table. |
| pin_verify | Compares the tree against the manifest and names every added, removed, and changed file, after checking the manifest against its own digests. |
Canary status and the continuous layers, new in Citadel:
| Tool | What it does |
| --- | --- |
| canary_status | Reads a Bulwark canary alert log and folds the touches: how many, which decoys, when, from where. |
| recheck | Runs the combined assessment, saves the report with a timestamp, and diffs against the previous report for the same target: fixed, new, and still open, each one named. |
| full_assessment | The master tool. Give it a folder, a site, a config, or any combination, plus an optional pin manifest and canary log, and it runs every applicable layer and ends in one combined verdict. |
The repo also carries the Bulwark detection pack (six Sigma rules plus the same hunts as Splunk, Elastic, and grep queries, in detection/) and the canary kit (decoy generator, listener and log scanner, and a planting guide, in canary/), plus the Bulwark field guide in GUIDE-BULWARK.md.
## Setup
You need Python on the machine. I test on Python 3.12. The server is Python standard library only: there is nothing to install, no account, and no key.
1. Point your MCP client at the server:
```json
{
"mcpServers": {
"citadel": {
"command": "python3",
"args": ["/path/to/citadel/mcp_server.py"]
}
}
}
```
2. Run the install gate on anything new: package_audit on the folder, mcp_config_audit on the config that will run it.
3. Pin what passed: pin_snapshot on the folder. Keep the manifest somewhere the tool itself cannot rewrite.
4. Put the target on a recheck rhythm: call recheck with the same folder, site, and reports folder each time, and read the diff.
If you would rather run it in a container, the Dockerfile in this repo builds the same stdio server.
## Examples
One full_assessment call against my planted weakness fixtures (a package with a secret shaped string and an install script, and a local site with a fake key in its code, an open route, an exposed source map, and no security headers) returned this verdict:
```
verdict: Concerns found. Read the findings before you rely on this target.
layers run: install_gate, surface
findings: 18 total, 2 high, 9 medium, 7 low
first surface findings:
[high, secret_scan] Possible hardcoded secret in the site code
[high, console_exposure_check] Agent console appears exposed
[medium, header_check] Content Security Policy header missing
```
And the recheck diff after I fixed exactly one weakness, the secret shaped strings in the fixture package:
```
fixed (2):
[high] Secret shaped string: GitHub token in secret.py line 7
[high] Secret shaped string: secret assigned in code in secret.py line 8
new (0)
still open (5), including:
[medium] Install or setup script: setup.py
[medium] Code opens network connections: net.py line 3 (socket module)
```
## Limits
Know the limits before you rely on it. Every check here is read only, so a clear pass means the checks that ran found nothing; it is not a promise that a target is safe, and no honest tool can make that promise. The package audit matches the patterns it knows. The surface checks use fixed route, port, and marker lists, so a renamed console or an unusual layout can slip past, and the Sigma rules are validated as structure and syntax and have not been run inside a live SIEM. Pinning proves a tree matches the manifest you kept; it cannot help if the manifest itself was replaced by someone who also holds your signing key, which is why the manifest belongs somewhere the pinned tool cannot reach. Full mode capsule verification runs a capsule's own proof checks in separate processes with a scrubbed environment, which is process isolation, not a sandbox; use static mode for a capsule from a source you do not trust yet. The server speaks stdio only. And the whole suite belongs on systems you own or are authorized to test. That is what it is built for, and it is the only way I sell it.
## License
MIT. The code is open; what a purchase buys is the finished package, the setup help, and the support.
TDQS
Scored across 18 tools
Most individual checks map to a distinct artifact (capsule, folder, config, token, header, sourcemap, API routes, console exposure), but site_security_check is described as a light superset of header_check plus api_surface_check plus exposure-path probing, forcing a guess between overlapping web checks. Four aggregation tools (trust_report, defense_report, recheck, full_assessment) also overlap heavily, and only the verbose descriptions keep them separable.
Nearly all names are snake_case with a subject_modifier plus action shape (package_audit, secret_scan, congruence: header_check, capsule_verify), which reads predictably. Minor deviations: pin_snapshot/pin_verify use a verb-first reading, and recheck is a bare verb while full_assessment is an adjective_noun outlier.
At 18 tools the surface is on the heavy side for what is essentially an audit suite, and the weight comes largely from redundant aggregators layered over the same underlying checks. Each individual check earns its place, but trust_report/defense_report/recheck/full_assessment largely recombine the same primitives into four separate entry points.
Coverage is broad: capsule inspect/verify, folder and config audits, six web checks, token config inspection, pin snapshot/verify, canary status, plus orchestration with timestamped reports and fix/new/still-open diffs. Gaps are modest but real: capsules can be verified but never built, findings cannot be remediated or annotated, and only the combined assessment supports diffing against a prior baseline.