RFC Registry/RFC-002
RFC-002agenticFinal
Anthropic Claude Tested

Model Context Protocol (MCP) Stdio JSON-RPC Stream Isolation

Enforces absolute channel isolation for stdio MCP servers: stdout is strictly reserved for JSON-RPC message framing, while all diagnostic logs MUST be directed to stderr.

Authors:Anthropic Architecture Team, AgentRules Standards Committee
Version:v1.1.0
Last Ratified:2026-03-01

RFC-2119 Invariant Mandates

The keywords “MUST”, “MUST NOT”, and “SHOULD” in this document are to be interpreted as described in BCP 14 / RFC 2119.

MUST NOTClause 1

MCP server processes communicating via StdioServerTransport MUST NOT emit any arbitrary strings or console.log outputs to process.stdout.

Engineering Rationale:Stdout is parsed as raw JSON-RPC stream by Claude Desktop and Cursor. Unframed logs corrupt the byte parser and terminate the session.
Failure Blast Radius:Immediate disconnection and client-side error: 'Failed to parse JSON-RPC message'.
MUSTClause 2

All diagnostic, telemetry, and debugging logs MUST be written exclusively to process.stderr or emitted via server.sendLoggingMessage().

Engineering Rationale:Stderr is safely piped to host client log files without disrupting the RPC transport layer.
Failure Blast Radius:Prevents diagnostic information from crashing the transport.
MUSTClause 3

Tool parameters MUST be declared using strict Zod schemas or typed Pydantic models with exhaustive descriptions.

Engineering Rationale:Ambiguous tool schemas degrade LLM tool-calling accuracy by over 40%.
Failure Blast Radius:LLM hallucinating invalid tool arguments and calling failures.

Complete RFC Specification Document

IETF Formal Markdown Format
# RFC-002: Model Context Protocol (MCP) Stdio Stream Isolation

## 1. Specification Mandate
The Model Context Protocol (MCP) allows AI agents to inspect databases, execute CLI tools, and query APIs. When operating over standard input/output (stdio), the communication channel requires rigorous stream purity.

## 2. Invariant Code Standard
```typescript
// CORRECT (Compliant with RFC-002):
process.stderr.write("[DEBUG] Fetching user records\n");

// FATAL ERROR (Violates RFC-002):
console.log("[DEBUG] Fetching user records"); // Corrupts stdio transport
```

Community Consensus Rating

Do these behavioral constraints represent the highest engineering standard for your team?

99% Consensus