io.github.tech-sushant/calculator-mcp
A simple Model Context Protocol calculator server
What can you do with io.github.tech-sushant/calculator-mcp?
- 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 zero-division protection)
- power: Raise first number to the power of second number
- sqrt: Calculate square root of a number (with negative number protection)
Install
Add this to your client's MCP configuration (Claude Desktop: claude_desktop_config.json; Cursor: .cursor/mcp.json; VS Code and others use the same "mcpServers" shape).
@tech-sushant/calculator-mcpclaude mcp add calculator-mcp -- npx -y @tech-sushant/calculator-mcp@1.0.3
{
"mcpServers": {
"calculator-mcp": {
"command": "npx",
"args": [
"-y",
"@tech-sushant/calculator-mcp@1.0.3"
]
}
}
}
Documentation
From the project's README on GitHub, refreshed weekly. Links open on GitHub.
Calculator MCP Server
A simple Model Context Protocol (MCP) server that provides basic calculator functionality through MCP tools.
Features
This MCP server provides the following calculator tools:
- 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 zero-division protection)
- power: Raise first number to the power of second number
- sqrt: Calculate square root of a number (with negative number protection)
Installation
- Install dependencies:
bash npm install - Build the TypeScript code:
bash npm run build
Usage
Running the Server
Start the MCP server:
npm start
Or run in development mode:
npm run dev
MCP Client Configuration
To use this calculator MCP server with an MCP client (like Claude Desktop), add it to your MCP configuration:
{
"mcpServers": {
"calculator": {
"command": "node",
"args": ["/path/to/calculator-mcp/dist/index.js"],
"env": {}
}
}
}
Available Tools
add
Adds two numbers together.
- Parameters:
a(number),b(number) - Example:
add(5, 3)returns5 + 3 = 8
subtract
Subtracts the second number from the first.
- Parameters:
a(number),b(number) - Example:
subtract(10, 4)returns10 - 4 = 6
multiply
Multiplies two numbers together.
- Parameters:
a(number),b(number) - Example:
multiply(6, 7)returns6 × 7 = 42
divide
Divides the first number by the second.
- Parameters:
a(number),b(number) - Example:
divide(15, 3)returns15 ÷ 3 = 5 - Error handling: Returns error for division by zero
power
Raises the base to the power of the exponent.
- Parameters:
base(number),exponent(number) - Example:
power(2, 8)returns2^8 = 256
sqrt
Calculates the square root of a number.
- Parameters:
number(number) - Example:
sqrt(16)returns√16 = 4 - Error handling: Returns error for negative numbers
Development
Project Structure
calculator-mcp/
├── src/
│ └── index.ts # Main MCP server implementation
├── dist/ # Compiled JavaScript output
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # This file
Building
npm run build
Development Mode
npm run dev
Error Handling
The calculator includes proper error handling for:
- Division by zero
- Square root of negative numbers
- Invalid tool names
- General execution errors
All errors are returned with appropriate error messages and the isError flag set to true.
License
MIT
Frequently asked questions
What is io.github.tech-sushant/calculator-mcp?
A simple Model Context Protocol calculator server
How do I install io.github.tech-sushant/calculator-mcp?
It runs on your machine. In Claude Code: claude mcp add calculator-mcp -- npx -y @tech-sushant/calculator-mcp@1.0.3. For other clients, paste the JSON configuration from this page into their MCP settings.
Does io.github.tech-sushant/calculator-mcp need an API key?
Its registry entry lists no required key or secret. Some features may still need an account with the service it connects to.
Is io.github.tech-sushant/calculator-mcp open source?
Its code is public on GitHub, but the repository does not declare a standard license.
Who maintains io.github.tech-sushant/calculator-mcp?
It is published by tech-sushant. AI.tn lists it but does not maintain or endorse it.
From the official MCP Registry. Listing is not an endorsement: review a server's code and permissions before giving it access to your data.