Content
# Simple Calculator MCP Tool
This is a simple calculator MCP (Model Context Protocol) tool that provides basic mathematical operations.
<!-- MCP_SERVER_CONFIG_START -->
```json
{
"name": "simple-calculator-mcp",
"version": "1.0.0",
"description": "A simple calculator MCP tool that provides basic mathematical operations",
"author": "SanLangLOVE",
"license": "MIT",
"runtime": "node",
"entry": "dist/index.js",
"dependencies": {
"@modelcontextprotocol/sdk": "^0.4.0"
},
"tools": [
{
"name": "add",
"description": "Calculate the sum of two numbers",
"parameters": {
"type": "object",
"properties": {
"a": {
"type": "number",
"description": "The first number"
},
"b": {
"type": "number",
"description": "The second number"
}
},
"required": ["a", "b"]
}
},
{
"name": "subtract",
"description": "Calculate the difference between two numbers",
"parameters": {
"type": "object",
"properties": {
"a": {
"type": "number",
"description": "Minuend"
},
"b": {
"type": "number",
"description": "Subtrahend"
}
},
"required": ["a", "b"]
}
},
{
"name": "multiply",
"description": "Calculate the product of two numbers",
"parameters": {
"type": "object",
"properties": {
"a": {
"type": "number",
"description": "The first number"
},
"b": {
"type": "number",
"description": "The second number"
}
},
"required": ["a", "b"]
}
},
{
"name": "divide",
"description": "Calculate the quotient of two numbers",
"parameters": {
"type": "object",
"properties": {
"a": {
"type": "number",
"description": "Dividend"
},
"b": {
"type": "number",
"description": "Divisor"
}
},
"required": ["a", "b"]
}
},
{
"name": "power",
"description": "Calculate the power of a number",
"parameters": {
"type": "object",
"properties": {
"base": {
"type": "number",
"description": "Base"
},
"exponent": {
"type": "number",
"description": "Exponent"
}
},
"required": ["base", "exponent"]
}
}
]
}
```
<!-- MCP_SERVER_CONFIG_END -->
## Features
- Addition
- Subtraction
- Multiplication
- Division
- Exponentiation
## Installation and Setup
### 1. Install Dependencies
```bash
npm install
```
### 2. Build the Project
```bash
npm run build
```
### 3. Configure MCP Client
Add the following configuration to your MCP client configuration file:
#### For Claude Desktop (macOS)
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
```json
{
"mcpServers": {
"simple-calculator": {
"command": "node",
"args": ["/Users/sanrosang/Documents/mcp/dist/index.js"],
"env": {}
}
}
}
```
#### For Other MCP Clients
Add the corresponding server configuration according to your MCP client documentation.
## Usage
After starting the MCP client, you can use the following tools:
### 1. Addition (add)
- Parameters: `a` (number), `b` (number)
- Example: Calculate 5 + 3
### 2. Subtraction (subtract)
- Parameters: `a` (minuend), `b` (subtrahend)
- Example: Calculate 10 - 4
### 3. Multiplication (multiply)
- Parameters: `a` (number), `b` (number)
- Example: Calculate 6 × 7
### 4. Division (divide)
- Parameters: `a` (dividend), `b` (divisor)
- Example: Calculate 15 ÷ 3
- Note: The divisor cannot be zero
### 5. Exponentiation (power)
- Parameters: `base` (base), `exponent` (exponent)
- Example: Calculate 2^8
## Development
### Run Development Version
```bash
npm run dev
```
### Project Structure
```
├── src/
│ └── index.ts # Main program file
├── dist/ # Compiled output directory
├── package.json # Project configuration
├── tsconfig.json # TypeScript configuration
└── README.md # Documentation
```
## Extending Functionality
You can add more features by modifying the `src/index.ts` file:
1. Add new tool definitions in the `tools` array
2. Add corresponding handling logic in the `CallToolRequestSchema` processing function
## License
MIT License
## ModelScope Deployment
This project is configured to support deployment on the ModelScope platform. Key configuration information:
- **Runtime**: Node.js
- **Entry File**: `dist/index.js`
- **Dependency Management**: npm
- **Build Command**: `npm run build`
- **Start Command**: `node dist/index.js`
### Deployment Requirements
1. Ensure the project is built (`npm run build`)
2. Ensure all dependencies are installed (`npm install`)
3. Ensure the `dist/index.js` file exists and is executable
### ModelScope Platform Configuration
In the settings page of the ModelScope platform, use the following configuration:
**Service Name**: `mcp-calculator`
**Service Description**: `A simple calculator MCP tool that provides basic mathematical operations`
**Runtime Environment**: `Node.js`
**Start Command**: `node dist/index.js`
**Working Directory**: `/`
### Tool List
This MCP server provides the following tools:
1. **add** - Addition
2. **subtract** - Subtraction
3. **multiply** - Multiplication
4. **divide** - Division
5. **power** - Exponentiation
All tools support numeric type parameters and provide a complete error handling mechanism.
### Environment Variables
```json
{
"NODE_ENV": "production"
}
```
### Health Check
The service supports the MCP protocol standard health check to ensure the service is running properly.
Connection Info
You Might Also Like
markitdown
Python tool for converting files and office documents to Markdown.
everything-claude-code
Complete Claude Code configuration collection - agents, skills, hooks,...
awesome-claude-skills
A curated list of awesome Claude Skills, resources, and tools for...
antigravity-awesome-skills
The Ultimate Collection of 130+ Agentic Skills for Claude...
openfang
Open-source Agent Operating System
memU
MemU is a memory framework for LLM and AI agents, organizing multimodal...