home / mcp / calculator mcp server
bachai-calculator-mcp - 由 MCP工厂自动创建
Configuration
View docs{
"mcpServers": {
"bach-ai-tools-bachai-calculator-mcp": {
"command": "uvx",
"args": [
"bachai-calculator-mcp"
]
}
}
}You can run and access a lightweight MCP server that performs a broad range of mathematical operations from basic arithmetic to trigonometry and logarithms. It operates through the MCP protocol, allowing you to query it from compatible clients like Supergateway or Claude Desktop, and it runs with zero external dependencies by leveraging only Python’s standard library.
You connect to the Calculator MCP server using an MCP client and send requests that specify the operation you want to perform along with the required numbers. You can ask for additions, square roots, factorials, trigonometric values, and logarithms in natural language prompts or via the MCP tool calls supplied by your client. The server handles errors gracefully (for example, preventing division by zero or taking the square root of a negative number) and returns clear results.
Common usage patterns you can try include asking for a sum, a product, a power, or a modulo operation, or requesting a square root, factorial, logarithm, or trigonometric value. Examples of natural language prompts you might use are: “Please add 123 and 456,” “What is the square root of 16?,” “What is sin(45 degrees)?”, or “Compute log base 10 of 100.” The server translates these requests into MCP tool calls under the hood and returns the numerical results.
Prerequisites you need before starting: Python 3.7 or newer, and a working internet connection to install dependencies if you choose to install through package managers.
Option A: Install using the uvx utility (recommended for quick start)
uvx bachai-calculator-mcpOption B: Install via Python's package manager (pip) and run the server from the installed entry point
pip install bachai-calculator-mcp
bachai-calculator-mcpOption C: Run directly from source (if you have the project files)
python main.pyConfigure how the server connects to clients via the available MCP connections. The setup shown below covers both a Supergateway style connection and a Claude Desktop style configuration.
Supergateway configuration (MCP server endpoint via SSE and stdio bridge)
{
"mcpServers": {
"calculator": {
"outputTransport": "sse",
"port": 8000,
"stdio": "uvx bachai-calculator-mcp",
"ssePath": "/sse",
"messagePath": "/message"
}
}
}Set Claude Desktop to launch the MCP backend as a local process.
Windows path to Claude Desktop config (example)
{
"mcpServers": {
"calculator": {
"command": "uvx",
"args": ["bachai-calculator-mcp"]
}
}
}Once installed and configured, you can ask Claude to perform a variety of calculations such as: “Please calculate 123 plus 456,” “Compute the square root of 25,” “What is 5 factorial?”, “What is sin(45 degrees)?”, or “Compute the logarithm of 1000 base 10.”
Performs basic math operations including add, subtract, multiply, divide, power, and modulo.
Calculates the square root of a given number.
Computes the factorial of a non-negative integer.
Calculates trigonometric functions sin, cos, and tan for a given angle in degrees.
Calculates logarithms with a specified base (default base e).