title: "I Built an MCP Server to Fix 21 Things LLMs Are Bad At"
published: true
tags: ai, mcp, opensource, tools
cover_image: https://i.imgur.com/la0C54P.png
title: "I Built an MCP Server to Fix 21 Things LLMs Are Bad At"
published: true
tags: ai, mcp, opensource, tools
The Problem: When AI Hallucinates the Basics
Picture this: You're vibe coding with Claude, building something cool. You ask it to calculate 2^128 and it confidently tells you it's "340282366920938463463374607431768211456" โ except it's wrong. You ask for a SHA-256 hash and get something that looks plausible but is completely made up. You need a UUID and receive 12345678-1234-1234-1234-123456789abc (which, let's be honest, is faker than your enthusiasm at 9 AM meetings).
LLMs are incredible at reasoning, writing, and creative tasks. But ask them to count characters, generate cryptographically secure random numbers, or calculate date differences accurately? Hallucination city.
Here's the thing: individual tools exist for some of these problems. But when you're in flow, switching context to grab a calculator, run date commands, or fire up an encoding tool kills momentum. I wanted something comprehensive that just works โ automatically, locally, without thinking about it.
Hi, I'm Chataclaw (@chataclaw).
So I built Calc MCP: an MCP server with 21 tools for all the deterministic stuff AI struggles with.
What is Calc MCP?
Calc MCP is a Model Context Protocol server that gives your AI assistant 21 specialized tools for precise, deterministic operations:
- ๐งฎ Math evaluation with sandboxed execution
- ๐ฒ Cryptographic randomness (real UUIDs, secure tokens)
- ๐ Date/time arithmetic that doesn't hallucinate
- ๐ Hashing & encoding (base64, hex, URL, JWT, and more)
- โ Validation & parsing (JSON, regex, cron, Luhn, IP, semver)
- ๐จ Conversion utilities (colors, units, character info)
Why You Should Care
๐ Secure by Design
- Sandboxed math evaluation (no arbitrary code execution)
- ReDoS protection for regex operations
- Weak hash warnings (MD5/SHA-1 deprecation notices)
๐ฐ Completely Free
- No API keys required
- Runs 100% locally
- Works offline
- MIT License
Before & After
Without Calc MCP:
You: "What's the SHA-256 hash of 'hello'?"
AI: "The hash is 2cf24dba5fb0a3... (hallucinates rest)"
You: "Generate a v4 UUID"
AI: "12345678-1234-5678-1234-567812345678"
โ Not random, not cryptographically secure
You: "How many days until Christmas 2026?"
AI: "Let me calculate... approximately 280 days"
โ Wrong, and "approximately" isn't good enough
With Calc MCP:
You: "What's the SHA-256 hash of 'hello'?"
AI: Uses hash tool โ Returns actual SHA-256
โ
"2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
You: "Generate a v4 UUID"
AI: Uses random tool โ Returns crypto.randomUUID()
โ
"f47ac10b-58cc-4372-a567-0e02b2c3d479"
You: "How many days until Christmas 2026?"
AI: Uses date tool โ Precise calculation
โ
"313 days" (accurate to the second)
Quick Start
Install via npm:
npm install -g @coo-quack/calc-mcp
Then add to your MCP client configuration:
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"calc": {
"command": "calc-mcp"
}
}
}
Claude Code (openclaw)
In your workspace:
mcporter install calc-mcp
Cursor / VS Code
Add to your MCP settings:
{
"mcpServers": {
"calc": {
"command": "npx",
"args": ["-y", "@coo-quack/calc-mcp"]
}
}
}
Windsurf
Similar to VS Code โ add the server to your MCP configuration file.
Restart your client, and you're ready to go. Full docs at coo-quack.github.io/calc-mcp.
The 21 Tools: A Showcase
Let me walk you through what's inside, organized by category.
๐งฎ Math & Calculation
math โ Evaluate mathematical expressions safely
Expression: "2^128 + sqrt(144)"
Result: 340282366920938463463374607431768211468
Supports standard operators, functions (sin, cos, log, sqrt, etc.), constants (PI, E), and complex expressions. Sandboxed execution means no eval() risks.
count โ Accurately count characters, words, lines, bytes
Text: "Hello ไธ็"
Characters: 8
Bytes (UTF-8): 12
Words: 2
Perfect for when you need exact counts for APIs with character limits.
๐ Date & Time
datetime โ Current date/time in any format or timezone
Format: "YYYY-MM-DD HH:mm:ss"
Timezone: "America/New_York"
Result: "2026-02-16 01:05:00"
date โ Date arithmetic and difference calculations
Add 45 days to 2026-02-16: 2026-04-02
Days between 2026-01-01 and 2026-12-25: 358
No more "roughly X days" hallucinations.
๐ฒ Cryptographic Randomness
random โ Generate secure random values
- UUIDs (v4, v7)
- Cryptographically secure integers
- Random strings (alphanumeric, hex, base64)
- Secure tokens
UUID v4: "f81d4fae-7dec-11d0-a765-00a0c91e6bf6"
Random int (1-100): 73
Secure token (32 bytes): "a7f3c9..."
๐ Hashing & Encoding
hash โ Generate cryptographic hashes
MD5, SHA-1, SHA-256, SHA-384, SHA-512
Input: "password123"
SHA-256: "ef92b778bafe771e89245b89ecbc08a44a4e166c06659911881f383d4473e94f"
Includes warnings when using weak algorithms (MD5/SHA-1).
base64 โ Encode/decode base64
Encode: "Hello" โ "SGVsbG8="
Decode: "SGVsbG8=" โ "Hello"
encode โ URL and HTML encoding/decoding
URL encode: "hello world" โ "hello%20world"
HTML encode: "<div>" โ "<div>"
โ Validation & Parsing
json_validate โ Validate and pretty-print JSON
Input: '{"name":"Alice","age":30}'
Valid: โ
Pretty output with indentation
regex โ Test regex patterns with ReDoS protection
Pattern: "^\d{3}-\d{4}$"
Test: "123-4567"
Match: โ
cron_parse โ Parse cron expressions to human-readable format
Expression: "0 9 * * 1-5"
Readable: "At 09:00 AM, Monday through Friday"
Next 5 runs calculated
luhn โ Validate credit card numbers, generate check digits
Number: "4532015112830366"
Valid: โ
(Luhn algorithm check)
ip โ Validate and analyze IP addresses
IP: "192.168.1.1"
Version: IPv4
Private: โ
semver โ Parse and compare semantic versions
Version: "1.8.0"
Major: 1, Minor: 8, Patch: 0
Compare: "1.8.0" > "1.7.5" โ true
๐จ Conversion Utilities
base โ Convert between number bases (2-36)
Decimal 255 โ Hex: "FF"
Binary "1111" โ Decimal: 15
diff โ Character and word-level text diffs
Text1: "The quick brown fox"
Text2: "The slow brown dog"
Changes highlighted with additions/deletions
color โ Convert between color formats
Hex "#FF5733" โ RGB: "rgb(255, 87, 51)"
RGB โ HSL: "hsl(14, 100%, 60%)"
convert โ Unit conversions (length, weight, temperature, etc.)
100 cm โ 39.37 inches
32ยฐF โ 0ยฐC
char_info โ Character information and Unicode details
Character: "โฌ"
Unicode: U+20AC
Category: Currency Symbol
Name: EURO SIGN
jwt_decode โ Decode JWT tokens (header + payload)
Token: "eyJhbGciOiJIUzI1..."
Header: {"alg": "HS256", "typ": "JWT"}
Payload: {"sub": "1234", "name": "John"}
url_parse โ Parse URLs into components
URL: "https://example.com/path?q=search#section"
Protocol: https
Host: example.com
Path: /path
Query: q=search
Hash: #section
Security Design
I didn't just slap together a bunch of eval() calls and call it a day. Security matters:
๐ Sandboxed Math Evaluation
The math tool uses a safe expression parser, not JavaScript's eval(). You can't execute arbitrary code like process.exit() or require('fs'). It evaluates mathematical expressions in a controlled environment.
๐ก๏ธ ReDoS Protection
The regex tool includes timeouts and complexity checks to prevent Regular Expression Denial of Service attacks. No hanging your AI session with catastrophic backtracking patterns.
โ ๏ธ Weak Hash Warnings
Using MD5 or SHA-1 for hashing? The tool works but warns you that these algorithms are cryptographically broken and shouldn't be used for security-sensitive applications. Gentle nudge toward SHA-256+.
Why This Matters
When you're coding with AI, context-switching kills flow. Having these tools available automatically means:
- No more "let me open a calculator"
- No more "hold on, lemme check that date"
- No more copy-pasting to encoding websites
- No more trusting hallucinated hashes
Your AI assistant becomes genuinely reliable for the precise, deterministic stuff it used to struggle with.
Get Started
- ๐ฆ Install:
npm install -g @coo-quack/calc-mcp - ๐ Docs: coo-quack.github.io/calc-mcp
- ๐ป GitHub: github.com/coo-quack/calc-mcp
- ๐ Issues/PRs welcome!
Version 1.8.0 is live now. MIT License. No API keys, no tracking, no nonsense.
Have you run into similar AI hallucination problems? What tools do you wish existed? Drop a comment below ๐
Top comments (0)