Get the FREE Ultimate OpenClaw Setup Guide →

cal

用于计算数学表达式的MCP

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio pwh-pwh-cal-mcp node index.ts \
  --env BUN_RUNTIME=" Bun runtime is recommended; placeholder if not using Bun (required for actual deployment)"

How to use

Cal MCP is a lightweight mathematical expression calculator built on the FastMCP framework. It exposes a single tool named cal that accepts a string expression and returns the computed result. The server leverages the expr-eval library to parse and evaluate expressions and provides built-in constants such as E, PI, true, and false. You interact with the server via standard input/output (stdio), sending an expression like 'PI * 2' and receiving the computed value as a string in response. This makes Cal suitable for quick arithmetic tasks, embedding in pipelines, or as a simple evaluation service within larger MCP handlers.

How to install

Prerequisites:

  • A runtime environment capable of executing the server (the project is described to run with Bun, but the MCP entry in this document uses a Node-based invocation as a placeholder).
  • Git installed to clone the repository if you have access to the source.

Step-by-step installation:

  1. Clone the repository (replace <repo-url> with the actual URL): git clone <repo-url>
  2. Install dependencies (example using Bun; replace with your preferred runtime if Bun is not available): bun install
  3. Start the server (using Bun as described in the project): bun run index.ts

If you must use Node directly, ensure you transpile TS to JS or adjust to a TS runner that can execute index.ts in your environment.

Additional notes

Notes and tips:

  • The server uses stdio for input/output; ensure you connect to the process's stdin/stdout when integrating with other MCP components.
  • Built-in constants: E (Math.E), PI (Math.PI), true, false.
  • The project relies on FastMCP, expr-eval, and zod for parameter validation; verify versions in your environment if you fork or modify the code.
  • If you encounter expression parsing errors, confirm the expression is syntactically valid and uses supported constants (PI, E) or built-in logical literals (true, false).
  • When deploying outside Bun, ensure the runtime can execute TypeScript directly or compile to JavaScript beforehand.

Related MCP Servers

Sponsor this space

Reach thousands of developers