Anthropic im Code-Modus: Streit um MCP vs. CLI — Tools für Runtime belegt, Tokens von 150.000 auf 2.000 gedrückt

ChainNewsAbmedia

2025 年整年 AI 工程社群在「MCP vs CLI」哪個更適合 Agent 工具呼叫的問題上爭論不休、Anthropic 2025 年 11 月發表的「Code execution with MCP」論文從第一原則重新定義了問題。akshay_pachaar 5/10 整理 thread說明:問題從來不在協議本身、而在「session 開始時把所有工具描述塞進 context」的舊習慣;Anthropic 的解法是讓模型寫程式碼呼叫工具、運行時負責管理工具細節。新模式被稱為「Code Mode」。

舊模式的問題:150K tokens 中模型大部分用不到

舊 MCP 模式的浪費結構:

Playwright MCP:13.7K tokens(一次塞滿)

Chrome DevTools MCP:18K tokens

5 個 server 設定:尚未開始工作就燒掉 55K tokens

單一 workflow 完整執行:可膨脹到 150K tokens

模型實際用到的:絕大部分都用不上

批評者主張改用 CLI、但 CLI 在多租戶 app 容易出錯、缺乏 typed contract、agent 在不熟悉 API 上要花輪次解析輸出文字。兩派各有理、但都把問題定位錯。

解法:模型寫 code 呼叫工具、不再從 context 直接 call

Anthropic 提出的「Code Mode」核心:

翻轉模型角色:不是模型透過 context 呼叫工具、而是模型寫程式碼、由 runtime 呼叫工具

工具住在 runtime 裡、模型只看到自己 import 的部分

type 跟著 import 走、模型 import 哪個工具就拿到哪個的型別合約

用 Bash 呼叫已安裝的二進位檔(git、curl 等)

用 typed module imports 呼叫專有 API

Anthropic 範例:Google Drive 文字記錄流入 Salesforce CRM 更新。舊作法載入兩邊工具 schema、把整段文字記錄透過模型傳兩次;新作法 10 行 TypeScript 只 import 需要的、同樣任務從原本的 150K 壓到 2K tokens、減 98.7%。

Cloudflare 推到極限:2,500 個 endpoint API、從 1.17M tokens 壓到 1K

Cloudflare 做了最激進的版本:

原始 API 規模:2,500 個 endpoint、schema 合計 1.17M tokens

新作法:只暴露兩個函式 search 與 execute、總計 1K tokens

Agent 寫程式碼先 search 工具目錄、再 execute 對應的工具

壓縮比:超過 1,000 倍

「MCP 已死」的說法錯了—Anthropic 公布 MCP SDK 下載量已達 3 億、年初為 1 億、是當前成長最快的 Agent 基礎建設之一。死的是「session 開始時把所有工具一次載入」這種寫法、而那本來就是壞主意。對 2026 年寫 Agent 的開發者、規則簡單:工具定義屬於 code、不屬於 context;模型寫幾行程式碼呼叫、runtime 處理其餘部分。

後續可追蹤的具體事件:MCP SDK 下載量從 3 億繼續攀升的速度、Anthropic 是否將 Code Mode 標準化為 MCP 規範的官方推薦模式、以及 OpenAI、Google、Cursor 等其他 Agent 平台對 Code Mode 的採納進度。

這篇文章 Anthropic Code Mode 解 MCP vs CLI 之爭:工具住 runtime、tokens 從 150K 壓到 2K 最早出現於 鏈新聞 ABMedia。

Disclaimer: The information on this page may come from third parties and does not represent the views or opinions of Gate. The content displayed on this page is for reference only and does not constitute any financial, investment, or legal advice. Gate does not guarantee the accuracy or completeness of the information and shall not be liable for any losses arising from the use of this information. Virtual asset investments carry high risks and are subject to significant price volatility. You may lose all of your invested principal. Please fully understand the relevant risks and make prudent decisions based on your own financial situation and risk tolerance. For details, please refer to Disclaimer.
Kommentieren
0/400
Keine Kommentare