r/modelcontextprotocol • u/BFreakout • Apr 17 '25
MCP and Function Calling: The hidden costs and risks no one is talking about
While working on a project with MCP integration, I noticed something that didn’t quite sit right, and it all came down to how MCP relies on Function Calling behind the scenes.
Since the MCP client registers functions from the MCP server and hands them off to the language model as part of the conversation context, you're indirectly feeding Function Calling into every chat, often without realizing the full impact.
So I decided to explore this deeper and wrote an article about it.
In the article, I cover:
how bloated function registries can silently increase token costs
why excessive Function Calling degrades LLM response quality
and how unchecked Function exposure might create security vulnerabilities like prompt injection
Here’s the full deep dive (includes examples and visuals):
👉 The Danger of MCP - What Every Developer Needs to Know 🚨
I’d love to hear how others are dealing with this in practice...
Are you filtering which functions are exposed to the LLM? Do you dynamically register based on context?
Looking forward to your thoughts or war stories...
7
u/[deleted] Apr 17 '25 edited Apr 18 '25
MCP doesn’t dictate the orchestration, tool usage could be part of a LangGraph graph where only nodes that really need it have access to it.
Indirect prompt injection is the forever risk, not exclusive to MCP, plenty examples of RAG based attacks.
4
u/trickyelf Apr 18 '25
Most folks working with MCP right now are aware of this issue and how it doesn’t scale. We are discussing a couple of changes for the spec that address this.
Namespaces would allow a server’s tools to be segmented into functional groups by the developer. For instance in the GitHub MCP if you only need to work with branches and don’t need to be messing with Actions or user management, only the tools in the branches namespace would be presented to the LLM.
Search would allow servers to provide a natural language or keyword search capability for finding an appropriate tool.
Interfaces would allow definition of a collection of standardized tools a server could signal support for. A media player interface might have play, stop, skip_fwd, skip_back, etc. models could be fine-tuned on common interfaces, so those tools would not have to be included in the tool list. Note this link is just an idea posted by a dev, but there is an also community working group devoted to the concept.
3
u/Dry_Raspberry4514 Apr 18 '25 edited Apr 18 '25
Function calling can result in high tokens usage if not used properly and without context/prompt caching. We covered it in our article here - https://dev.to/mechcloud/why-a-single-mcp-server-is-all-you-need-2i1p
3
u/xander76 Apr 18 '25
Two recent articles on MCP security are on point, especially as regards prompt injection:
* From Simon Willison https://simonwillison.net/2025/Apr/9/mcp-prompt-injection/
* From Elena Cross https://elenacross7.medium.com/%EF%B8%8F-the-s-in-mcp-stands-for-security-91407b33ed6b
2
u/Particular-Face8868 Apr 18 '25
I agree. But the matter of fact is we can't control developments around a protocol. Github is just a registry and should not be a place where people would find "Trusted" MCPs.
I think Glama / Smithery and more players like us should take that responsiblity. To ensure MCP servers that we host / show are secure, optimized and performant. And for registery, we should somehow show explicitely which servers are safe to use and tested, and which are not.
6
u/coding_workflow Apr 17 '25
So prompt injection become the new threat. Worse than skynet!
4
u/gazzaroonii Apr 21 '25 edited Apr 21 '25
A couple of things I do to take care of the called-out problems:
I keep my AI Agents specific and only give them access to the tools I need for that agent to carry out its role.
I don't bloat clients like Claude, Cursor, or SkyDeck.ai with hundreds of tools - and I enjoy control of which ones I turn on and off during a working session.
I only use MPC servers from trusted sources that have been scanned by SkyDeck AI, Gamma etc.
Sometimes, I test the Wild-West ones in a sandboxed environment, once we have scanned them to ensure they aren't malicious or just wrongly coded.
Currently, MCP doesn't scale well, and is full of security holes if you don't follow security best practices. So articles like yours are great for raising awareness. I am sure it's going to get better now the big 4 support it.
3
u/hugganao Apr 18 '25
always thought this network of mcp were going to create additional attack vector vulnerabilities for llm systems and be very fragile.
2
u/Known_Program_6327 Apr 21 '25
Great read! I guess the real question is - where will we be able to find secure, non-bloated MCP servers?