`mcpc --json` redacts `headers` but prints `env` values in plaintext
mcpc --json redacts headers but prints env values in plaintext
mcpc --json returns the session config, and env values are emitted verbatim. The
headers field of the same object is redacted, so this looks like an omission
rather than an intentional decision.
Where
dist/cli/commands/sessions.js:171-178
const server = {
...context.serverConfig, // env passes through as-is
...(context.serverConfig?.headers && {
headers: redactHeaders(context.serverConfig.headers), // headers are masked
}),
};
dist/lib/utils.js:317-325 — redactHeaders() already exists and replaces every
header value with <redacted>. The same pattern appears in
dist/cli/commands/connect.js:44 and :180.
Impact
A session configured with a provider key in env has that value printed every time
the config is dumped for scripting, so it reaches logs, CI output and captured
tool results. This is the same class of exposure your own documentation already
guards against:
CHANGELOG.md:46— a baremcpc connectno longer lets config files found in the current directory read environment variables;README.md §245-250— why${VAR}in a checked-out.mcp.jsonis dangerous.
Masking headers but not env is inconsistent with that posture.
Minimal reproduction
// probe.json
{ "mcpServers": { "demo": { "command": "node", "args": ["-e", "0"],
"env": { "DEMO_KEY": "demo-value-not-a-real-secret" } } } }
mcpc connect ./probe.json
mcpc --json | grep -c demo-value-not-a-real-secret # prints 1; expected 0
Suggestion
Apply the same treatment to env: either redact values by variable name
(KEY/TOKEN/SECRET/PASS/APIKEY), or redact all of them exactly like
headers does, optionally behind an explicit --show-secrets flag for the cases
where a real value is needed.
Version
0.7.0 (latest stable; 0.8.0-beta.0 also present). Node v24.21.0, Windows.
We worked around this on our side with a wrapper at our boundary — we did not patch
node_modules, to stay aligned with upstream. Happy to test a patch if useful.
Thanks for the report, looking into it
Thanks, this is a real gap in 0.7.0. It was fixed in #431 (refs #341): stdio env values are now stored in the OS keychain and redacted to <redacted> in mcpc --json, mcpc @session, sessions.json, the bridge's command line and logs, the same as headers.
The fix is in 0.8.0-beta.0 (npm i -g @apify/mcpc@beta) and will be in the next stable release. Note that mcpc connect <file> now needs --stdio to include stdio entries, so your repro command will ask for that flag.
Leaving this open until 0.8.0 ships.