115 MCP Tools Cost 43,000 Tokens Before My Agent Read a Word
I ran an MCP server with every option turned on and counted exactly what it hands to an agent. It listed 115 tools, and their names, descriptions, and parameter schemas came to about 43,000 tokens. A client that loads to
I ran an MCP server with every option turned on and counted exactly what it hands to an agent. It listed 115 tools, and their names, descriptions, and parameter schemas came to about 43,000 tokens. A client that loads tool definitions up front puts all of that into the model's context before it reads your first message, and sends it again with every request after that.
MCP, short for Model Context Protocol, is the standard that lets AI assistants like Claude, Cursor, and Codex call outside tools. It's growing fast. In the week of November 9 alone, 3,278 new servers joined the official MCP registry, and every one of them adds more tool definitions to somebody's agent.
In this post I'll show you how I measured the cost of the tools, what each group of tools added, and how I cut the 43,000 tokens down to under 2,000 for IP lookups by turning on only what the task needed. The server I measured is the APIFreaks MCP server, which puts more than 100 APIs behind one key, but the measuring script works on any MCP server you can run locally.
Why Tool Definitions Cost You Twice
When an agent connects to an MCP server, it asks for the list of tools with a request called tools/list. Every tool in the answer comes with a name, a description of when to use it, and a JSON schema for its parameters. A client that loads tools up front puts all of it into the model's context so the model knows what it can call, and none of that comes free.
The first cost is space. Tokens spent describing tools are tokens you can't spend on your code, your documents, or the conversation, and in a long session that adds up because the definitions ride along on every request. Prompt caching can make those repeated tokens cheaper, but it doesn't give the space back.
The second cost is accuracy, and it shows up sooner. The more tools a model sees, the more often it picks the wrong one or fills in the wrong parameters, because similar tools start to blur together. Anthropic's own docs say Claude's ability to pick the right tool degrades once you go past 30 to 50 available tools, and 115 is well past that.
Doesn't My Client Handle This Already?
Some do, and it's worth knowing which. Claude Code now uses tool search by default. It loads only tool names and server instructions at the start of a session and pulls in a tool's full definition when Claude searches for it. Cursor does something similar with what it calls dynamic context discovery, syncing MCP tool descriptions to files the agent can look up instead of sending every definition.
That helps a lot, but it doesn't make the number irrelevant. Not every client defers tools. Tool search can be switched off, and some setups don't support it, such as Claude Code behind a gateway that doesn't pass it through. Agents you build yourself on a model API load exactly the tools you hand them. And even with search, the model still has to find the right tool among everything you've connected, so a smaller, focused list is easier to search well.
So the useful question about any MCP server is still how many tools it makes your agent read, and whether you get to choose which ones.
How I Measured It
A local MCP server talks over stdio, which means it reads JSON messages on standard input and writes answers on standard output. That makes it easy to measure without any agent at all. You start the server, send it the same initialize and tools/list messages a client would, and save whatever comes back.
This is the script I used. It runs on Node.js 20 or later, and it takes the list of modules to enable as its only argument.
// probe.mjs (run with: node probe.mjs "whois,dns")
import { spawn } from 'node:child_process';
import { writeFileSync } from 'node:fs';
const modules = process.argv[2] ?? '';
const server = spawn('npx -y @apifreaks/mcp', {
shell: true, // lets npx start on Windows too, where it's a .cmd file
env: { ...process.env, APIFREAKS_API_KEY: 'not-needed-for-tools-list', ENABLE_MODULES: modules },
stdio: ['pipe', 'pipe', 'inherit'],
});
const pending = new Map();
let buffer = '';
server.stdout.on('data', (chunk) => {
buffer += chunk;
let end;
while ((end = buffer.indexOf('\n')) >= 0) {
const line = buffer.slice(0, end).trim();
buffer = buffer.slice(end + 1);
if (!line.startsWith('{')) continue; // skip anything that isn't a JSON-RPC message
const msg = JSON.parse(line);
pending.get(msg.id)?.(msg);
}
});
function request(id, method, params = {}) {
return new Promise((resolve) => {
pending.set(id, resolve);
server.stdin.write(JSON.stringify({ jsonrpc: '2.0', id, method, params }) + '\n');
});
}
await request(1, 'initialize', {
protocolVersion: '2025-06-18',
capabilities: {},
clientInfo: { name: 'probe', version: '1.0' },
});
server.stdin.write(JSON.stringify({ jsonrpc: '2.0', method: 'notifications/initialized' }) + '\n');
const { result } = await request(2, 'tools/list');
const json = JSON.stringify(result.tools);
writeFileSync('tools.json', json);
console.log(`${result.tools.length} tools, ${json.length} characters`);
server.kill();
If you point it at another server, check whether the tools/list answer includes a nextCursor. That means the server pages its tools, and you'll need to keep asking until it stops. The APIFreaks server returns everything in one page.
To turn characters into tokens, I ran the saved tools.json through OpenAI's o200k_base tokenizer with Python's tiktoken library. Every model counts tokens differently, so treat my numbers as close estimates rather than exact figures for your model, but the differences between setups hold up regardless of the tokenizer. If you use Claude, Anthropic's token counting endpoint accepts a tools list and gives you the exact count for that model.
pip install tiktoken
python -c "import tiktoken; print(len(tiktoken.get_encoding('o200k_base').encode(open('tools.json', encoding='utf-8').read())))"
I measured version 2.6.0 of the @apifreaks/mcp package on November 24, 2026. Listing tools doesn't call any API, so it doesn't need a real key and doesn't spend credits.
What Each Group of Tools Costs
The APIFreaks server splits its tools into 19 modules, such as whois, dns, weather, and pdf, and you pick which ones to load with an environment variable called ENABLE_MODULES. I ran the script once with all 19, then once for each module on its own, and then for a few combinations I'd actually use.
| Setup | ENABLE_MODULES |
Tools | Tokens |
|---|---|---|---|
| Everything | all 19 modules | 115 | 43,239 |
| Domain investigation | whois,dns,ssl,domain |
19 | 5,131 |
| Signup screening | ip-intelligence,email-validation,phone-validation |
11 | 4,624 |
| IP lookups only | ip-intelligence |
5 | 1,887 |
| Nothing yet | empty | 1 | 237 |
The tool counts include one helper tool called list_modules, which the server always adds. I'll come back to it in the next section, because it turns out to be the most useful tool on the list.
The per-module numbers had a couple of surprises. The pdf module on its own costs 9,328 tokens across 21 tools, which is more than the whole domain investigation setup. And the single most expensive tool is scraper_scrape_js, at 1,730 tokens, because its schema describes every option for rendering a JavaScript-heavy page. Neither is a problem if you need those tools, but they're a good reason not to load them when you don't.
Turn On Only What the Task Needs
Most agent work is narrow. If you're building a signup flow, the agent needs IP and email checks, not weather forecasts or commodity prices. So instead of turning everything on, I set ENABLE_MODULES to the modules the project actually uses. In Claude Code, that's one command.
claude mcp add apifreaks \
-e APIFREAKS_API_KEY=your_api_key \
-e ENABLE_MODULES=ip-intelligence \
-- npx -y @apifreaks/mcp
For IP lookups, that takes a client that loads tools up front from 43,239 tokens of tool definitions to 1,887, which is about 96% less, and from 115 tools to 5. That's well inside the range where models pick tools reliably. With tool search, it means Claude searches 5 tools instead of 115.
Because the setting lives in the server's config, you can use a different list in each project. In Claude Code, put a .mcp.json file in the project root with the modules that project needs, and everyone who opens it gets the same lean setup. Claude Code fills in ${APIFREAKS_API_KEY} from each person's environment, so the key never goes into the repository.
{
"mcpServers": {
"apifreaks": {
"command": "npx",
"args": ["-y", "@apifreaks/mcp"],
"env": {
"APIFREAKS_API_KEY": "${APIFREAKS_API_KEY}",
"ENABLE_MODULES": "ip-intelligence,email-validation,phone-validation"
}
}
}
}
If you're not sure which modules you'll need, you can start with none. With ENABLE_MODULES empty, the server lists only list_modules, which costs 237 tokens. When you ask the agent for something it can't do yet, it can call list_modules, which returns every module you haven't turned on, with a short summary, its tools, and a ready-to-paste ENABLE_MODULES line that keeps your current modules and adds that one. The agent picks the module that fits the request and hands you the line. You add it, restart the client, and the tools appear. It's one extra step the first time, and after that the agent only ever sees what you've asked it to use.
The Hosted Server Takes a Different Route
Everything above is about the local server, the one you run with npx. APIFreaks also hosts a remote server at mcp.apifreaks.com, which is the one you'd use from Claude on the web, where local servers can't run. It solves the same problem in a different way. Instead of one tool per endpoint, it groups most products into a single tool with an action setting, so whois_query covers live WHOIS, WHOIS history, IP WHOIS, ASN WHOIS, and reverse WHOIS. By my count of its docs, that's 29 tools across the 14 product groups it covers. It doesn't carry every local module, though. PDF tools only run on the local server because they work with files on your computer, and the same goes for scraping, email and phone validation, and timezone lookups, so the signup screening setup above needs the local server.
I didn't measure its token cost, since listing its tools requires signing in with a key, so I can't give you a number to compare with the local server. The trade-off is easy to reason about, though. Fewer tools means fewer similar names for the model to confuse, while each tool's description gets longer because it has to explain several actions. If you need only a couple of modules, the local server with ENABLE_MODULES is the leanest option. If you need a bit of everything it covers, or you're on the web, the grouped remote tools are the better fit.
Measure Your Own Servers
The probe script works on any MCP server that runs over stdio, not only this one. Change the npx command and the environment variables to match the server you want to check, run it, and count the tokens in tools.json. I'd do it for every server your agent loads, because the numbers add up across servers, and the setting that trims them is usually sitting in the README.
If you'd like to try the setups from this post, you can sign up for a free APIFreaks key with 10,000 credits and no card, and the installation guide lists the module names and the setup for Claude, Cursor, VS Code, Codex, Gemini CLI, and others.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.