Token导航 LogoToken导航TokenDH.com
calculatormcpserver logo
AI代理stdio官方级别未说明来源级核验

calculatormcpserver

MCP Server

一个基于Model Context Protocol (MCP)的简单计算器实现,提供加、减、乘、除和平方运算功能,支持多种平台部署。

工具数

5

提示词数

0

GitHub Stars

0

资源数

0
.NET开发C#Claude跨平台Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

jamesburton

提供方

jamesburton

最后核验

2026/5/17 20:22

运行时

Docker

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

docker run -it ghcr.io/jamesburton/calculatormcpserver:latest

详细介绍

计算器MCP服务器

使用与构建的模型上下文协议(MCP)的简单计算器实现。NET 9和MCPSharp。

![Build and Release](https://github.com/jamesburton/CalculatorMcpServer/actions/workflows/build-and-release.yml) ![License: MIT](https://opensource.org/licenses/MIT)

特性

此MCP服务器提供以下计算器工具:

  • 添加:将两个数字相加
  • 减去:从第一个数字中减去第二个数字
  • :将两个数字相乘
  • 分割:将第一个数字除以第二个数字(具有除零保护)
  • 正方形:将一个数字平方

安装

选项1:下载预构建的二进制文件

从以下网址下载适用于您平台的最新版本 发布页面:

  • 视窗: CalculatorMcpServer-win-x64.zipCalculatorMcpServer-win-arm64.zip
  • Linux: CalculatorMcpServer-linux-x64.tar.gzCalculatorMcpServer-linux-arm64.tar.gz
  • macOS: CalculatorMcpServer-osx-x64.tar.gzCalculatorMcpServer-osx-arm64.tar.gz

解压缩存档并直接运行可执行文件-否。NET运行时安装是必需的!

选项2:Docker容器

拉取并运行最新的Docker镜像:

# Pull from GitHub Container Registry
docker pull ghcr.io/jamesburton/calculatormcpserver:latest

# Run the container
docker run -it ghcr.io/jamesburton/calculatormcpserver:latest

选项3:从源代码构建

要求:

  • .NET 9.0 SDK或更高版本
git clone https://github.com/jamesburton/CalculatorMcpServer.git
cd CalculatorMcpServer
dotnet build --configuration Release
dotnet run --project CalculatorMcpServer

用法

基本用法

运行计算器MCP服务器:

# From extracted binary
./CalculatorMcpServer

# From Docker
docker run -it ghcr.io/jamesburton/calculatormcpserver:latest

# From source
dotnet run --project CalculatorMcpServer

服务器将启动并监听MCP连接。您将看到:

Calculator MCP Server is running. Press Enter to exit.

MCP客户端集成

Claude桌面配置

将以下内容添加到您的Claude Desktop配置文件中:

视窗: %APPDATA%\Claude\claude_desktop_config.json macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "calculator": {
      "command": "/path/to/CalculatorMcpServer",
      "args": []
    }
  }
}

替换 /path/to/CalculatorMcpServer 带有可执行文件的实际路径。

Docker集成

{
  "mcpServers": {
    "calculator": {
      "command": "docker",
      "args": ["run", "-i", "ghcr.io/jamesburton/calculatormcpserver:latest"]
    }
  }
}

可用工具

连接后,您可以使用以下计算器功能:

  1. 添加(a,b) -加两个数字
   add(5, 3) → 8
  1. 减去(a,b) -从a中减去b
   subtract(10, 4) → 6
  1. 乘(a,b) -将两个数字相乘
   multiply(6, 7) → 42
  1. 分割(a,b) -将a除以b
   divide(15, 3) → 5.0
  1. 正方形(a) -将一个数字平方
   square(4) → 16

发展

项目结构

CalculatorMcpServer/
├── CalculatorMcpServer/          # Main project
│   ├── Calculator.cs             # Calculator implementation
│   ├── Program.cs               # Entry point
│   └── CalculatorMcpServer.csproj
├── CalculatorMcpServer.Tests/    # Unit tests
│   ├── CalculatorTests.cs       # Test cases
│   └── CalculatorMcpServer.Tests.csproj
├── .github/workflows/           # CI/CD pipelines
├── Dockerfile                   # Container definition
└── README.md                   # This file

建筑

# Build the solution
dotnet build

# Run tests
dotnet test

# Create a release build
dotnet publish --configuration Release --runtime win-x64 --self-contained

测试

该项目包括全面的单元测试:

# Run all tests
dotnet test

# Run tests with coverage
dotnet test --collect:"XPlat Code Coverage"

Docker开发

# Build the Docker image
docker build -t calculator-mcp-server .

# Run the container
docker run -it calculator-mcp-server

与跨平台支持

该项目支持以下平台:

  • 视窗:x64,ARM64
  • Linux:x64,ARM64
  • macOS:x64,ARM64(苹果硅)

所有构建都可以作为不需要的自包含可执行文件提供。NET运行时安装。

CI/CD管道

该项目使用GitHub Actions进行自动化:

  • 测试:对每个推送和PR运行单元测试
  • 跨平台构建:为所有支持的平台创建二进制文件
  • Docker构建:多架构容器映像(AMD64、ARM64)
  • 发布:在版本标签上自动发布二进制文件和容器映像

集装箱登记处

Docker镜像发布到GitHub容器注册表:

  • ghcr.io/jamesburton/calculatormcpserver:latest -主分行最新消息
  • ghcr.io/jamesburton/calculatormcpserver:v1.0.0 -特定版本标签

备注:CI/CD管道使用内置 GITHUB_TOKEN 用于GitHub容器注册表的身份验证。

贡献

  1. 分叉存储库
  2. 创建要素分支(git checkout -b feature/amazing-feature)
  3. 提交您的更改(git commit -m 'Add some amazing feature')
  4. 推到分支(git push origin feature/amazing-feature)
  5. 打开拉取请求

请确保您的代码:

  • 包括适当的单元测试
  • 遵循现有代码样式
  • 有明确的提交消息

许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

依赖项

支持

  • 问题:
  • 讨论:

更新日志

更改日志.md 查看版本历史和更改。

目录标签

目录标签

.NET开发C#Claude跨平台计算器本地部署MCP协议

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Docker

工具数量(toolCount,工具数)

5

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP