
Calculator
io.github.slettmayer由 GitHub 帳號 slettmayer 發布v0.1.9更新於 Oct 24, 2026
Exact arithmetic: one calculator tool over an AST allowlist, with integers exact at any size.
發布方自己的服務:calc.engineer
概覽
一個本機 MCP 伺服器,提供單一 calculate 工具精確計算算術運算式,讓助理不必心算數學。
- 可以做什麼
- 計算含 +、-、*、/、//、%、** 與括號的算術運算式,也接受 Unicode 運算子變體與正負號,結果以字串回傳,出錯時回傳以 Error 開頭的說明而非呼叫失敗。使用 pi、e、tau 常數以及 sqrt、log、三角函數、factorial、gcd、lcm 等函式。整數在任意大小下保持精確,浮點數以 12 位有效數字輸出以去除表示誤差。
- 適用情境
- 當助理需要可靠的四則運算、大整數乘法或科學函式而不應自行估算時適合加入;也適合想要一個範圍受限、用途單一的本機計算伺服器而非通用程式碼執行工具的情境。
- 執行需求
- 以本機 stdio 程序執行,透過 uvx 從 PyPI 套件 calc-mcp-server 啟動,需要 Python 環境及 uv/uvx。未宣告任何帳號、API 金鑰、環境變數或請求標頭。README 建議固定版本,不要使用 @latest。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Calculator,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Calculator MCP Server
[PyPI] [Python] [License: MIT]
An MCP server that does arithmetic, exactly — so an LLM does not have to do it mentally.
One tool, calculate, evaluating expressions against a hand-rolled AST allowlist. No eval(), no
sympy, no unbounded dependencies.
Why this exists
The widely-used mcp-server-calculator package is abandoned (last commit May 2025) and declares
mcp>=1.4.1 with no upper bound. When the MCP Python SDK released v2 and removed
mcp.server.fastmcp, every uvx …@latest install of it started crashing on import — which took down
the entire MCP proxy hosting it, and every other server alongside it.
No maintained Python replacement exists. The one actively-maintained npm calculator computes in
float64, so 123456789 * 987654321 comes back as 121932631112635260 — off by 9. That is a poor
trait in a tool whose whole purpose is that the model should not be doing the arithmetic itself.
So this server:
- bounds its one dependency (
mcp[cli]>=2,<3) — the failure above cannot recur here; - keeps integers exact at any size, never coercing to float;
- bounds resource use, not just code execution — see below.
Safety
Two problems, and most calculator servers only solve the first.
Code execution. Expressions are parsed with ast.parse and walked against an explicit allowlist of
node types. Attribute is not on it, so (1).__class__.__bases__ is rejected. A Call is only
evaluated when its target is a bare name in the function allowlist, so __import__('os').system(…) is
rejected before any argument is even evaluated.
Resource exhaustion. An allowlist alone still lets 9**9**9 occupy the process for minutes on
unbounded bignum exponentiation — the incumbent hangs for over five seconds on it. Four caps close
that: expression length (500 chars), nesting depth (32), result size (4300 digits, checked on the
operands before exponentiating), and factorial argument (1000).
Full detail in docs/tech/SAFE-EVALUATION.md.
Install
Pin it. Do not add @latest — that is how the package this replaces broke.
Configure
As a stdio MCP server:
The calculate tool
Returns the result as a string, or a line starting with Error: explaining why the expression was
rejected. The tool never raises, so a bad expression is an answer the agent can read back rather than a
tool-call failure.
Operators — + - * / // % **, parentheses, unary +/-. ^ is accepted as a power
operator, and × · ÷ − are accepted as their ASCII equivalents (speech-to-text produces them).
Constants — pi, e, tau.
Functions — abs round min max sqrt exp log log2 log10 sin cos tan asin
acos atan atan2 degrees radians hypot floor ceil factorial gcd lcm.
Results — integer arithmetic returns an exact integer of any size. Floats are rendered at 12
significant digits, which removes IEEE-754 representation noise (0.1 + 0.2 reads 0.3, not
0.30000000000000004) while keeping far more precision than a calculator result is used at. A whole
float keeps its .0, so 8 / 2 reads 4.0 and stays distinct from the exact integer 4.
Development
See AGENTS.md for the project guide and docs/ for the full documentation set.
License
MIT — see LICENSE.
來源:README.md,提交 b2e8ffa
工具
0版本歷史
2- v0.1.9最新Sep 18, 2026
- v0.1.8Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
其他 Calc 整合
calc.engineer
engineer.calc官方發布者
免金鑰的遠端 MCP 伺服器,提供 88 個工程計算器,涵蓋射頻鏈路、LoRa/Meshtastic、PCB、散熱、供電與家用實驗室規劃。
DeskCalc Verify
com.deskcalc
一個本機 stdio MCP 伺服器,讓助理把從發票、收據和對帳單讀到的數字交給人在 DeskCalc 中核對並確認。

Finance Calc Mcp
由 GitHub 帳號 mrfentmen 發布
本機 stdio MCP 伺服器,用來計算貸款還款、攤還表、複利與淨現值,全部離線完成。

Stem Calc Student Mcp
由 GitHub 帳號 AnonymousOnyx22 發布
本機離線計算器伺服器,讓助理可靠地計算莫耳質量、平衡化學方程式、進行化學計量換算與單位換算。

PJe-Calc MCP
由 GitHub 帳號 lucianumm 發布
本機 MCP 伺服器,讓桌面 AI 助理在 Windows 上的 PJe-Calc Cidadão 中建立、稽核、更新與核對巴西勞動法院計算。