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.

评论

其他 分类下的更多 MCP 服务器