Skip to main content

MCP Integration

TinyFn exposes its 500+ utility functions as MCP (Model Context Protocol) tools, allowing AI assistants like Claude to call TinyFn functions directly for accurate results.

Why Use MCP?

LLMs often hallucinate when doing:
  • Math: Large number arithmetic, floating point operations, decimal comparisons
  • Conversions: Unit conversions (UK vs US gallons, temperature)
  • Encoding: Base64, URL encoding, hash generation
  • Dates: Date calculations, timezone conversions
  • Counting: Character counting (how many ‘r’ in ‘strawberry’)
With TinyFn MCP, LLMs can call verified functions instead of guessing.

Available Servers

TinyFn provides category-based MCP servers to avoid overwhelming LLMs with 500+ tools:
ServerURLToolsDescription
Math/mcp/math/52Arithmetic, comparisons, trigonometry
Convert/mcp/convert/42Unit conversions (temperature, length, weight)
Validate/mcp/validate/15Email, URL, phone validation
String/mcp/string/33String manipulation, character counting
Hash/mcp/hash/18MD5, SHA256, etc.
Encode/mcp/encode/20Base64, URL, HTML encoding
DateTime/mcp/datetime/24Timestamps, formatting, relative time
Time/mcp/time/12Timezone conversions, DST handling
Stats/mcp/stats/16Mean, median, mode, variance, percentiles
All/mcp/all/500+All tools combined
View all categories →
Trailing Slash RequiredURLs must end with / or you’ll get 404 errors:
  • https://api.tinyfn.io/mcp/math/
  • https://api.tinyfn.io/mcp/math

Platform Tool Limits

Different AI platforms have different limits on how many MCP tools they can handle:
PlatformTool LimitRecommendation
Cursor40 tools maxUse validate (15), hash (18), encode (20), or string (33). Avoid math (52) and convert (42) which exceed the limit.
Claude Desktop~100 toolsUse 2-3 category servers
Claude CodeContext-basedCan use /mcp/all/ with Tool Search
Windsurf~40-50 toolsSame as Cursor recommendations
For best results, add only the category servers you need rather than using /mcp/all/. This keeps the tool list manageable and helps the AI select the right tool.

Quick Start

1. Get an API Key

Sign up at tinyfn.io to get your API key.

2. Configure Your Client

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
  "mcpServers": {
    "tinyfn-math": {
      "url": "https://api.tinyfn.io/mcp/math/",
      "headers": {
        "X-API-Key": "tf_live_YOUR_KEY_HERE"
      }
    }
  }
}

3. Use It

Ask your AI assistant to do math, conversions, or other tasks. It will automatically use TinyFn tools when appropriate. Example:
You: What's 123456789 * 987654321?
AI: [calls tinyfn multiply tool]
    The result is 121,932,631,112,635,269

You: How many r's are in strawberry?
AI: [calls tinyfn count-char tool]
    There are 3 r's in "strawberry" at positions 3, 9, and 10.

You: Is 0.9 greater than 0.11?
AI: [calls tinyfn compare tool]
    Yes, 0.9 is greater than 0.11. The difference is 0.79.

Rate Limits

MCP requests count against your normal TinyFn rate limits:
PlanRequests/MonthRequests/Minute
Free10010
Starter10,000100
Pro100,0001,000

Authentication Errors

If you see auth errors, verify:
  1. Your API key starts with tf_live_
  2. The X-API-Key header is included
  3. Your key hasn’t been revoked

Example Tools

Math Tools

add(numbers: "1,2,3,4,5") → {"sum": 15}
multiply(numbers: "2,3,4") → {"product": 24}
compare(a: 0.9, b: 0.11) → {"a_is_greater": true, "difference": 0.79}
is_prime(number: 17) → {"is_prime": true}

String Tools

count_char(text: "strawberry", char: "r") → {"count": 3, "positions": [2, 8, 9]}
count_substring(text: "banana", substring: "an") → {"count": 2}

Conversion Tools

celsius_to_fahrenheit(celsius: 100) → {"fahrenheit": 212}
km_to_mi(kilometers: 10) → {"miles": 6.2137}