Enterprise·
intermediate
·11 min read·Nov 19, 2026·Updated Nov 24, 2026
·Independent maintainer·Verification Charter

How to Benchmark MCP Transports: stdio vs Streamable HTTP

A reproducible harness for measuring MCP transport latency on your own hardware, plus a method for costing your own deployment. No results we cannot reproduce.

MCPbenchmarksperformancelatencystdioStreamable HTTParchitectureCodex
Interactive Tool
1-Click Export

Generate & Validate Multi-Client MCP Config

One-click export with environment variables & path locators for Claude Desktop, Cursor, Windsurf, and OpenAI Codex CLI.

Open in Generator

How to Benchmark MCP Transports: stdio vs Streamable HTTP

Choosing between a local process (stdio) and a remote transport (Streamable HTTP) affects latency, concurrency, and infrastructure cost. The honest answer to "which is faster" is that it depends on your hardware, your tool workload, and your network — so this guide does not publish latency or cost figures. Instead it gives you a harness you can run against your own servers, and a method for recording and interpreting the results.

We previously published articles with precise-looking benchmark tables that we had not actually measured. Those numbers were wrong and have been removed. If you find an old copy of them elsewhere, do not cite it.

What actually changed between SSE and Streamable HTTP

In the older MCP remote transport, a client opened a long-lived GET /sse stream, waited for an event: endpoint frame containing a session-specific URI, and then issued a separate POST to the session-specific message endpoint (for example /messages?sessionId=...) for every JSON-RPC call while the response arrived back on the original stream. That is two connections to establish and maintain per session.

Streamable HTTP collapses this into a single /mcp endpoint. In the current revision (2026-07-28) there is no initialize handshake and no Mcp-Session-Id header: each POST /mcp carries its protocol version and client capabilities in params._meta (mirrored into the MCP-Protocol-Version, Mcp-Method, and Mcp-Name headers), and the response is application/json for unary calls or a request-scoped text/event-stream when the server streams progress frames. The initialize / Mcp-Session-Id exchange in the diagram below is the legacy Streamable HTTP shape (2025-03-26 through 2025-11-25), shown only for readers maintaining older clients (MCP changelog (opens in a new tab)).

diagram
Streamable HTTP Server (/mcp)MCP Client (Codex / Claude)Streamable HTTP Server (/mcp)MCP Client (Codex / Claude)Legacy Streamable HTTP (2025-03-26..2025-11-25): one endpoint + session headerPOST /mcp (initialize JSON-RPC)1200 OK (Mcp-Session-Id + InitializeResult)2POST /mcp (notifications/initialized + Mcp-Session-Id)3202 Accepted4POST /mcp (tools/call: query_db)5200 OK (application/json or text/event-stream)6

For a 2026-07-28 server, replace the first two exchanges with a single POST /mcp whose params._meta carries io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientInfo, and io.modelcontextprotocol/clientCapabilities plus the mirrored request headers; there is no session header to reuse and no notifications/initialized frame.

That structural difference is the thing worth understanding. The exact millisecond advantage on your setup is something you have to measure.

A harness you can adapt

The following module exports a runMcpBenchmark() function that connects to either a local stdio server or a remote Streamable HTTP server, warms up the runtime, then records per-call latency and computes percentiles. Call it from your own script with the options you want; the file itself has no CLI entry point. It measures framing and transport overhead only when the tool you call does no downstream work — pick a trivial tool such as a ping or a cached lookup.

This example imports the legacy v1 SDK, whose client performs an initialize handshake and uses Mcp-Session-Id; it can only benchmark legacy (2025-era) servers, not the stateless 2026-07-28 shape described above.

typescript
// benchmark-runner-2026.ts
// Import runMcpBenchmark from your own runner script; this file defines no CLI.
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';

interface BenchmarkOptions {
  mode: 'stdio' | 'streamable-http';
  command?: string;
  args?: string[];
  url?: string;
  toolName: string;
  toolArgs: Record<string, unknown>;
  warmupIterations: number;
  measuredIterations: number;
}

interface BenchmarkSummary {
  mode: string;
  totalCalls: number;
  totalDurationMs: number;
  requestsPerSecond: number;
  p50Ms: number;
  p90Ms: number;
  p99Ms: number;
  heapUsedMb: number;
}

function computePercentile(samples: number[], percentile: number): number {
  if (samples.length === 0) return 0;
  const sorted = [...samples].sort((a, b) => a - b);
  const idx = Math.min(sorted.length - 1, Math.max(0, Math.ceil((percentile / 100) * sorted.length) - 1));
  return Number(sorted[idx].toFixed(2));
}

export async function runMcpBenchmark(opts: BenchmarkOptions): Promise<BenchmarkSummary> {
  const transport =
    opts.mode === 'stdio'
      ? new StdioClientTransport({
          command: opts.command || 'npx',
          args: opts.args || [],
        })
      : new StreamableHTTPClientTransport(new URL(opts.url || 'http://127.0.0.1:8788/mcp'));

  const client = new Client(
    { name: 'mcp-codex-bench-2026', version: '2.0.0' },
    { capabilities: {} }
  );

  const connectStart = performance.now();
  await client.connect(transport);
  const connectSetupMs = performance.now() - connectStart;
  console.error(`[Info] Established ${opts.mode} transport in ${connectSetupMs.toFixed(2)} ms`);

  // Warm up so V8 JIT and connection pools are stable before measuring.
  for (let i = 0; i < opts.warmupIterations; i++) {
    await client.callTool({ name: opts.toolName, arguments: opts.toolArgs });
  }

  const samples: number[] = [];
  const suiteStart = performance.now();

  for (let i = 0; i < opts.measuredIterations; i++) {
    const t0 = performance.now();
    await client.callTool({ name: opts.toolName, arguments: opts.toolArgs });
    samples.push(performance.now() - t0);
  }

  const totalDurationMs = performance.now() - suiteStart;
  const heapUsedMb = Number((process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2));

  await client.close();

  return {
    mode: opts.mode,
    totalCalls: opts.measuredIterations,
    totalDurationMs: Number(totalDurationMs.toFixed(2)),
    requestsPerSecond: Number(((opts.measuredIterations / totalDurationMs) * 1000).toFixed(1)),
    p50Ms: computePercentile(samples, 50),
    p90Ms: computePercentile(samples, 90),
    p99Ms: computePercentile(samples, 99),
    heapUsedMb,
  };
}
bash
npm install @modelcontextprotocol/sdk tsx
# Then call runMcpBenchmark(...) from your own runner script.

Record your own results

Copy this table into your notes and fill it from your own run. Include the hardware and software details — without them the numbers are not comparable to anyone else's.

FieldYour measurement
Date
CPU / RAM / OS
Node.js version
SDK version
Transport under test
Tool and arguments
Warmup iterations
Measured iterations
Transport setup (ms)
p50 / p90 / p99 (ms)
Heap used (MB)

How to interpret the numbers

  • ▸Separate startup from steady state. Report connection setup time (process spawn or transport setup) separately from warmed per-call latency. Mixing them produces a number that describes neither. On 2026-07-28 servers there is no initialize handshake to time.
  • ▸Compare on the same rig. A result from a laptop running loopback and a result from a container behind a load balancer cannot be compared directly. Compare transports on one machine, under one network condition.
  • ▸Watch the tail. p99 matters more than the mean for interactive agents: one slow call stalls the whole reasoning turn. The harness reports percentiles for exactly this reason.
  • ▸Isolate the tool. If the tool performs a database query or an external HTTP request, you are measuring that dependency, not the transport. Use a no-op tool for transport comparisons and a realistic tool for end-to-end budgets.
  • ▸Measure concurrency separately. Sequential calls tell you about latency; they say nothing about how the server behaves with many simultaneous sessions. Test concurrency with a different harness.

Costing your own deployment

Do not copy someone else's cost table. Calculate from your own usage and current provider prices:

  1. ▸Token cost: If your host includes tools/list schemas in every model request, count the tokens your actual tool definitions consume, multiply by your provider's current per-million-token price, then multiply by your real requests per day. Provider prices change; read the pricing page on the day you do the calculation.
  2. ▸Infrastructure cost: for a remote server, add request charges, CPU time, egress, and any always-on load balancer. Serverless and always-on topologies have very different fixed costs, so model both with your own traffic figures.
  3. ▸Local cost: stdio avoids cloud line items but is tied to one workstation and does not scale to a team.

Useful starting points: the MCP transports specification (opens in a new tab), the official TypeScript SDK (opens in a new tab), and your cloud provider's own pricing calculator.

Multi-client configuration for Streamable HTTP

Modern MCP hosts support Streamable HTTP through a /mcp URL. Replace the example host with your own gateway.

OpenAI Codex CLI (~/.codex/config.toml)

toml
[mcp_servers.analytics_http]
url = "https://mcp.internal.example.com/mcp"
bearer_token_env_var = "MCP_GATEWAY_TOKEN"

Claude Desktop and Cursor (mcp.json)

json
{
  "mcpServers": {
    "analytics-http": {
      "url": "https://mcp.internal.example.com/mcp",
      "headers": {
        "Authorization": "Bearer <YOUR_MCP_GATEWAY_TOKEN>"
      }
    }
  }
}

Replace the placeholder with your token; Cursor's configuration interpolation syntax is ${env:MCP_GATEWAY_TOKEN} if you prefer to keep the secret out of the file.

References

Ready to Deploy?

Build your full agent toolstack in the Visual Generator

Combine MCP servers with databases, search APIs, and memory graphs in a single configuration file.

Customize in Generator
Developer Verification & Feedback
0 reports

Did this setup guide work with your AI host?

Help test this configuration across Claude, Cursor, and Codex CLI. Be the first to report:

How to Benchmark MCP Transports: stdio vs Streamable HTTP FAQ

What is the structural difference between Streamable HTTP and legacy SSE?

Legacy SSE used two channels: a long-lived GET /sse stream that delivered a session URI, plus separate POST /message calls for each JSON-RPC request. Streamable HTTP uses a single /mcp endpoint: the client POSTs initialize, receives the result and an Mcp-Session-Id on that same transaction, and reuses the endpoint for later calls. Whether that makes it faster in practice depends on your network and workload; measure it rather than assuming.

When should I still choose local stdio over Streamable HTTP?

Choose stdio for single-developer local workflows (Claude Desktop, Cursor, local Codex CLI) where the server accesses local files, Git repositories, or localhost databases. It avoids the need to host, authenticate, and scale a remote endpoint. Remote transports are a better fit when multiple users or machines need the same server.

What drives the largest share of production MCP operating costs?

It depends on your workload. Every registered tool definition is sent on each request, so a large tool catalog can make input tokens a significant cost; verbose tool outputs add more. Measure the token counts in your own requests and multiply by your provider's current prices. Compute and egress matter separately for remote servers. We do not publish a percentage for this because it varies too much between deployments.

RT✓

Written by Rad Tome

Independent maintainer, MCP Codex

Specializing in Model Context Protocol (MCP) integrations, autonomous AI agent orchestration, and distributed developer toolchains. Researches and benchmarks production MCP client-server architectures across OpenAI Codex, Claude, and Cursor.

Editorial Integrity: Package names verified via npm registry API. Repositories verified via GitHub REST API.
Verification Charter →

Related Guides