jamesburton/CalculatorMcpServer
If you are the rightful owner of CalculatorMcpServer and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Calculator MCP Server is a simple calculator implementation using the Model Context Protocol (MCP) built with .NET 9 and MCPSharp.
Calculator MCP Server
A simple calculator implementation using the Model Context Protocol (MCP) built with .NET 9 and MCPSharp.
Features
This MCP server provides the following calculator tools:
- add: Adds two numbers
- subtract: Subtracts the second number from the first
- multiply: Multiplies two numbers
- divide: Divides the first number by the second (with division by zero protection)
- square: Squares a number
Installation
Option 1: Download Pre-built Binaries
Download the latest release for your platform from the Releases page:
- Windows:
CalculatorMcpServer-win-x64.zip
orCalculatorMcpServer-win-arm64.zip
- Linux:
CalculatorMcpServer-linux-x64.tar.gz
orCalculatorMcpServer-linux-arm64.tar.gz
- macOS:
CalculatorMcpServer-osx-x64.tar.gz
orCalculatorMcpServer-osx-arm64.tar.gz
Extract the archive and run the executable directly - no .NET runtime installation required!
Option 2: Docker Container
Pull and run the latest Docker image:
# Pull from GitHub Container Registry
docker pull ghcr.io/jamesburton/calculatormcpserver:latest
# Run the container
docker run -it ghcr.io/jamesburton/calculatormcpserver:latest
Option 3: Build from Source
Requirements:
- .NET 9.0 SDK or later
git clone https://github.com/jamesburton/CalculatorMcpServer.git
cd CalculatorMcpServer
dotnet build --configuration Release
dotnet run --project CalculatorMcpServer
Usage
Basic Usage
Run the calculator MCP server:
# From extracted binary
./CalculatorMcpServer
# From Docker
docker run -it ghcr.io/jamesburton/calculatormcpserver:latest
# From source
dotnet run --project CalculatorMcpServer
The server will start and listen for MCP connections. You'll see:
Calculator MCP Server is running. Press Enter to exit.
MCP Client Integration
Claude Desktop Configuration
Add the following to your Claude Desktop configuration file:
Windows: %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": []
}
}
}
Replace /path/to/CalculatorMcpServer
with the actual path to your executable.
Docker Integration
{
"mcpServers": {
"calculator": {
"command": "docker",
"args": ["run", "-i", "ghcr.io/jamesburton/calculatormcpserver:latest"]
}
}
}
Available Tools
Once connected, you can use these calculator functions:
-
add(a, b) - Add two numbers
add(5, 3) ā 8
-
subtract(a, b) - Subtract b from a
subtract(10, 4) ā 6
-
multiply(a, b) - Multiply two numbers
multiply(6, 7) ā 42
-
divide(a, b) - Divide a by b
divide(15, 3) ā 5.0
-
square(a) - Square a number
square(4) ā 16
Development
Project Structure
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
Building
# Build the solution
dotnet build
# Run tests
dotnet test
# Create a release build
dotnet publish --configuration Release --runtime win-x64 --self-contained
Testing
The project includes comprehensive unit tests:
# Run all tests
dotnet test
# Run tests with coverage
dotnet test --collect:"XPlat Code Coverage"
Docker Development
# Build the Docker image
docker build -t calculator-mcp-server .
# Run the container
docker run -it calculator-mcp-server
Cross-Platform Support
This project supports the following platforms:
- Windows: x64, ARM64
- Linux: x64, ARM64
- macOS: x64, ARM64 (Apple Silicon)
All builds are available as self-contained executables that don't require .NET runtime installation.
CI/CD Pipeline
The project uses GitHub Actions for automated:
- Testing: Runs unit tests on every push and PR
- Cross-platform builds: Creates binaries for all supported platforms
- Docker builds: Multi-architecture container images (AMD64, ARM64)
- Releases: Automatic releases with binaries and container images on version tags
Container Registry
Docker images are published to GitHub Container Registry:
ghcr.io/jamesburton/calculatormcpserver:latest
- Latest from main branchghcr.io/jamesburton/calculatormcpserver:v1.0.0
- Specific version tags
Note: The CI/CD pipeline uses the built-in GITHUB_TOKEN
for authentication to GitHub Container Registry.
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Please ensure your code:
- Includes appropriate unit tests
- Follows the existing code style
- Has clear commit messages
License
This project is licensed under the MIT License - see the file for details.
Dependencies
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Changelog
See for version history and changes.