Sorry, did I mention about MCP's being expensive?
Lots of people (well, one!) have been asking me about this :)
So, I did a quick rambling JFM (just five mins) a week or so back. Sometimes, it is good to revisit and possibly provide a quick code example (in this case) to explain a bit further.
MCP’s (Model Context Protocol) is an ingenious invention by Anthropic (the company that created it as well as Claude, Claude code/desktop and so on) to make it much easier to connect other services to LLM’s (large language models i.e. GPT, Gemini and what not). It really does makes sense to have a common way to hook into other services be that a CRM, ERP, Calendar or whatever other service you need to connect.
However, like most technologies, things are moving fast. There are so many apps, videos and so on showing how to connect up MCP’s but there is a cost - and a rather large one!
The article (below) explains that when agents connect to many MCP (Model Context Protocol) servers, they often load all tool definitions and intermediate results directly into the model’s context window.
This can balloon token usage to hundreds of thousands of tokens before even processing a request.
For example, connecting to thousands of tools might require ~150,000 tokens just to load definitions.
By shifting to code execution with MCP, agents can instead load only the tools they need and process data outside the model, reducing usage to ~2,000 tokens — a 98.7% savings in cost and latency.
So, still confused about all of this? fear not! here is a couple of code examples :)
These are just very trivial examples, but the idea is to show how you you can reference some MCP code “as and when” instead of pre-loading causing the excesive token cost as noted above.
Dotnet C#
Python
These examples show the code execution approach:
Only the necessary tool definitions are loaded.
Data flows through the execution environment instead of bloating the model’s context.
This makes MCP-based agents far more efficient and scalable.
Who doesn’t love a chart! :)




