MCP 2024-11-05 · JSON-RPC 2.0 · Streamable HTTP

Ageity MCP Server

企業級 AI 成本控制接口。任何支持 MCP 的 AI Agent、Claude Desktop、IDE 均可直接接入 Ageity 路由引擎, 通過 Cloudflare AI Gateway 統一調用 10+ 供應商,節省 80-93% 成本。

連接配置

MCP Endpoint
POST /mcp
Protocol
JSON-RPC 2.0 over HTTPS
Claude Desktop 配置 (claude_desktop_config.json)
{
  "mcpServers": {
    "ageity": {
      "command": "node",
      "args": ["-e", "fetch('https://YOUR_DOMAIN/mcp',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({jsonrpc:'2.0',id:1,method:'initialize',params:{protocolVersion:'2024-11-05',clientInfo:{name:'claude',version:'1.0'}}})}).then(r=>r.json()).then(console.log)"],
      "transport": "http",
      "url": "https://YOUR_DOMAIN/mcp"
    }
  }
}

MCP Tools (7個)

ageity_complete 核心

通過 Ageity 智能路由引擎執行 prompt。自動選擇最具性價比模型。

請求示例:
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"ageity_complete","arguments":{"prompt":"分析這份商業計劃的優缺點","session_id":"my-session","max_tokens":1024}}}
ageity_compare 試驗

同一 prompt 同時向 GPT-4.1 及 Ageity 路由發出,返回逐項對比(質量/成本/延遲)。

請求示例:
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"ageity_compare","arguments":{"prompt":"What is quantum computing?","session_id":"my-session"}}}
ageity_route_explain 調試

乾跑(Dry Run):解釋 Ageity 如何路由某個 prompt,不執行實際 API 調用,零成本。

請求示例:
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"ageity_route_explain","arguments":{"prompt":"Write a Python function to sort a list"}}}
ageity_cost_estimate 財務

列出所有模型對某 prompt 的成本估算,排名對比,輔助預算決策。

請求示例:
{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"ageity_cost_estimate","arguments":{"prompt":"Summarize the quarterly earnings report"}}}
ageity_session_stats 分析

查詢會話的完整用量統計:請求次數、累計節省、模型分佈、歷史記錄。

請求示例:
{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"ageity_session_stats","arguments":{"session_id":"my-session"}}}
ageity_list_models 查詢

列出所有可用模型,支持按供應商/等級/能力篩選。

請求示例:
{"jsonrpc":"2.0","id":6,"method":"tools/call","params":{"name":"ageity_list_models","arguments":{"tier":"economy"}}}
ageity_set_budget 預算

為會話設置每請求預算上限,Ageity 自動在預算內選擇最優模型。

請求示例:
{"jsonrpc":"2.0","id":7,"method":"tools/call","params":{"name":"ageity_set_budget","arguments":{"session_id":"my-session","budget_usd":0.001}}}

MCP Resources

ageity://models/registry
Model Registry
所有模型的完整定義(定價/能力/Gateway路徑)
ageity://pricing/table
Pricing Table
實時定價表(USD/1M tokens)
ageity://routing/rules
Routing Rules
路由規則:複雜度信號與模型選擇邏輯
ageity://providers/status
Provider Status
所有供應商的狀態與模型數量
讀取 Resource 示例:
{"jsonrpc":"2.0","id":1,"method":"resources/read","params":{"uri":"ageity://pricing/table"}}

即時測試

// 回應將顯示於此...