
MCP 伺服器 + 本地模型:特定領域 AI 工具的零 API 費用
MCP 伺服器和微調本地模型的組合,消除了建立在 Claude、Cursor 和其他 MCP 相容客戶端上的 AI 工具的每 token 費用。以下是費用計算和架構。
2026 年的標準 AI 工具架構:你的應用呼叫 Claude 或 GPT-4 API,按 token 付費,祈禱費用不會螺旋上升。替代架構:你的應用公開由本地微調模型支援的 MCP 工具。AI 客戶端(Claude Desktop、Cursor 等)呼叫工具。工具呼叫你的本地模型。領域推理的零 API 費用。
費用結構比較
標準架構(雲端 AI 用於領域任務):
使用者請求 → AI 客戶端 → 雲端 AI API(費用:每次呼叫 $0.005-0.03)→ 回應
使用 Claude Desktop 進行程式碼審查的開發者每天 50 次:50 × $0.01 平均 = $0.50/天,僅那一個用例每月 $15 的 Claude API 費用。
MCP + 本地模型架構:
使用者請求 → AI 客戶端 → MCP 工具呼叫(費用:$0)→ 本地 Ollama API(費用:約 $0.001 計算)→ 回應
相同的工作流程。接近零的推理費用。AI 客戶端訂閱(Claude Pro、Cursor)保持不變——但特定領域工具呼叫的每次 AI API 費用消失了。
費用節省適用於哪裡
MCP 不會消除 Claude 對話層的費用——使用 Claude Desktop 或 Claude API 時,你仍然為 Claude 的上下文視窗付費。它消除的是將特定領域工具呼叫路由到雲端 AI 的費用。
高容量、特定領域的工具呼叫是目標:
- 產生文件(合約、房源、提案)→ 本地模型
- 分類項目(支援票類別、產品類別)→ 本地模型
- 從文字中擷取結構化資料 → 本地模型
- 根據領域標準驗證或評分文字 → 本地模型
繼續使用雲端 AI 用於:
- 推理和協調(Claude 的強項)
- 需要當前知識或一般世界知識的任務
- 容量低、API 費用可忽略不計的任務
MCP 架構自然地分離了這些:Claude 推理要呼叫哪些工具並協調工作流程。你的本地模型為每個工具呼叫進行特定領域的推理。
一次構建,每次呼叫零費用的模式
這為工具構建者實現的商業模式轉變:
MCP + 本地模型之前: 為 Claude 構建領域工具,每次使用時都要花你的錢。1,000 個使用者 × 每天 20 次工具呼叫 × $0.01/次 = 每天 $200 的 AI API 費用。你必須收取足夠的費用來覆蓋這個擴展費用。
MCP + 本地模型之後: 工具呼叫到達你的 Ollama 伺服器。基礎設施費用:每月固定 $40-80。1,000 個使用者或 10,000 個使用者——相同的 VPS 費用。你一次構建,你託管推理,使用者支付固定訂閱。每次工具呼叫的邊際費用為零。
這是應用於 AI 工具的本地端軟體產品的經濟模式。你的利潤率不會隨著使用量而壓縮——它會改善。
構建零費用工具:模式
以下是使用 MCP + Ollama 構建零費用領域工具的模式:
1. 在 Ertas 中訓練你的領域模型
匯出為 GGUF。使用 Ollama 部署。在你的領域上測試準確率。
2. 構建一個 MCP 伺服器公開領域能力
# 使用 Python MCP SDK
from mcp.server import Server
from mcp.server.stdio import stdio_server
from mcp import Tool
import httpx
app = Server("domain-tool-server")
@app.list_tools()
async def list_tools():
return [
Tool(
name="domain_generate",
description="[你的具體描述——這個工具做什麼,何時使用它]",
inputSchema={
"type": "object",
"properties": {
"input": {"type": "string", "description": "領域任務的輸入"}
},
"required": ["input"]
}
)
]
@app.call_tool()
async def call_tool(name: str, arguments: dict):
if name == "domain_generate":
async with httpx.AsyncClient() as client:
response = await client.post(
"http://localhost:11434/api/chat",
json={
"model": "your-domain-model",
"messages": [{"role": "user", "content": arguments["input"]}],
"stream": False
},
timeout=30.0
)
result = response.json()["message"]["content"]
return [{"type": "text", "text": result}]
async def main():
async with stdio_server() as streams:
await app.run(*streams, app.create_initialization_options())
import asyncio
asyncio.run(main())
3. 發布 MCP 伺服器
使用者在他們的 Claude Desktop 或 Cursor 配置中安裝它。每次工具呼叫都到達你的 Ollama 端點——零 API 費用。
4. 對模型而非呼叫收費
對 MCP 伺服器的存取收取固定的每月訂閱費。你的費用:VPS 託管(每月 $40-80)。收入:每個使用者每月 $15-50。模型是你的產品;呼叫對你是免費的。
多租戶 MCP 伺服器
從單個 MCP 伺服器服務多個使用者或客戶:
// 向你的 MCP 伺服器添加身份驗證
server.setRequestHandler(CallToolRequestSchema, async (request, context) => {
// 從請求標頭或環境中驗證 API 金鑰
const apiKey = context?.meta?.apiKey;
if (!isValidKey(apiKey)) {
throw new Error('Unauthorized');
}
// 根據客戶路由到正確的模型
const modelName = getModelForClient(apiKey);
const response = await fetch(OLLAMA_URL, {
method: 'POST',
body: JSON.stringify({
model: modelName, // 每個客戶的不同微調模型
messages: [{ role: 'user', content: request.params.arguments.input }],
stream: false
})
});
// ...
});
每個客戶根據其特定的微調模型獲得校準的工具行為。一個 MCP 伺服器,多個模型,零每次呼叫的 API 費用。
Ship AI that runs on your users' devices.
Ertas early bird pricing starts at $14.50/mo — locked in for life. Plans for builders and agencies.
延伸閱讀
- MCP + 微調本地模型 — 架構概覽
- Claude Desktop 本地模型設置 — 逐步設置指南
- OpenAI 相容的本地 API — Ollama 的 OpenAI 相容介面
- 無 API 費用啟動 AI SaaS — 本地推理的更廣泛經濟效益
Ship AI that runs on your users' devices.
Early bird pricing starts at $14.50/mo — locked in for life. Plans for builders and agencies.
Keep reading

Shopify AI Assistant Without OpenAI API Costs: The Local Model Approach
Shopify stores spending $500-5,000/month on AI API costs can replace those calls with a local fine-tuned model. Here's the architecture, the Shopify integration, and the cost math.

MCP + Fine-Tuned Local Model: Connect Claude to Your Domain-Specific AI
Model Context Protocol (MCP) lets Claude Desktop talk to any server — including your own Ollama-hosted fine-tuned model. Here's the architecture and setup for routing Claude requests to a custom domain model.

Cursor + MCP + Fine-Tuned Model: Domain AI Inside Your Code Editor
Cursor supports MCP servers. Connect your fine-tuned domain model to Cursor and get specialized AI capabilities inside the editor — code generation trained on your codebase, documentation in your style, domain-specific autocomplete.