MCP-stdio-guard – MCP stdio sanity checks
MCP-stdio-guard is a tool designed to prevent stdout pollution and handshake failures in MCP stdio servers. It performs checks to ensure that servers adhere to the required JSON-RPC messaging protocol and helps identify risky stdout calls. The tool can be installed via npm and offers various commands for scanning and validating server operations.
- ▪MCP-stdio-guard helps catch stdout pollution and handshake failures in MCP stdio servers.
- ▪The tool validates stdout frames and scans source code for risky stdout calls.
- ▪It can be installed using npm and provides commands for testing and scanning server behavior.
Opening excerpt (first ~120 words) tap to expand
mcp-stdio-guard Catch stdout pollution and handshake failures in MCP stdio servers before clients do. MCP stdio servers use stdout as their protocol channel. Debug text, banners, progress logs, console.log, Python print, or any other stray stdout output can corrupt the stream and make clients fail in confusing ways. mcp-stdio-guard starts your server, performs a real MCP initialize handshake, optionally sends a real post-initialize MCP request such as tools/list, validates every stdout frame, and scans source for risky stdout calls. Why This Exists The latest MCP docs say stdio servers must send JSON-RPC messages on stdout, may log to stderr, and must complete the initialize then notifications/initialized lifecycle before normal operation. That is easy to get wrong in real servers.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at GitHub.