DEV Community

Cover image for I Built an MCP Server to Fix 21 Things LLMs Are Bad At
chataclaw
chataclaw

Posted on

I Built an MCP Server to Fix 21 Things LLMs Are Bad At


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
Enter fullscreen mode Exit fullscreen mode

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)
Enter fullscreen mode Exit fullscreen mode

Quick Start

Install via npm:

npm install -g @coo-quack/calc-mcp
Enter fullscreen mode Exit fullscreen mode

Then add to your MCP client configuration:

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "calc": {
      "command": "calc-mcp"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Claude Code (openclaw)

In your workspace:

mcporter install calc-mcp
Enter fullscreen mode Exit fullscreen mode

Cursor / VS Code

Add to your MCP settings:

{
  "mcpServers": {
    "calc": {
      "command": "npx",
      "args": ["-y", "@coo-quack/calc-mcp"]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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"
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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..."
Enter fullscreen mode Exit fullscreen mode

๐Ÿ” Hashing & Encoding

hash โ€” Generate cryptographic hashes

MD5, SHA-1, SHA-256, SHA-384, SHA-512
Input: "password123"
SHA-256: "ef92b778bafe771e89245b89ecbc08a44a4e166c06659911881f383d4473e94f"
Enter fullscreen mode Exit fullscreen mode

Includes warnings when using weak algorithms (MD5/SHA-1).

base64 โ€” Encode/decode base64

Encode: "Hello" โ†’ "SGVsbG8="
Decode: "SGVsbG8=" โ†’ "Hello"
Enter fullscreen mode Exit fullscreen mode

encode โ€” URL and HTML encoding/decoding

URL encode: "hello world" โ†’ "hello%20world"
HTML encode: "<div>" โ†’ "&lt;div&gt;"
Enter fullscreen mode Exit fullscreen mode

โœ… Validation & Parsing

json_validate โ€” Validate and pretty-print JSON

Input: '{"name":"Alice","age":30}'
Valid: โœ…
Pretty output with indentation
Enter fullscreen mode Exit fullscreen mode

regex โ€” Test regex patterns with ReDoS protection

Pattern: "^\d{3}-\d{4}$"
Test: "123-4567"
Match: โœ…
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

luhn โ€” Validate credit card numbers, generate check digits

Number: "4532015112830366"
Valid: โœ… (Luhn algorithm check)
Enter fullscreen mode Exit fullscreen mode

ip โ€” Validate and analyze IP addresses

IP: "192.168.1.1"
Version: IPv4
Private: โœ…
Enter fullscreen mode Exit fullscreen mode

semver โ€” Parse and compare semantic versions

Version: "1.8.0"
Major: 1, Minor: 8, Patch: 0
Compare: "1.8.0" > "1.7.5" โ†’ true
Enter fullscreen mode Exit fullscreen mode

๐ŸŽจ Conversion Utilities

base โ€” Convert between number bases (2-36)

Decimal 255 โ†’ Hex: "FF"
Binary "1111" โ†’ Decimal: 15
Enter fullscreen mode Exit fullscreen mode

diff โ€” Character and word-level text diffs

Text1: "The quick brown fox"
Text2: "The slow brown dog"
Changes highlighted with additions/deletions
Enter fullscreen mode Exit fullscreen mode

color โ€” Convert between color formats

Hex "#FF5733" โ†’ RGB: "rgb(255, 87, 51)"
RGB โ†’ HSL: "hsl(14, 100%, 60%)"
Enter fullscreen mode Exit fullscreen mode

convert โ€” Unit conversions (length, weight, temperature, etc.)

100 cm โ†’ 39.37 inches
32ยฐF โ†’ 0ยฐC
Enter fullscreen mode Exit fullscreen mode

char_info โ€” Character information and Unicode details

Character: "โ‚ฌ"
Unicode: U+20AC
Category: Currency Symbol
Name: EURO SIGN
Enter fullscreen mode Exit fullscreen mode

jwt_decode โ€” Decode JWT tokens (header + payload)

Token: "eyJhbGciOiJIUzI1..."
Header: {"alg": "HS256", "typ": "JWT"}
Payload: {"sub": "1234", "name": "John"}
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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

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)