logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

math-evaluator-service

A lightweight service designed for executing mathematical formulas. It leverages the 'expr-eval' library and provides predefined mathematical constants such as 'E' and 'PI' for immediate utility. Interaction occurs strictly via standard input/output channels, ensuring a minimal overhead computational utility.

Author

math-evaluator-service logo

pwh-pwh

MIT License

Quick Info

GitHub GitHub Stars 13
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

evaluateapiscalculationsmathematical evaluationsexpr evalusing expr

Calculation Engine Module

Trust Score smithery badge

Expression Solver Utility

Module Overview

This component, referred to as the 'Calculation Engine Module' (cal-mcp), is constructed upon the FastMCP architecture and operates within the Bun runtime environment. Its core functionality involves parsing and resolving mathematical expressions supplied by the user, communicating via the standard I/O stream. The objective is to deliver a highly performant and resource-efficient utility for quantitative assessments, inclusive of fundamental arithmetic operations and readily available numeric constants.

Capabilities

  • Formula Computation: Accepts mathematical strings as input and returns the computed numerical outcome.
  • Predefined Constants: Integrates essential mathematical values:
    • E: Corresponds to Math.E within the Bun context.
    • PI: Corresponds to Math.PI within the Bun context.
    • true: Represents the boolean truth value.
    • false: Represents the boolean falsity value.
  • Executable Identifier: cal.
  • Input Parameter: Requires a single string argument representing the mathematical expression (aliased as exp).

Dependencies

  • fastmcp: Framework for constructing the MCP interface.
  • expr-eval: Engine responsible for expression parsing and evaluation.
  • zod: Utilized for strict input schema validation.

Prerequisites

  • Installation of the Bun runtime is mandatory (latest version recommended).

Deployment

Automated Setup via Smithery

To integrate cal-mcp automatically into Claude Desktop using Smithery:

bash npx -y @smithery/cli install @pwh-pwh/cal-mcp --client claude

Client Configuration Snippet

"cal-mcp": { "name": "运算", "description": "", "isActive": true, "command": "bunx", "args": [ "cal-mcp" ] }

Manual Bootstrap

  1. Clone the source repository: bash git clone

  2. Navigate into the project directory and install required packages: bash bun install

Operational Guide

  1. Initiate the server process: bash bun run index.ts

The service will commence operation, listening on STDIN/STDOUT.

  1. Supply a mathematical expression for processing:

    • Example Input: 2 + 3 * PI
    • Expected Output: The computed result (returned as a text string).
  2. Illustrative Calculation Examples:

    • Simple Addition: 2 + 2 yields 4
    • Constant Utilization: PI * 2 results in 6.283185307179586
    • Advanced Formula: E ^ 2 + 1 evaluates to 8.38905609893065

Operational Notes

  • Input strings must conform strictly to valid mathematical syntax; non-compliant expressions may trigger runtime errors.
  • Communication is exclusively facilitated through the standard I/O interface.
  • As this module depends on the Bun runtime, ensure all invoked commands are compatible with the Bun execution environment.

See Also

`