Skip to main content
Glama
bahfahh

Basic Math MCP Server

by bahfahh

Basic Math MCP Server

A simple Model Context Protocol (MCP) server that provides basic mathematical operations.

Features

This MCP server provides two tools:

  • sum: Add two numbers together

  • subtraction: Subtract the second number from the first number

Related MCP server: MCP Add Server

Installation

  1. Install dependencies:

npm install
  1. Build the TypeScript code:

npm run build

Usage

Testing the server directly

npm start

Connecting to AI clients (Claude Desktop, etc.)

  1. Copy the mcp.json configuration to your AI client's MCP configuration directory

  2. Update the path in mcp.json to point to your server's location

  3. Restart your AI client

Configuration for Claude Desktop

Add this to your Claude Desktop MCP configuration file:

{
  "mcpServers": {
    "basic-math-server": {
      "command": "node",
      "args": ["/path/to/your/project/build/index.js"],
      "cwd": "/path/to/your/project",
      "description": "A basic math server providing sum and subtraction operations"
    }
  }
}

Available Tools

sum

  • Description: Add two numbers together

  • Parameters:

    • a (number): First number

    • b (number): Second number

  • Returns: The sum of the two numbers

subtraction

  • Description: Subtract the second number from the first number

  • Parameters:

    • a (number): First number (minuend)

    • b (number): Second number (subtrahend)

  • Returns: The result of a - b

Development

  • Build: npm run build

  • Start: npm start

  • Development: npm run dev (builds and starts)

Project Structure

├── src/
│   └── index.ts          # Main server implementation
├── build/                # Compiled JavaScript output
├── package.json          # Node.js dependencies and scripts
├── tsconfig.json         # TypeScript configuration
├── mcp.json              # MCP server configuration
└── README.md             # This file

Available Tools

2 tools
subtractionB

Subtract the second number from the first number

ParametersJSON Schema
NameRequiredDescriptionDefault
aYesFirst number (minuend)
bYesSecond number (subtrahend)

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description only states what the tool does mathematically without addressing behavioral aspects like error handling (e.g., for non-numeric inputs), performance characteristics, or output format. This leaves significant gaps in understanding how the tool behaves beyond its basic function.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that directly states the tool's function without any unnecessary words. It is front-loaded with the core action and efficiently communicates the essential information, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (simple arithmetic operation) and the absence of both annotations and an output schema, the description is minimally adequate. It covers the basic purpose but lacks details on behavioral traits, error handling, and return values, which are important for a complete understanding despite the tool's simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with both parameters 'a' and 'b' clearly documented as 'First number (minuend)' and 'Second number (subtrahend)' respectively. The description adds minimal value beyond this, only reinforcing the order of subtraction without providing additional syntax or format details. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Subtract') and identifies the resources involved ('the second number from the first number'). It distinguishes from the sibling 'sum' tool by specifying subtraction rather than addition. However, it doesn't explicitly name the sibling alternative, keeping it from a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use this tool (when subtraction is needed) versus the 'sum' sibling tool (when addition is needed), but this is only through contextual inference rather than explicit guidance. No explicit when-not-to-use scenarios or alternative tools are mentioned, making the guidance incomplete.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

sumC

Add two numbers together

ParametersJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It only states the basic function without mentioning any behavioral traits like error handling, performance characteristics, or what happens with non-numeric inputs. This leaves significant gaps for an AI agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise at just four words, front-loading the essential information with zero wasted words. Every word earns its place in communicating the core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is insufficiently complete. It doesn't explain what the tool returns (sum result format), error conditions, or behavioral constraints. For even a simple tool, this leaves the AI agent with incomplete operational understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage with clear parameter documentation, so the description doesn't need to add parameter details. The description doesn't provide any additional parameter semantics beyond what's in the schema, which is acceptable given the comprehensive schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Add') and resource ('two numbers'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from the sibling 'subtraction' tool, which would be helpful for an AI agent choosing between them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus the sibling 'subtraction' tool, nor any context about appropriate use cases. It simply states what the tool does without addressing when it should be selected.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updates
    • First observedsubtraction
    • First observedsum

TDQS

B3.1/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have perfectly distinct purposes: 'sum' for addition and 'subtraction' for subtraction. There is no overlap or ambiguity between them, making it impossible for an agent to confuse which tool to use for each operation.

Naming Consistency4/5

The tool names are clear and descriptive ('sum' and 'subtraction'), but they do not follow a strict verb_noun pattern. 'sum' is a noun while 'subtraction' is a noun, which is slightly inconsistent, though both are readable and functional for this simple domain.

Tool Count2/5

With only 2 tools, the server feels too thin for a 'Basic Math' domain, as it lacks fundamental operations like multiplication, division, or more advanced functions. This minimal set limits the server's utility and scope, making it incomplete for typical math tasks.

Completeness2/5

The tool surface is severely incomplete for a basic math server, missing essential operations such as multiplication, division, exponentiation, and handling of more than two numbers. This creates significant gaps that will cause agent failures when trying to perform common mathematical tasks.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A simple implementation of a Model Context Protocol server that demonstrates core functionality including mathematical tools (add, subtract) and personalized greeting resources.
    95
    GPL 3.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    A basic implementation of a Model Context Protocol server that demonstrates core functionality with simple math tools (add, subtract) and greeting resources for AI assistants like Claude.
    GPL 3.0