5.3 Model Context Protocol (MCP) Architecture & Transports

Key Takeaways

  • MCP standardizes capability discovery and interaction across supporting clients; a direct API adapter may be simpler for a single known workflow.

  • Tools are model-oriented actions, Resources are application-oriented URI-addressed context, and Prompts are user-oriented templates; host UX and supported capabilities vary.

  • stdio is subprocess-based; Streamable HTTP supports remote servers. The July 2026 MCP revision uses stateless requests, while older revisions may use per-connection sessions.

  • For protected HTTP servers, validate intended-audience OAuth access tokens and server-side permissions per request; use approved local configuration and keep credentials out of Git.

  • Distinguish JSON-RPC protocol errors from tool execution errors using isError; choose separate task-oriented coordination for long-running peer workflows when appropriate.

Last updated: December 2026

Model Context Protocol (MCP) Architecture & Transports

The Model Context Protocol (MCP) is an open protocol using JSON-RPC 2.0 messages to define how AI hosts (such as Claude Code, Claude Desktop, or custom Claude Agent SDK services) discover and interact with external context servers. Architecting MCP in the enterprise requires knowing when to adopt it, how to model its three primitives, which transport and protocol revision to support, and where authorization and fault handling occur. An MCP host is the LLM application; its clients connect to servers that expose capabilities.

When to Use MCP vs. Direct REST APIs or CLIs

MCP is not mandatory for every integration. Introducing an MCP server adds a protocol boundary, lifecycle management, and serialization hop.

CriterionMCP ServerDirect REST AdapterLocal CLI Wrapper
Primary AdvantageStandardized discovery (tools/list, resources/list) reusable across many AI clientsA direct application-controlled path, without the MCP layerFast local developer scripting via Bash/terminal
Client ReuseHigh—one Jira or Postgres MCP server serves Claude Code, Agent SDK apps, and IDE copilotsDepends on reused adapters and published API contractsMedium—limited to environments with shell execution
Enterprise AuthProtected HTTP deployments use MCP authorization over TLSApplication-specific authentication/authorization, e.g. OAuth or mTLSRelies on local user shell credentials
Best FitShared organizational connectors, multi-client platforms, cataloged docs/schemasKnown capability in a bounded workflowSingle-developer local utilities and build scripts

Choose MCP when multiple engineering teams or agent surfaces consume the same capability. Choose a thin direct REST adapter inside your orchestrator when building a single bespoke workflow where dynamic cross-client discovery offers no benefit.


MCP Primitives: Tools, Resources, and Prompts

A frequent design mistake is forcing every enterprise capability into MCP Tools. MCP defines three distinct control models:

  1. Tools (Model-Controlled): Executable functions exposed via tools/list and invoked via tools/call. The model may request a call, with the host and execution layer enforcing consent and permissions (e.g., search_incidents, create_jira_ticket). Because tools carry execution cost and potential side effects, apply strict input schemas and RBAC validation.
  2. Resources (Application/Client-Controlled): Read-only, URI-addressed data sources (postgres://prod-replica/orders/schema, docs://runbooks/payments-v2) discovered via resources/list and fetched via resources/read. The application decides how to incorporate them, which can include user selection or model-informed choices. A resource read still requires appropriate access rights.
  3. Prompts (User-Controlled): Parameterized, reusable workflow templates (prompts/list, prompts/get) designed for user selection, for example a postmortem review command in a supporting host to standardize team instructions and attach relevant resources.

The primitives describe interaction models, not mandatory UI behavior. Client capabilities vary: for example, Anthropic’s direct MCP connector on the Messages API supports remote tool calls, not the entire Resources/Prompts feature set. Use an appropriate MCP client in the application if those capabilities are needed. The connector’s tool/transport and data-retention eligibility differs from custom client-side integration.

Transports: stdio vs. Streamable HTTP

MCP supports two primary production transports, each suited to a distinct trust and scaling model:

  • stdio: A client launches a server subprocess and exchanges newline-delimited JSON-RPC through standard input/output. Diagnostics use stderr, never corrupting stdout framing. It suits local process integrations and can also run in isolated application workers; it is not a shared remote HTTP endpoint. Use scoped process permissions and appropriate environment credentials.
  • Streamable HTTP: Replaced the old separate HTTP+SSE transport starting in protocol revision 2025-03-26. It uses one HTTP endpoint path, with JSON or optional SSE responses. In the older 2025-03-26 through 2025-11-25 versions, servers could establish an MCP session via a session-ID header and support standalone event streams. In the current 2026-07-28 specification, requests are stateless and self-contained with per-request metadata and capabilities. Responses can be request-scoped SSE, but the earlier session-ID, standalone GET SSE and resume mechanism are no longer part of that revision. Negotiate compatibility with the actual clients; do not assume all servers implement the latest revision.

For a protected HTTP deployment use TLS, OAuth-based authorization consistent with the negotiated specification, and independent application resource checks. The current MCP authorization specification is based on OAuth 2.1 and related RFCs, including Protected Resource Metadata (RFC 9728). Validate every request's access token for its intended resource, expiry, privileges and applicable caller identity. Return an appropriate authentication/authorization failure for invalid or insufficient credentials, and do not reuse a token intended for another service. A private network alone is not sufficient for multi-user document access policy.

Worked Enterprise MCP Topology

Consider a financial enterprise connecting GitHub Enterprise, ServiceNow, and an internal Snowflake catalog across 600 engineers using Claude Code and an internal Agent SDK triage service. Rather than embedding Snowflake credentials in each developer laptop or duplicating custom REST glue inside the triage service, the platform team deploys remote protected Streamable HTTP MCP servers compatible with the actual host versions. Static warehouse schemas load via resources/read from snowflake://analytics/schemas, standardized incident templates are retrieved by supporting clients via prompts/get, and live queries execute as scoped tools/call operations—with the same server-side authorization and auditing regardless of which supported client is used.


Configuration Hygiene, Error Propagation & Agent Boundaries

.mcp.json vs. ~/.claude.json

  • Project .mcp.json: Team-shared project-scoped configuration in Claude Code. Review server definitions before trusting or running them; unattended runs may load them without an interactive prompt. Never hardcode API keys or tokens in .mcp.json; use environment-variable expansion such as ${GITHUB_MCP_TOKEN} or ${MCP_SERVER_URL} so runtime secrets resolve from each environment's secret store.
  • User ~/.claude.json: Stores both local project-only and user-wide private server configurations. Keep credentials in an appropriate secure store and avoid model-context exposure. Local scope normally outranks project and user scope; managed controls may take precedence.

Structured isError: true Propagation

MCP distinguishes transport-level JSON-RPC errors (such as method-not-found or invalid-params errors) from domain tool execution failures. When a downstream API rejects a query or rate-limits a call, the MCP server should return a valid tool execution result with isError: true and sanitized recovery context (for example, {"error": "RATE_LIMITED", "retryable": true, "retry_after_sec": 15}). Protocol/transport failure and domain failure are distinct. In the 2026-07-28 revision, a completed tool result includes resultType: complete. Do not turn an upstream execution failure into a misleading empty successful result.

Agent-to-Agent Boundaries vs. MCP

Use MCP to connect an agent to deterministic tools and structured data sources. When an architecture requires autonomous peer agents—each maintaining independent reasoning loops, private context windows, and multi-minute delegation—choose a task-oriented handoff with explicit inputs, allowed actions, completion status, ownership and timeout policy, rather than assuming a synchronous call can wait indefinitely. The current MCP specification also offers an optional Tasks extension for asynchronous operations if both sides support it. Separate the decision about agent delegation from the connector protocol: MCP does not itself define the overall model reasoning or orchestration policy.

Primary references

Loading diagram...
Enterprise MCP Client-Server Request Flow with OAuth/RBAC and Structured Error Handling
Test Your Knowledge

An engineering team is building an MCP server with a host supporting all three server primitives for their analytics data warehouse. Agents frequently need to inspect 40 table schemas as reference context before writing SQL, and developers want standardized slash-command workflows for weekly anomaly reports. How should these capabilities be modeled across MCP primitives?

A

Model everything as MCP Tools so Claude invokes get_schema_1 through get_schema_40 at runtime

B

Expose table schemas as MCP Prompts and anomaly workflows as MCP Resources

C

Expose the table schemas as URI-addressed MCP Resources controlled by the host, anomaly templates as user-invoked MCP Prompts, and SQL execution as an MCP Tool

D

Embed all 40 table schemas inside .mcp.json environment variables

Test Your Knowledge

An organization plans to deploy a shared internal Knowledge Base MCP server in Kubernetes to serve 400 employees using Claude Code and an internal web portal. Each employee must only retrieve documents permitted by their corporate groups. Which transport and authentication design is recommended?

A

Unauthenticated HTTP POST behind a VPN relying on system prompt group filtering

B

Local stdio transport shared over an NFS mount across all user workstations

C

Legacy dual-endpoint SSE transport with a single static shared API key in .mcp.json

D

Streamable HTTP transport over TLS with OAuth 2.1 bearer tokens validated per request

Test Your Knowledge

A platform engineer wants every developer cloning a repository to receive the team's GitHub and Sentry MCP server configurations automatically without leaking individual API tokens into Git. How should configuration files be structured?

A

Commit server URLs and commands in project .mcp.json referencing environment variables like ${GITHUB_MCP_TOKEN}, keeping personal overrides out of Git in ~/.claude.json

B

Commit plain-text developer tokens inside project .mcp.json and rely on a pre-commit reminder

C

Require every developer to copy-paste raw JSON into system prompts manually

D

Store team-wide shared infrastructure endpoints inside a single administrator's ~/.claude.json

Test Your Knowledge

An MCP server calls an external CRM API and receives an HTTP 429 rate-limit response with a 12-second Retry-After header. How should the MCP server communicate this failure back to the Claude host?

A

Terminate the server process with exit code 1 to reset the transport

B

Return a valid MCP tool execution result with isError: true and sanitized retry guidance, preserving the protocol response.

C

Return an empty array [] with isError: false so Claude assumes zero CRM records exist

D

Wait silently for 120 seconds without responding until the host drops the TCP socket

Sections you finish are checked off in the contents.