
Mcp Thinkgate
io.github.tjp2021由 GitHub 帳號 tjp2021 發布v0.1.1更新於 Oct 24, 2026
Auto-classifies prompt complexity and routes to the right Claude thinking mode. No API key needed.
概覽
一個本機 MCP 伺服器,在助理回答前判斷提示詞的複雜度,並建議 Claude 的思考層級、推理強度與模型。
- 可以做什麼
- 將提示詞複雜度分為 fast、think、ultrathink 三級,並給出推理強度、建議模型、信心分數與一句理由,可透過 MCP 工具或匯出的函式庫函式呼叫。沒有金鑰時使用規則式分類,也可選用 Haiku 呼叫取得更準確的分類。支援 claude、openrouter-cost、openrouter-balanced 等模型設定,並可依層級覆寫模型。
- 適用情境
- 適合在 Claude 上同時處理簡單與複雜請求的代理開發者,希望自動決定思考深度而不必手動標註提示詞。也適合執行常駐助理的團隊,其訊息的延遲與 token 成本差異較大。
- 執行需求
- 透過 stdio 在本機執行,通常以 npx 啟動 npm 套件 mcp-thinkgate。需要 Node.js 20 或更新版本。ANTHROPIC_API_KEY 環境變數為選用,未提供時會退回規則式分類。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mcp Thinkgate,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
ThinkGate
Automatic reasoning mode selection for Claude agents.
The problem
You built an AI agent. It handles everything — status checks, quick lookups, complex architecture questions, deep debugging sessions. But under the hood it runs every single message through the same model with the same thinking settings.
That means you're burning extended thinking tokens on "what time is it in Tokyo?" and getting shallow answers on "help me design the entire auth system."
You could manually tag requests — ULTRATHINK: before the hard ones. But you forget. Your users definitely won't do it. And if you're building agents for other people, you can't train every end user to manage thinking modes.
ThinkGate fixes this at the infrastructure layer. It sits between the incoming message and your model call, classifies the complexity in ~200ms, and returns exactly which model and thinking depth to use. Automatically. Every time.
Who this is for
- Agent builders running Claude on a mix of simple and complex tasks who are tired of one-size-fits-all model settings
- Teams running 24/7 agents (WhatsApp bots, Slack assistants, Telegram agents) where message complexity varies wildly and cost/latency actually matters
- Anyone who's ever typed
ULTRATHINKmanually and thought: this should just happen on its own
How it works
A cheap, fast Haiku call reads your prompt and decides which tier it needs. Then your main Claude call runs with the right effort level. You pay almost nothing for the classification, and save real money (and latency) on the 60%+ of messages that don't need extended reasoning.
The classifier is the IP here — not which model runs it. Three tiers. A system prompt trained on the boundary between "this needs thinking" and "this doesn't." Works out of the box.
Tiers
Profiles (model mapping)
Set THINKGATE_PROFILE or pass { profile } to classifyPrompt:
Per-tier overrides: THINKGATE_FAST_MODEL, THINKGATE_THINK_MODEL, THINKGATE_ULTRA_MODEL.
Cost note: the MCP tool is advisory. Hosts must actually switch models.
Pi does this via ~/.pi/agent/extensions/thinkgate-router.ts + thinkgate.json.
Rule mode (no API key) is free and preferred for auto-routing. Long checklist pastes no longer auto-upgrade to THINK.
Use as an MCP tool (Claude Desktop / Claude Code)
Add to ~/.claude/settings.json (Claude Code) or ~/Library/Application Support/Claude/claude_desktop_config.json (Claude Desktop):
Restart Claude. Now you can ask it to classify before it answers:
"Before responding, classify the complexity of this task: design a rate limiter for a public API"
Use as a library (agent frameworks)
Install:
Import and use:
Reference implementation: TinyClaw
TinyClaw is an open-source multi-agent framework for Claude. ThinkGate is wired into its invokeAgent() function — every message is automatically classified before the Claude CLI runs, and --effort is set accordingly.
Three lines added. Zero config required. Every agent in every team automatically gets the right thinking depth.
See the integration at src/lib/invoke.ts.
Requirements
- Node.js 20+
- Anthropic API key (optional — falls back to rule-based classification)
Local development
Contributing
See CONTRIBUTING.md for dev setup, commands, and PR process.
Security
See SECURITY.md for vulnerability reporting.
License
MIT — see LICENSE
來源:README.md,提交 2b7e5d2
工具
0版本歷史
1- v0.1.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分