Skip to main content
Glama
Yash-synergy

basic-mcp-calculator-server

by Yash-synergy

Basic MCP Calculator Server

A simple Model Context Protocol (MCP) server that provides basic calculator functionality.

Features

  • Add: Add two numbers together

  • Subtract: Subtract second number from first number

  • Multiply: Multiply two numbers together

  • Divide: Divide first number by second number (with division by zero protection)

Related MCP server: Calculator MCP Server

Installation

  1. Install dependencies:

npm install
  1. Build the project:

npm run build

Usage

Running the Server

npm start

The server runs on stdio and communicates using the MCP protocol.

Available Tools

  • add(a, b) - Returns the sum of a and b

  • subtract(a, b) - Returns a minus b

  • multiply(a, b) - Returns the product of a and b

  • divide(a, b) - Returns a divided by b

Example MCP Configuration

Add this to your MCP client configuration:

{
  "mcpServers": {
    "calculator": {
      "command": "node",
      "args": ["path/to/basic-mcp-calculator-server/dist/index.js"]
    }
  }
}

Development

npm run dev

This will build and start the server in one command.

License

MIT

Available Tools

4 tools
addA

Add two numbers together

ParametersJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

TDQS

A4/5.0
Behavior3/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. It accurately states the core operation but does not explicitly mention the return value (the sum) or any error conditions. For a pure arithmetic operation this is a minor gap, but a strictly higher score would require more explicit behavioral disclosure.

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, tightly worded sentence that wastes no words and front-loads the operation. It is concise and well-structured for a simple tool.

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

Completeness4/5

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

For a two-number arithmetic tool, the description is largely complete: it specifies the operation and the schema defines required inputs. There is no output schema or annotations, but the expected result (the sum) is universally implied. A slightly higher score would require explicit mention of return type or edge cases, which are low-risk here.

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?

Input schema covers both parameters fully (100% coverage) with descriptions for 'a' and 'b'. The tool description adds no parameter-level semantic detail beyond indicating the operation is addition, which is expected. Baseline 3 is appropriate when schema already documents parameters.

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

Purpose5/5

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

The description 'Add two numbers together' uses a specific verb (add) and resource (two numbers), clearly distinguishing it from sibling arithmetic tools like subtract, multiply, and divide. An agent can immediately understand what this tool does and how it differs from alternatives.

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

Usage Guidelines4/5

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

The description clearly implies the context of use: whenever addition of two numbers is needed. Though it doesn't explicitly enumerate when not to use it versus alternatives, the semantic clarity of 'add' combined with the sibling names makes the choice unambiguous.

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

divideA

Divide first number by second number

ParametersJSON Schema
NameRequiredDescriptionDefault
aYesDividend (number to be divided)
bYesDivisor (number to divide by)

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations, the description must carry the behavioral burden; it clearly indicates the core operation and argument order. However, it does not disclose edge-case behavior such as division by zero or the shape of the return value, and no output schema is provided.

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?

One short sentence with no filler; every word earns its place and the core action plus operand order are front-loaded.

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?

The tool is simple and the schema fully covers parameters, so little extra is required. Still, without an output schema or mention of zero-divisor/error behavior, the agent must assume the return format and failure semantics.

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 already documents both parameters at 100% coverage with descriptions 'Dividend' and 'Divisor'. The description's 'first number'/'second number' wording reinforces order but adds no semantic detail beyond the schema.

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

Purpose5/5

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

The description states a specific verb and resource: divide two numbers, with explicit operand order. The operation is immediately distinguishable from sibling tools add, subtract, and multiply.

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 intended use is implied by the name and the verb 'divide', but there is no explicit statement of when to choose this over add/subtract/multiply or any exclusions. For a basic arithmetic tool this is adequate but not explicit.

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

multiplyB

Multiply two numbers together

ParametersJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

TDQS

B3.4/5.0
Behavior3/5

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

No annotations are provided, so the description carries the behavioral burden. It clearly indicates a pure arithmetic operation, but it does not mention return behavior, edge cases, or any potential side effects. For a simple multiplication tool, this is adequate but not rich.

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?

A single, tightly written sentence with no redundant explanation. It is appropriately sized for the simplicity of the operation and is immediately understandable.

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

Completeness4/5

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

Given the simplicity of a two-number multiplication, the description plus schema is sufficient for an agent to invoke the tool. There is no output schema, but the result is naturally inferable from the operation described.

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?

Schema description coverage is 100%, so the schema already documents both parameters clearly. The description adds no additional meaning beyond what the parameter names and descriptions provide.

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 states the operation ('multiply') and the target ('two numbers'), which is clear and specific. It doesn't explicitly differentiate from siblings like add, subtract, and divide, but the operation itself is unambiguous enough for selection.

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?

There is no guidance about when to use this tool versus the sibling tools. The description simply states what it does, leaving the agent to infer that it should be used when multiplication is needed.

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

subtractB

Subtract second number from first number

ParametersJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

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 must disclose behavior. It states the core operation but does not mention potential edge cases (e.g., floating-point precision, negative results) or return behavior. For such a simple numeric operation, this is a minor gap but still leaves room for improvement.

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 with no redundant words. It is appropriately sized and front-loaded with the essential operation.

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?

For a simple arithmetic tool with no output schema and no annotations, the description is fairly complete. It covers the operation and parameter order. However, it does not explicitly state edge cases or the exact return format, but those are minor given 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?

Schema description coverage is 100%, with each parameter described as 'First number' and 'Second number.' The description reinforces the order (first minus second) but adds no extra semantic meaning beyond the schema. Baseline 3 is appropriate.

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 operation: 'Subtract second number from first number.' It specifies the verb (subtract) and the resource (numbers), making it distinct from siblings like add, multiply, and divide.

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 it (when subtraction is needed) and its order-sensitivity (second from first), but it does not explicitly mention alternatives or when not to use it. Since the siblings are mathematical operations, the usage context is fairly obvious.

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. 4 tool updatesv1.0.0
    • First observedadd
    • First observeddivide
    • First observedmultiply
    • First observedsubtract

TDQS

A4/5.0

Scored across 4 tools

Disambiguation5/5

Each tool performs a distinct arithmetic operation with no overlap. An agent can easily select the correct tool for the intended calculation.

Naming Consistency5/5

All tool names are single lowercase verbs representing the operation: add, subtract, multiply, divide. The naming pattern is perfectly uniform and intuitive.

Tool Count5/5

Four tools is exactly right for a basic calculator, covering the essential operations without any redundancy or unnecessary extras.

Completeness5/5

The four basic arithmetic operations provide complete coverage for the stated purpose of a basic calculator. There are no obvious gaps in functionality.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A simple MCP server that provides basic calculator functionality for performing mathematical operations. Built with FastMCP and demonstrates fundamental MCP server implementation patterns.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    A simple MCP server that provides calculator tools for basic arithmetic operations with zero-division protection.
    27 npm
    ISC
  • F
    license
    Not graded
    quality
    D
    maintenance
    A simple MCP server that provides a calculator tool for basic arithmetic operations.
    5 npm
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    MCP server that offers basic arithmetic operations (addition, subtraction, multiplication, division) via HTTP.
    -