Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Is stateless MCP just REST? I ran 180 tests to find out

说明与用途

对比无状态 MCP 与 REST,发现小工具集两者相当,但在 API 扩展时 MCP 产生 35% 令牌开销,REST 通过缓存获益。MCP 在严格 API 上优于 REST,因其模式预防首次调用错误。

问题

Determine whether a stateless Model Context Protocol (MCP) server offers performance or correctness advantages over a plain REST API when interacting with a language model.

结果

On a small tool surface both MCP and REST tie in success, round‑trips, and latency, but REST gains five cache hits. On a larger surface MCP incurs a 35% token overhead due to re‑sending the full tool catalog each turn, while REST remains efficient. REST outperforms MCP on repeated reads thanks to HTTP caching, whereas MCP outperforms REST on strict APIs where schema guidance prevents first‑call errors.

工作流

  • 1. Deploy a single backend with six operations.
  • 2. Wrap the backend as a stateless MCP server (tool list + JSON schemas per turn).
  • 3. Wrap the backend as a REST API (single http_request tool + OpenAPI contract in system prompt).
  • 4. Use Claude Haiku 4.5 on Amazon Bedrock to run five trials per task per interface (30 runs each).
  • 5. Record metrics: success, tokens, latency, round‑trips, cache hits.
  • 6. Repeat with an expanded surface of 30 operations.
  • 7. Compare results across small and large surfaces, and on tasks that test caching and strict API handling.

证据

I took a single backend and exposed it twice, once as a stateless MCP server and once as a plain REST API, handed both to the same agent with the same tasks, and recorded what changed across 180 runs.

来源

With six tools, the internet slogan seems to be correct!

来源

MCP +35%

来源

The REST agent read the order, got an ETag, and on the second read sent If-None-Match with that tag. The server answered 304 Not Modified with an empty body, and the agent reused the value it already had.

来源

MCP gives the model its normal typed tool schema: the enum values are correctly spelled, the format is declared, and the host validates the call before it is dispatched.

来源

  • 记录日期: 2026-10-26T17:11:36.268Z