MCP.so
ログイン

Calculator MCP Server

@xiaoyingv

基本情報

カテゴリ

その他

ライセンス

MIT

トランスポート

stdio

作者

xiaoyingv

Calculator MCP Server について

Calculator MCP Server tool ;基于 Python AST 的安全表达式计算器 MCP 服务,支持基础数学运算和错误防护机制。

Calculator MCP Server の設定

標準の設定はありません

このサーバーの README には解析可能な MCP 設定ブロックが含まれていません。インストール手順はリポジトリをご確認ください。

リポジトリ

Calculator MCP Server のツール

ツール一覧はまだありません

この掲載には表示できるツール一覧がまだありません。サーバーにツールがないという意味ではありません。対応機能はプロジェクトのドキュメントをご確認ください。

ツールは README から自動的に抽出されます。メンテナーは ## Tools という見出しの下に記載することで、このタブに反映できます。

概要

What is Calculator MCP Server 🧮?

Calculator MCP Server 🧮 is a Python-based MCP service that evaluates mathematical expressions safely using Python AST parsing instead of eval. It supports basic arithmetic operations, power operations, and sign handling, with built-in error protection against code injection, division by zero, and invalid expressions.

How to use Calculator MCP Server 🧮?

Install the package via pip install mcp-calculate-server, then create a FastMCP server instance and run it on stdio transport using calculator.run(transport='stdio'). The server exposes a single tool perform_calculation that accepts a string expression and returns the formatted result or an error message.

Key features of Calculator MCP Server 🧮

  • Supports addition, subtraction, multiplication, division (+, -, *, /)
  • Supports exponentiation (**) and sign operations (+, -)
  • Smart formatting: integers shown directly, decimals up to 15 significant digits, trailing zeros removed
  • Safe evaluation via Python AST – no code injection risk
  • Protection against division by zero, syntax errors, invalid power operations, and illegal operand types

Use cases of Calculator MCP Server 🧮

  • Performing safe arithmetic calculations within MCP-based applications
  • Evaluating user-supplied expressions without risk of code injection
  • Integrating math operations into AI assistants or automation tools
  • Providing formatted calculation results with clear error messages

よくある質問

1

What Python version is required?

Python 3.13 or higher is required, along with the `mcp-server` library which is installed automatically.

2

How does it ensure safety?

It parses expressions into an AST and evaluates only supported nodes, preventing arbitrary code execution that `eval` would allow.

3

Which operators are supported?

The server supports `+`, `-`, `*`, `/`, `**`, unary plus, and unary minus.

4

What happens on division by zero?

The server returns an error message: `❌ 错误:除数不能为零` (Division by zero is not allowed).

5

Is the server free to use?

Yes, it is released under the MIT License. Source code is available on GitHub.

コメント

「その他」の他のコンテンツ