CalculatorLib MCP
將數千個計算器與 9 個單位換算類別 — 精簡為僅 12 個工具(先搜尋計算器,再執行它)— 接入任何 Model Context Protocol 用戶端。向 Claude 提出像 “我體重 70 kg、身高 170 cm,BMI 是多少?” 或 “把 5 公尺換算成英尺” 之類的問題,得到權威的答案,而不是憑空捏造的算術。
60 秒內安裝
選擇你使用的用戶端,貼上程式碼片段,重新啟動。就這樣。
執行一個指令,Claude Code 即會自動接好連線:
claude mcp add --transport http calculatorlib https://calculatorlib.com/mcp
或者,如果你偏好手動編輯設定檔 ~/.claude/mcp.json:
{
"mcpServers": {
"calculatorlib": {
"url": "https://calculatorlib.com/mcp"
}
}
}
在 Claude Code 中用 /mcp 驗證 — 你應該會看到 calculatorlib 已連線,並列出 12 個工具。
編輯你的 Claude Desktop 設定:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
加入下方的 mcpServers 項目(與你已有的內容合併):
{
"mcpServers": {
"calculatorlib": {
"url": "https://calculatorlib.com/mcp"
}
}
}
重新啟動 Claude Desktop。輸入框中的鎚子圖示會顯示 calculatorlib 及其 12 個工具。
開啟 Cursor 設定 → MCP → Add new MCP server,然後貼上:
{
"mcpServers": {
"calculatorlib": {
"url": "https://calculatorlib.com/mcp"
}
}
}
Cursor 使用相同的 Streamable HTTP 傳輸,因此 JSON 結構描述與 Claude Desktop 完全相同。
編輯你的 Zed 設定(cmd+, / ctrl+, → Open Settings),並在 context_servers 底下加入計算器伺服器:
{
"context_servers": {
"calculatorlib": {
"source": "custom",
"transport": {
"type": "streamable-http",
"url": "https://calculatorlib.com/mcp"
}
}
}
}
重新載入助理面板;計算器工具即可供任何 agent 執行緒使用。Zed 的 MCP 支援需要 v0.165 或更新版本。
在 VS Code 中開啟 Cline 擴充功能 → MCP Servers → Edit Configuration。在 macOS 上,設定檔位於 ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json(Linux/Win 路徑類似):
{
"mcpServers": {
"calculatorlib": {
"url": "https://calculatorlib.com/mcp",
"transportType": "streamableHttp"
}
}
}
Cline 會自動重新載入伺服器設定;新工具會在幾秒內出現在 MCP 面板中。
開啟 Windsurf → Cascade → Configure MCP,或直接編輯 ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"calculatorlib": {
"serverUrl": "https://calculatorlib.com/mcp"
}
}
}
重新啟動 Windsurf,計算器工具便會出現在 Cascade 的工具選擇器中。HTTP 傳輸需要 Windsurf 1.5+。
任何支援 Streamable HTTP 傳輸(規範版本 2025-06-18)的 MCP 相容用戶端都可連線:
{
"transport": "streamable-http",
"endpoint": "https://calculatorlib.com/mcp"
}
或者直接用 curl 呼叫 JSON-RPC 端點:
curl -X POST https://calculatorlib.com/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
試試這些提示詞
安裝後,直接用自然語言與 Claude 對話 — 它會挑選合適的工具。
“如果我體重 70 kg、身高 170 cm,我的 BMI 是多少?我在健康範圍內嗎?”
Claude 呼叫 bmi_calculator,回傳 BMI 24.22 及對應的 WHO 分類。
“把 5 公尺換算成英尺,再把 200 磅換算成公斤。”
Claude 依序呼叫 convert_length 與 convert_mass。
“如果我投資 $10 000,以 5% 年複利持有 20 年,最終價值是多少?”
Claude 呼叫 compound_interest_calculator 並顯示明細。
“一筆 $300k 的房貸,年利率 6.5%、期限 30 年,每月還款是多少?”
Claude 以本金、利率、期限呼叫 home_loan_calculator。
線上試用台
就在這裡呼叫伺服器 — 向 https://calculatorlib.com/mcp 發送真實的 JSON-RPC,取得真實回應。免註冊。
授權權杖(選填)
原始 JSON-RPC 請求 & 回應
npx @modelcontextprotocol/inspector,然後連線到 https://calculatorlib.com/mcp(傳輸方式:Streamable HTTP)。 工具瀏覽器
依名稱或標題搜尋計算器庫與 9 個換算類別。在思考要向 Claude 提出什麼時很有用。
運作方式
- 端點:位於
https://calculatorlib.com/mcp的單一POST處理器,基於 Streamable HTTP 使用 JSON-RPC 2.0(傳輸規範2025-06-18)。 - 工具命名:計算器 slug 使用 snake_case(
bmi_calculator、compound_interest_calculator);換算器為convert_<category>。 - 輸入:每個工具都會公布一個由計算器表單欄位(型別、列舉、最小/最大值)推導出的 JSON Schema。條件式欄位(例如 BMI 中的公制與英制)會列為選填 — 請閱讀每個欄位的說明以了解哪些組合有效。
- 輸出:一行文字摘要,外加一個 LLM 可解析的
structuredContentJSON 物件(例如{ "main": [{...}], "data": [...] })。 - 更新:目錄每 5 分鐘重新整理一次 — 新發布的計算器會自動出現。
直接 API(不需要 MCP 用戶端)
想在沒有 MCP 用戶端的情況下整合?相同的資料可透過一般 JSON 端點取得。
curl -X POST https://calculatorlib.com/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
curl -X POST https://calculatorlib.com/mcp \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0","id":2,"method":"tools/call",
"params":{
"name":"bmi_calculator",
"arguments":{"unitSystem":"metric","weight":70,"height":170}
}
}'
curl -X POST https://calculatorlib.com/mcp \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc":"2.0","id":3,"method":"tools/call",
"params":{
"name":"convert_length",
"arguments":{"value":5,"from":"Meter","to":"Foot"}
}
}'
REST 端點(無 JSON-RPC 封裝):
/api/calculators/schemas?q=<keywords>— 搜尋計算器(帶輸入結構描述的有限相符結果)- /api/converter/categories — 帶單位的換算類別
POST /api/converter/convert— 直接換算,請求主體{ category, from, to, value }
身分驗證(選填但建議)
匿名呼叫可用 — 身分驗證是選填的。加上權杖可在 /account/mcp-logs 解鎖各使用者的使用分析:你透過權杖發出的每次呼叫都會顯示在那裡,包含延遲、錯誤原因以及你呼叫的計算器。
取得權杖(60 秒)
- 登入(或先建立帳戶)。
- 前往 /account/api-tokens。
- 點選 Generate token。複製該值 — 它只會顯示一次。
將其加入你的 MCP 用戶端
與公開安裝相同的設定檔,再加上一個 headers.Authorization 欄位:
{
"mcpServers": {
"calculatorlib": {
"url": "https://calculatorlib.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_TOKEN_HERE"
}
}
}
}
為什麼要這麼做?
- 個人使用記錄 — 查看你最常呼叫哪些計算器、哪些失敗,僅限於你的權杖範圍(/account/mcp-logs)。
- 多用戶端、各自的權杖 — 為每台裝置(筆電、伺服器、agent)各建立一個。撤銷其中一個不會影響其他。
- 未來各使用者功能的基礎 — 當我們加入速率限制 / 配額 / 已儲存的預設時,它們會繫結到已驗證的呼叫上。
使用 Bearer 權杖的 curl
curl -X POST https://calculatorlib.com/mcp \
-H 'Authorization: Bearer YOUR_TOKEN_HERE' \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
伺服器維運者:設定 MCP_REQUIRE_AUTH=true 可要求每次呼叫都帶權杖(匿名 → 401)。舊的 MCP_API_TOKEN 環境變數仍可作為單一共用密鑰的旁路。
常見問題 & 疑難排解
這是免費的嗎?有速率限制嗎?
你們會儲存我的查詢嗎?
為什麼 Claude 有時會說某個工具沒有回傳有用的資料?
我可以進行身分驗證,讓我的使用記錄顯示在我的帳戶下嗎?
/mcp 請求中以 Authorization: Bearer <token> 傳入,你的呼叫就會出現在 /account/mcp-logs。完整的用戶端設定請見上方的「身分驗證」部分。我弄丟了權杖。可以找回嗎?
我剛發布了一個新計算器 — 它什麼時候會出現?
工具名稱與我在 URL 中看到的 slug 不一致?
/bmi-calculator 會變成 bmi_calculator。