Benchmarking Model Context Protocol (MCP) in GitLab: Why AI Agents Are Leaving REST Behind
说明与用途
GitLab 的模型上下文协议(MCP)降低了 JSON 响应大小、令牌使用和延迟,提升了与传统 REST 相比的自主 AI 代理效率。
问题
REST APIs return large, redundant JSON payloads, brittle schemas, and stateless overhead that waste LLM context tokens and increase latency for autonomous AI coding agents.
结果
MCP delivers 92.1 % smaller payloads, 12.6× fewer prompt tokens, 15.4× faster parsing, 0 % parameter error rate, and 5.6× faster multi‑turn execution compared to REST.
工作流
- 1. Configure agent to use MCP client with GitLab 17.6+ and PAT.
- 2. Agent initiates persistent JSON‑RPC connection (stdio/SSE).
- 3. Agent requests resource (e.g., issues) via MCP "resources/read" endpoint.
- 4. Agent receives compact, schema‑enforced JSON payload.
- 5. Agent performs iterative actions (list, read, search, draft MR) over persistent connection, avoiding TCP/TLS renegotiation.
- 6. Agent completes task with reduced token usage and latency.
证据
REST APIs return massive JSON payloads packed with UI flags, timestamps, and redundant metadata that consume thousands of precious LLM context tokens.
Raw Payload Size: 48.2 KB vs 3.8 KB (92.1% reduction). Prompt Token Cost: ~12,400 vs ~980 (12.6x more efficient). Parsing Latency: 185 ms vs 12 ms (15.4x faster).
Search Parameter Error Rate: REST API (Unconstrained strings): 22% Invalid Scopes MCP Server (Enum‑constrained): 0% Errors (Deterministic)
Total Turnaround Time: REST 1,320 ms vs MCP 234 ms (5.6x faster)
- 记录日期: 2026-10-16T03:41:28.294Z