经 AI Skill Hub 精选评估,MCP工具:捕获MCP stdio服务器的stdout污染和握手失败 获评「推荐使用」。这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 7.5 分,适合有一定技术背景的用户使用。
MCP工具:捕获MCP stdio服务器的stdout污染和握手失败 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
MCP工具:捕获MCP stdio服务器的stdout污染和握手失败 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/1Utkarsh1/mcp-stdio-guard
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"mcp-----mcp-stdio----stdout-------": {
"command": "npx",
"args": ["-y", "mcp-stdio-guard"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 MCP工具:捕获MCP stdio服务器的stdout污染和握手失败 执行以下任务... Claude: [自动调用 MCP工具:捕获MCP stdio服务器的stdout污染和握手失败 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"mcp_____mcp_stdio____stdout_______": {
"command": "npx",
"args": ["-y", "mcp-stdio-guard"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
<p align="center"> <img src="assets/logo.svg" alt="mcp-stdio-guard logo" width="120" /> </p>
<p align="center"> Catch stdout pollution and handshake failures in MCP stdio servers before clients do. </p>
<p align="center"> <a href="https://github.com/1Utkarsh1/mcp-stdio-guard/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/1Utkarsh1/mcp-stdio-guard/actions/workflows/ci.yml/badge.svg" /></a> <a href="https://www.npmjs.com/package/mcp-stdio-guard"><img alt="npm" src="https://img.shields.io/npm/v/mcp-stdio-guard?color=0b6bcb" /></a> <a href="https://badge.socket.dev/npm/package/mcp-stdio-guard/1.0.0"><img alt="Socket" src="https://badge.socket.dev/npm/package/mcp-stdio-guard/1.0.0" /></a> <img alt="runtime dependencies" src="https://img.shields.io/badge/runtime%20deps-0-1f8f4c" /> <img alt="node" src="https://img.shields.io/badge/node-%3E%3D18-2f855a" /> <a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-111827" /></a> </p>
<p align="center"> <img src="assets/hero.svg" alt="mcp-stdio-guard hero showing a clean MCP stdio pipeline" width="100%" /> </p>
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, probes advertised tools, resources, and prompts list capabilities, optionally sends a real post-initialize MCP request such as tools/list, validates every stdout frame, checks returned tool metadata, and scans source for risky stdout calls.
From npm:
npx mcp-stdio-guard -- node ./server.js
From this repo:
git clone https://github.com/1Utkarsh1/mcp-stdio-guard.git
cd mcp-stdio-guard
npm ci
npm test
Run your MCP server behind the guard:
mcp-stdio-guard -- node ./server.js
Use a deterministic profile for common workflows:
mcp-stdio-guard --profile registry --json -- node ./server.js
Use a config file for registry runs that need environment names, request lists, or explicitly safe tool calls:
mcp-stdio-guard --config mcp-stdio-guard.config.json
Exercise a real MCP operation after initialization:
mcp-stdio-guard --request tools/list -- node ./server.js
Scan source for obvious stdout writes too. Findings are warnings unless --fail-on-static is set:
mcp-stdio-guard --scan src --fail-on-static --request tools/list -- node ./server.js
JSON output for CI:
mcp-stdio-guard --json --request tools/list -- node ./server.js
Repeat the same guard to catch cold/warm startup behavior:
mcp-stdio-guard --repeat 2 --request tools/list -- node ./server.js
Config files let registries run repeatable checks without hiding what was executed. The file is JSON, and CLI flags still override matching config defaults. Parsing happens before the server process starts, so invalid config does not launch the target command.
Supported fields:
| Field | Meaning |
|---|---|
command | command as either ["node", "./server.js"] or "node" with args |
args | arguments used only when command is a string |
cwd | working directory, resolved relative to the config file |
env | environment variables to pass; values are redacted in JSON output |
profile, protocol, timeoutMs, repeat, json | same meaning as CLI options |
maxStdoutBytes, maxStdoutLineBytes, maxStderrBytes | byte limits for untrusted child output |
scan or scanPath | source scan path, resolved relative to the config file |
failOnStatic | make static scan findings fail |
request | one explicit post-initialize request: { "method": "tools/list" } |
requests | list of explicit post-initialize requests |
safeToolCalls | opt-in tools/call recipes; no tool is called unless listed here or explicitly requested |
adversarialProbes | opt-in built-in probes as true, "all", "none", or a list of probe names |
adversarialToolCalls | opt-in invalid-argument tools/call probes for configured safe tools |
Example:
{
"profile": "registry",
"command": ["node", "./server.js"],
"cwd": ".",
"json": true,
"env": {
"API_TOKEN": "set-in-runner"
},
"requests": [
{ "method": "tools/list" }
],
"adversarialProbes": ["invalid-method", "notification"],
"safeToolCalls": [
{ "name": "echo", "arguments": { "text": "hello" } }
],
"adversarialToolCalls": [
{ "name": "echo", "arguments": { "unexpected": true } }
]
}
The guard does not discover and call arbitrary tools from tools/list. Tool execution only happens through an explicit safeToolCalls entry or an explicit tools/call request you provide.
Adversarial probes are off by default because they intentionally send unusual inputs. Built-in probes check that unknown methods return structured errors, invalid params return structured errors, notifications do not receive responses, and malformed JSON does not crash the process. adversarialToolCalls is separate because it calls a named tool with intentionally invalid arguments; only use it for tools you control and consider safe/idempotent.
该工具提供了一个方便的解决方案来捕获MCP stdio服务器的stdout污染和握手失败,提高了开发效率和bug查找速度,但仍需要进一步优化和完善
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
AI Skill Hub 点评:MCP工具:捕获MCP stdio服务器的stdout污染和握手失败 的核心功能完整,质量良好。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | mcp-stdio-guard |
| Topics | clidebuggingdeveloper-toolsjson-rpcjavascript |
| GitHub | https://github.com/1Utkarsh1/mcp-stdio-guard |
| License | MIT |
| 语言 | JavaScript |
收录时间:2026-05-24 · 更新时间:2026-05-24 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端