mcpField
M
MCP Calculator Server

MCP Calculator Server

Local
github.com/yinebebtScience & Education0Updated 3d ago

About MCP Calculator Server

MCP Calculator Server is a mathematical calculation MCP server built with the official go-sdk. It is for MCP clients needing calculation tools and math resources, and also provides math prompts, constants, and random number generation.

Key features

  1. 01Precedence, parentheses, and scientific notation
  2. 02Random numbers using probability distributions
  3. 03Mathematical constant resources
  4. 04Prompts for problems and explanations
  5. 05Argument completion and client logging

Use cases

  1. 01Evaluate expressions with parentheses
  2. 02Generate random numbers within a range
  3. 03Look up common mathematical constants
  4. 04Create math problems or explain calculations

MCP support

The MCP server exposes the `calculate` and `random_number` tools, mathematical constants and server information resources, and prompts for math problems and calculation explanations. It supports stdio and streamable-http transports.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

MCP Calculator Server

A Model Context Protocol (MCP) server that provides calculator functionality with robust mathematical operations. Built on the official go-sdk.

Features

Tools
  • calculate: Mathematical operations with proper operator precedence, parentheses support, and scientific notation
  • random_number: Generate random numbers within specified ranges using various probability distributions (uses elicitation when no distribution is given)

Both tools declare tool annotations (read-only, closed-world hints), titles, and structured output schemas.

Resources
  • math://constants: Mathematical constants (π, e, φ, √2, ln2, ln10) in JSON format
  • math://constants/{name}: Resource template — a single constant by name, e.g. math://constants/pi
  • server://info: Server information and capabilities overview
Prompts
  • math_problem: Generate mathematical word problems with configurable difficulty and topics
  • explain_calculation: Step-by-step mathematical expression explanations
Protocol Features
  • Completions: Argument completion for prompt arguments (difficulty, topic) and constant names in the resource template
  • Elicitation: random_number asks the client which distribution to use when not specified
  • Logging: Tool activity is forwarded to the client as MCP log messages (in addition to stderr)
  • Icons & metadata: Server and tool icons, titles, website URL, and instructions
Transport Modes
  • stdio: For local clients (Cursor, Claude Desktop, MCP Inspector). Use this unless you have a reason not to.
  • streamable-http: For trusted networks only. Binds all interfaces with no authentication and no Origin check. Put it behind a reverse proxy that enforces auth (and Origin) or do not expose it.

Defaults:

  • Transport: streamable-http if TRANSPORT is unset (convenient for demos; not a production default)
  • Port: 8080 (PORT)

For anything that is not a throwaway demo, run TRANSPORT=stdio or terminate TLS and auth in front of HTTP.

Installation

Prebuilt binaries for Linux, macOS, and Windows (amd64/arm64) are attached to each GitHub release.

Or install with Go:

go install github.com/yinebebt/mcp-calculator-server@latest

Usage

# Run with stdio
TRANSPORT=stdio mcp-calculator-server

# Run with HTTP (serves MCP at :8080/mcp, health check at /health)
mcp-calculator-server

# Test
go test ./...
MCP Client Configuration

For testing with MCP Client:

{
  "command": "/path/to/mcp-calculator-server",
  "env": {
    "TRANSPORT": "stdio"
  }
}

Mathematical Features

  • Operator precedence: 2+3*4 = 14
  • Parentheses: (2+3)*4 = 20
  • Scientific notation: 1e2 = 100
  • Error detection: Division by zero, invalid syntax, unmatched parentheses, non-finite results (NaN/Inf)

Release

Releases are built with GoReleaser via GitHub Actions. Pushing a vX.Y.Z tag cross-compiles for linux/darwin/windows × amd64/arm64 and attaches archives and checksums to the GitHub release.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.