Simple Calculator MCP
Provides basic mathematical operations including addition, subtraction, multiplication, division, and power calculations through a Model Context Protocol interface.
README
简单计算器MCP工具
这是一个简单的计算器MCP(Model Context Protocol)工具,提供基本的数学运算功能。
<!-- MCP_SERVER_CONFIG_START -->
{
"name": "simple-calculator-mcp",
"version": "1.0.0",
"description": "一个简单的计算器MCP工具,提供基本的数学运算功能",
"author": "SanLangLOVE",
"license": "MIT",
"runtime": "node",
"entry": "dist/index.js",
"dependencies": {
"@modelcontextprotocol/sdk": "^0.4.0"
},
"tools": [
{
"name": "add",
"description": "计算两个数字的和",
"parameters": {
"type": "object",
"properties": {
"a": {
"type": "number",
"description": "第一个数字"
},
"b": {
"type": "number",
"description": "第二个数字"
}
},
"required": ["a", "b"]
}
},
{
"name": "subtract",
"description": "计算两个数字的差",
"parameters": {
"type": "object",
"properties": {
"a": {
"type": "number",
"description": "被减数"
},
"b": {
"type": "number",
"description": "减数"
}
},
"required": ["a", "b"]
}
},
{
"name": "multiply",
"description": "计算两个数字的乘积",
"parameters": {
"type": "object",
"properties": {
"a": {
"type": "number",
"description": "第一个数字"
},
"b": {
"type": "number",
"description": "第二个数字"
}
},
"required": ["a", "b"]
}
},
{
"name": "divide",
"description": "计算两个数字的商",
"parameters": {
"type": "object",
"properties": {
"a": {
"type": "number",
"description": "被除数"
},
"b": {
"type": "number",
"description": "除数"
}
},
"required": ["a", "b"]
}
},
{
"name": "power",
"description": "计算一个数字的幂",
"parameters": {
"type": "object",
"properties": {
"base": {
"type": "number",
"description": "底数"
},
"exponent": {
"type": "number",
"description": "指数"
}
},
"required": ["base", "exponent"]
}
}
]
}
<!-- MCP_SERVER_CONFIG_END -->
功能特性
- 加法运算
- 减法运算
- 乘法运算
- 除法运算
- 幂运算
安装和设置
1. 安装依赖
npm install
2. 构建项目
npm run build
3. 配置MCP客户端
在你的MCP客户端配置文件中添加以下配置:
对于Claude Desktop (macOS)
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"simple-calculator": {
"command": "node",
"args": ["/Users/sanrosang/Documents/mcp/dist/index.js"],
"env": {}
}
}
}
对于其他MCP客户端
根据你的MCP客户端文档,添加相应的服务器配置。
使用方法
启动MCP客户端后,你可以使用以下工具:
1. 加法 (add)
- 参数:
a(数字),b(数字) - 示例:计算 5 + 3
2. 减法 (subtract)
- 参数:
a(被减数),b(减数) - 示例:计算 10 - 4
3. 乘法 (multiply)
- 参数:
a(数字),b(数字) - 示例:计算 6 × 7
4. 除法 (divide)
- 参数:
a(被除数),b(除数) - 示例:计算 15 ÷ 3
- 注意:除数不能为零
5. 幂运算 (power)
- 参数:
base(底数),exponent(指数) - 示例:计算 2^8
开发
运行开发版本
npm run dev
项目结构
├── src/
│ └── index.ts # 主程序文件
├── dist/ # 编译输出目录
├── package.json # 项目配置
├── tsconfig.json # TypeScript配置
└── README.md # 说明文档
扩展功能
你可以通过修改 src/index.ts 文件来添加更多功能:
- 在
tools数组中添加新的工具定义 - 在
CallToolRequestSchema处理函数中添加对应的处理逻辑
许可证
MIT License
ModelScope 部署
本项目已配置为支持ModelScope平台部署。主要配置信息:
- 运行时: Node.js
- 入口文件:
dist/index.js - 依赖管理: npm
- 构建命令:
npm run build - 启动命令:
node dist/index.js
部署要求
- 确保项目已构建(
npm run build) - 确保所有依赖已安装(
npm install) - 确保
dist/index.js文件存在且可执行
ModelScope平台配置
在ModelScope平台的设置页面中,使用以下配置:
服务名称: mcp-calculator
服务描述: 一个简单的计算器MCP工具,提供基本的数学运算功能
运行环境: Node.js
启动命令: node dist/index.js
工作目录: /
工具列表
本MCP服务器提供以下工具:
- add - 加法运算
- subtract - 减法运算
- multiply - 乘法运算
- divide - 除法运算
- power - 幂运算
所有工具都支持数字类型参数,并提供完整的错误处理机制。
环境变量
{
"NODE_ENV": "production"
}
健康检查
服务支持MCP协议标准健康检查,确保服务正常运行。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.