MCP for Coding

AI Coding Assistants
That Don't Hallucinate

Claude Code, Cursor, and Windsurf are powerful, but they still make math mistakes. Give them TinyFn tools via MCP for accurate calculations, conversions, and validations.

The Problem

AI coding assistants write great code structure, but they hallucinate values that should be computed.

You: "Add a test user with a UUID"
// Claude generates this test fixture: const testUser = { id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890", email: "test@example.com", createdAt: new Date() }; // Problem: That UUID is invalid! // The "7" should be "4" for UUID v4 // LLMs often invent plausible-looking but wrong UUIDs
With TinyFn MCP Tools
// Claude calls the tool first: generate/uuid → "550e8400-e29b-41d4-a716-446655440000" // Then writes the code with a valid UUID: const testUser = { id: "550e8400-e29b-41d4-a716-446655440000", email: "test@example.com", createdAt: new Date() };

Real Coding Scenarios Where LLMs Fail

These happen every day when AI assists with writing code, tests, and configurations.

Writing Test Fixtures with Hashes

You: "Write a test that verifies our password hashing. Use 'testpassword123' as the input."

Claude generates: expect(hash).toBe("5e884898da28047d...") Hallucinated hash that doesn't match actual SHA-256 output. Test fails.
With TinyFn: Claude calls hash/sha256 first, gets the real hash, writes a passing test.

Generating Seed Data for Databases

You: "Create a seed file with 5 users, each with a unique UUID"

Claude generates: { id: "user-1-uuid-here" }, { id: "user-2-uuid-here" }... Placeholder text or malformed UUIDs that fail database constraints.
With TinyFn: Claude calls generate/uuid five times, inserts real RFC 4122 UUIDs. Database accepts them.

Base64 Encoding API Keys in Config

You: "Encode this API key for the config file: sk_live_abc123xyz"

Claude generates: ENCODED_KEY: "c2tfbGl2ZV9hYmMxMjN4eXo==" Often wrong—LLMs can't reliably do Base64 encoding in their head.
With TinyFn: Claude calls encode/base64, gets c2tfbGl2ZV9hYmMxMjN4eXo= (correct encoding).

Writing Regex Patterns

You: "Write a regex to validate email addresses"

Claude generates: /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ Misses edge cases: plus signs, long TLDs, internationalized domains.
With TinyFn: Claude uses validate/email for validation, or regex/email_pattern for a battle-tested regex.

Creating URL Slugs

You: "Generate a URL slug for 'Héllo Wörld! This is a TEST...'"

Claude generates: "hello-world-this-is-a-test" Often inconsistent with special characters, accents, multiple spaces.
With TinyFn: Claude calls string/slug"hello-world-this-is-a-test" with consistent, deterministic rules.

How It Works in Practice

When Claude Code has TinyFn tools, it calls them automatically before writing code that depends on computed values.

1

You request code

"Write a migration that adds a hashed API key column with a default value"

2

Claude calls the tool

Runs hash/sha256 on the default key to get the actual hash

3

Writes correct code

Migration includes the real hash value, not a hallucinated one

Tools for Everyday Coding Tasks

These tools solve the most common "I need a real value here" problems in code generation.

generate/uuid Test fixtures, seed data, migrations
hash/sha256 Test assertions, checksums, auth
encode/base64 Config files, API keys, tokens
validate/email Form validation, input checking
validate/json Config validation, API responses
string/slug URLs, filenames, identifiers
regex/test Pattern validation in tests
generate/password Test accounts, seed users
mcp.json
{
  "mcpServers": {
    "tinyfn": {
      "url": "https://api.tinyfn.io/mcp/all/",
      "headers": {
        "X-API-Key": "your-api-key"
      }
    }
  }
}

Setup in 2 Minutes

  • Works with Claude Code, Cursor, Windsurf, and any MCP client
  • Use /mcp/all for all tools, or pick specific categories
  • Same API key as REST API, same rate limits
Full Setup Guide

Write better code with AI

Get your free API key and give your coding assistant the tools it needs.