[stdout-intercepted] prefix leaks into normal sf CLI stdout from mcp-provider-aura-experts and mcp-provider-lwc-experts bundles
- Dominant language
- No language data
- Stars
- 1
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
### Summary
After installing `@salesforce/mcp` , every line written to stdout by the `sf` CLI (for any command, not just the MCP server) is prefixed with `[stdout-intercepted] `. The interceptor is unconditionally installed at module load time inside the bundled `mcp-provider-aura-experts` and `mcp-provider-lwc-experts` packages, so it activates during oclif's plugin discovery for all `sf` invocations — even when the MCP server is not being started.
### Environment
- OS: Windows 11 (PowerShell 5.1, also reproduced in `cmd.exe` and `powershell -NoProfile`; not VS Code-related)
- Salesforce CLI: `@salesforce/cli` 2.128.5
- Node: bundled with sf installer (`C:\Program Files\sf\client\bin\node.exe`)
- Plugin: `@salesforce/mcp` 0.30.7 (user-installed)
- Bundled: `@salesforce/mcp-provider-aura-experts` 0.3.7
- Bundled: `@salesforce/mcp-provider-lwc-experts` 0.7.0
- Install location: `C:\Users\\AppData\Local\sf\node_modules\@salesforce\mcp`
- VS Code: 1.117.0 with Salesforce Extension Pack (Salesforce CLI Integration)
### Steps to reproduce
1. Install the plugin: `sf plugins install @salesforce/mcp`
2. Run any non-MCP `sf` command, e.g.:
```
sf plugins --core
```
### Actual output (truncated)
```
AccessibilityVisionExpert: no reviewers loaded for maturity level >= GA
SLDSExpert: no reviewers loaded for maturity level >= GA
UtamExpert: no reviewers loaded for maturity level >= GA
[stdout-intercepted] @oclif/plugin-autocomplete 3.2.45 (core)
[stdout-intercepted] @oclif/plugin-commands 4.1.45 (core)
[stdout-intercepted] @oclif/plugin-help 6.2.43 (core)
...
[stdout-intercepted] @salesforce/mcp 0.30.7
[stdout-intercepted] agent 1.32.20 (core)
[stdout-intercepted] apex 3.9.20 (core)
...
```
Note: the `*Expert: no reviewers loaded…` warnings go to stderr and are *not* prefixed; everything written to stdout is.
### Expected output
No `[stdout-intercepted]` prefix on stdout for normal CLI commands. The interceptor should only be active when the MCP server is actually running over stdio transport.
### Root cause (verified locally)
The string `stdout-intercepted` appears in two bundled provider files shipped inside the plugin:
- `…\AppData\Local\sf\node_modules\@salesforce\mcp\node_modules\@salesforce\mcp-provider-aura-experts\index.bundle.js`
- `…\AppData\Local\sf\node_modules\@salesforce\mcp\node_modules\@salesforce\mcp-provider-lwc-experts\index.bundle.js`
Verified with:
```powershell
Select-String -Path "$env:LOCALAPPDATA\sf\node_modules\@salesforce\mcp\node_modules\@salesforce\mcp-provider-*-experts\index.bundle.js" -Pattern "stdout-intercepted" -SimpleMatch
```
Both files match. The string does not exist anywhere else in the sf install (`C:\Program Files\sf\client`), in `%LOCALAPPDATA%\sf\node_modules` outside these two bundles, in global npm, in VS Code, or in any user PowerShell profile (`$PROFILE` does not exist). No `NODE_OPTIONS` or oclif/sf env vars are set.
These bundles appear to install a `process.stdout.write` wrapper at module-evaluation time. Because oclif loads every plugin's manifest/module at CLI startup, the wrapper is installed for every `sf` invocation — not only when the MCP server is started.
### Impact
- All stdout from `sf` is corrupted, breaking JSON consumers, scripts that pipe `sf … --json`, downstream tools, and CI logs.
- VS Code Salesforce Extension Pack commands that shell out to `sf` and parse its JSON/stdout are broken, including:
- **SFDX: Retrieve Source from Org / Retrieve This Source from Org**
- **SFDX: Deploy Source to Org / Deploy This Source to Org**
- **Org Browser** (fails to load metadata listings)
- Workaround today is `sf plugins uninstall @salesforce/mcp`, which removes MCP functionality entirely.
Contributor guide
Assessment
This issue has not been assessed yet.