
Calculator MCP Server
A backend service that provides accurate arithmetic calculation capabilities to AI models via the Model Context Protocol, allowing LLMs to offload mathematical computations for numerical queries.
README
Calculator MCP Server
The Calculator MCP Server is a backend service designed to provide arithmetic calculation capabilities to AI models, particularly Large Language Models (LLMs), via the Model Context Protocol (MCP). It allows LLMs to offload mathematical computations, ensuring accuracy and reliability for numerical queries. For example, when the user asks the LLM "what's the result of 3.8 - 3.11?", the LLM will call the server with "3.8 - 3.11" to perform the calculation first and then answer the user.
This server is built on top of the official MCP Python SDK and implements a single MCP tool named calculator_tool
that accepts a string-based arithmetic expression and returns the calculated numerical result.
The server is packaged as a Docker image.
Features
- MCP Compliant: Adheres to the Model Context Protocol for seamless integration.
- Accurate Calculations: Provides precise results for basic arithmetic operations (+, -, *, /).
- Safe Evaluation: Uses a secure method to parse and evaluate mathematical expressions, preventing arbitrary code execution.
- Standardized API: Exposes functionality through the
tools/call
MCP method. - Dockerized: Includes a Dockerfile for easy containerization, deployment, and testing.
- Comprehensive Error Handling: Returns structured JSON-RPC errors for invalid inputs or calculation issues.
Prerequisites
- Docker
bash
(for running helper scripts)- Python 3.12 (for understanding the code, not strictly for running if using Docker for everything)
Setup and Installation
1. Clone the Repository (if applicable)
If this project is in a Git repository, clone it:
git clone <repository-url>
cd calculator-mcp-server
2. Build the Docker Image (Optional - Handled by run-tests.sh
and start-mcp-server.sh
if needed)
You can manually build the image:
./build-image.sh
However, ./run-tests.sh
will automatically build the image if it doesn't exist or if you want to ensure it's up-to-date before testing. Similarly, start-mcp-server.sh
might incorporate this.
3. Running the Server
To start the server:
./start-mcp-server.sh
This script will ensure the image is built, start the server in a Docker container, and check its status. The server listens on port 8000 by default.
Usage
The Calculator MCP Server exposes its functionality via MCP. An MCP client (e.g., an LLM host application) would interact with it as follows:
-
Initialize Connection: The client establishes a connection with the server (running in Docker).
-
Tool Discovery (Optional but Recommended): The client sends a
tools/list
request. -
Tool Invocation: The client sends a
tools/call
request to use thecalculator_tool
.Request:
{ "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "calculator_tool", "arguments": { "expression": "10 * (2 + 3) - 5 / 2" } }, "id": "request-id-123" }
Successful Response:
{ "jsonrpc": "2.0", "result": { "value": 47.5 }, "id": "request-id-123" }
Testing with test-mcp-client.sh
A simple CLI client script is provided to test the running server. Make sure the server is running via ./start-mcp-server.sh
.
./test-mcp-client.sh list"
./test-mcp-client.sh call "2+2"
Running Tests
Unit tests are run inside a Docker container. The script handles building the image if necessary.
./run-tests.sh
This script first calls ./build-image.sh
to ensure the Docker image is up-to-date, then executes pytest
within a new container instance.
Stopping the Server (Docker)
If you started the server using ./start-mcp-server.sh
, you can stop it with:
./stop-mcp-server.sh
Contributing
Please refer to the developer_guide.md.
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。