SuperAPI AI Directory

cal-mcp

Evaluate mathematical expressions.

Open website

About this tool

Cal Server (cal-mcp) is a simple mathematical expression calculation service built on the FastMCP framework, using the Bun runtime environment. It uses the expr-eval library to parse and evaluate mathematical expressions entered by users, and interacts with the outside world through standard input/output (stdio). This project aims to provide a lightweight and efficient calculation tool that supports basic mathematical operations and built-in constants.

Purpose: Used to calculate mathematical expressions, it can be integrated as an MCP service into environments that support MCP, providing expression evaluation capability.

Main capabilities:

  • Expression calculation: Supports users entering mathematical expressions and returns the calculation results.
  • Built-in constants: E (Math.E in the Bun environment), PI (Math.PI in the Bun environment), true (logical true value), false (logical false value).
  • Parameters: Accepts a string-type mathematical expression (exp).

Dependencies and runtime environment:

  • fastmcp: Used to build the MCP service.
  • expr-eval: Used to parse and calculate mathematical expressions.
  • Ensure that the Bun runtime is installed (the latest version is recommended).

Usage:

  1. Install via Smithery: Can automatically install cal-mcp for Claude Desktop.
  2. Manual installation:
    • Clone the project repository: git clone <repository URL>
    • Enter the project directory and install dependencies: bun install
    • Start the service: bun run index.ts, the service will run through standard input/output (stdio).

Input and output examples:

  • Input mathematical expression: Example input 2 + 3 * PI, output is the calculation result (in string form).
  • Basic operation: 2 + 2 -> 4
  • Using constants: PI * 2 -> 6.283185307179586
  • Complex expression: E ^ 2 + 1 -> 8.38905609893065

Applicable scenarios: Scenarios that require providing mathematical expression calculation capability in an MCP manner, for example, calling expression evaluation in a client that supports MCP.

Limitations:

  • The input expression must be a valid mathematical expression, otherwise an error may be thrown.
  • The service currently only supports interaction through stdio.
  • The project uses the Bun runtime, so ensure that commands are compatible with Bun.
  • Hosted deployment: A hosted deployment is provided on Fronteir AI。