@halfords-pro/calculator
Provides precise decimal arithmetic and Excel-style rounding for accounting and tax calculations via MCP protocol.
README
@halfords-pro/calculator
An MCP (Model Context Protocol) server providing calculator tools with precise decimal arithmetic, suitable for accounting and tax calculations.
Features
- Precise decimal arithmetic — uses decimal.js to avoid floating-point errors
- Excel-style rounding — round half away from zero (ROUND_HALF_UP), the standard for accounting and tax
- MCP protocol — integrates with any MCP-compatible client (Claude Desktop, Claude Code, etc.)
Installation
npm install -g @halfords-pro/calculator
Usage
Claude Desktop
Add to your Claude Desktop configuration (claude_desktop_config.json):
{
"mcpServers": {
"calculator": {
"command": "npx",
"args": ["-y", "@halfords-pro/calculator"]
}
}
}
Claude Code
claude mcp add calculator -- npx -y @halfords-pro/calculator
Tools
sum
Sum an array of signed decimal numbers and round the result to a specified number of decimal places.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
values |
number[] |
Yes | Array of signed decimal numbers to sum |
decimalPlaces |
number |
Yes | Number of decimal places to round the result to |
Examples:
sum({ values: [1.00, -2.50, 3.89], decimalPlaces: 2 })
→ "2.39"
sum({ values: [1.00, -2.50, 3.89283829, -539.38390293], decimalPlaces: 4 })
→ "-536.9911"
sum({ values: [0.1, 0.2], decimalPlaces: 2 })
→ "0.30" (not 0.30000000000000004)
Rounding behaviour:
Uses "round half away from zero" (equivalent to Excel ROUND()):
| Value | Rounded to 2dp |
|---|---|
| 2.125 | 2.13 |
| -2.125 | -2.13 |
| 2.124 | 2.12 |
Development
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Launch MCP Inspector
npm run inspector
License
ISC
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.