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:
| Server | URL | Tools | Description |
|---|
| Math | /mcp/math/ | 52 | Arithmetic, comparisons, trigonometry |
| Convert | /mcp/convert/ | 42 | Unit conversions (temperature, length, weight) |
| Validate | /mcp/validate/ | 15 | Email, URL, phone validation |
| String | /mcp/string/ | 33 | String manipulation, character counting |
| Hash | /mcp/hash/ | 18 | MD5, SHA256, etc. |
| Encode | /mcp/encode/ | 20 | Base64, URL, HTML encoding |
| DateTime | /mcp/datetime/ | 24 | Timestamps, formatting, relative time |
| Time | /mcp/time/ | 12 | Timezone conversions, DST handling |
| Stats | /mcp/stats/ | 16 | Mean, 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
Different AI platforms have different limits on how many MCP tools they can handle:
| Platform | Tool Limit | Recommendation |
|---|
| Cursor | 40 tools max | Use validate (15), hash (18), encode (20), or string (33). Avoid math (52) and convert (42) which exceed the limit. |
| Claude Desktop | ~100 tools | Use 2-3 category servers |
| Claude Code | Context-based | Can use /mcp/all/ with Tool Search |
| Windsurf | ~40-50 tools | Same 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.
Claude Desktop
Cursor / Windsurf
Continue.dev
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"
}
}
}
}
Add to your MCP config:{
"mcpServers": {
"tinyfn-validate": {
"url": "https://api.tinyfn.io/mcp/validate/",
"headers": {
"X-API-Key": "tf_live_YOUR_KEY_HERE"
}
}
}
}
Use validate (15 tools), hash (18), or encode (20) for Cursor/Windsurf’s 40-tool limit.
Add to your Continue config:{
"experimental": {
"mcpServers": [
{
"name": "tinyfn",
"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:
| Plan | Requests/Month | Requests/Minute |
|---|
| Free | 100 | 10 |
| Starter | 10,000 | 100 |
| Pro | 100,000 | 1,000 |
Authentication Errors
If you see auth errors, verify:
- Your API key starts with
tf_live_
- The
X-API-Key header is included
- Your key hasn’t been revoked
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}
count_char(text: "strawberry", char: "r") → {"count": 3, "positions": [2, 8, 9]}
count_substring(text: "banana", substring: "an") → {"count": 2}
celsius_to_fahrenheit(celsius: 100) → {"fahrenheit": 212}
km_to_mi(kilometers: 10) → {"miles": 6.2137}