HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
invariantlabs-ai
mcp-injection-experiments
Python2025–2025
invariantlabs-ai / mcp-injection-experiments

mcp-injection-experiments

Code snippets to reproduce MCP tool poisoning attacks.

3Distinct people
3Mentions
0Explicit recommenders
211GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Code snippets to reproduce MCP tool poisoning attacks.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by day3 dated mentions

Observed mentions: 2025-04-06 14:32:42 UTC to 2025-04-14 16:17:06 UTC.

0122025-04-06 00:00:00 UTC to 2025-04-07 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsApr 62025-04-07 00:00:00 UTC to 2025-04-08 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-04-08 00:00:00 UTC to 2025-04-09 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-04-09 00:00:00 UTC to 2025-04-10 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-04-10 00:00:00 UTC to 2025-04-11 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsApr 102025-04-11 00:00:00 UTC to 2025-04-12 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-04-12 00:00:00 UTC to 2025-04-13 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-04-13 00:00:00 UTC to 2025-04-14 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-04-14 00:00:00 UTC to 2025-04-15 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 commentsApr 14

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Apr 62025-04-06 00:00:00 UTC2025-04-07 00:00:00 UTC101
Apr 72025-04-07 00:00:00 UTC2025-04-08 00:00:00 UTC000
Apr 82025-04-08 00:00:00 UTC2025-04-09 00:00:00 UTC000
Apr 92025-04-09 00:00:00 UTC2025-04-10 00:00:00 UTC000
Apr 102025-04-10 00:00:00 UTC2025-04-11 00:00:00 UTC000
Apr 112025-04-11 00:00:00 UTC2025-04-12 00:00:00 UTC000
Apr 122025-04-12 00:00:00 UTC2025-04-13 00:00:00 UTC000
Apr 132025-04-13 00:00:00 UTC2025-04-14 00:00:00 UTC000
Apr 142025-04-14 00:00:00 UTC2025-04-15 00:00:00 UTC202

What Hacker News says

3 sources
I've recently written a custom MCP server. > An MCP server is at it's heart some 'thing' that provides a set of 'tools' that an LLM can invoke. A "tool" is one of several capabilities that a MCP server can provide to its callers. Other capabilities include "prompt" and "resource". > This is done by adding a 'tool definition'. A 'tool definition' is content that goes into the LLM prompt. That's how it works. How do you imagine an LLM can decide to use a tool? It's only possible if the tool definition is in the prompt. I think you're using an expansive definition of "prompt" that includes not just the input text as provided by the user -- which is generally what most people understand "prompt" to mean -- but also all available user- and client-specific metadata. That's fine, just want to make it explicit. With this framing, I agree with you
Read the rest
, that every MCP server added to a client -- whether that's Claude.app, or some MyAgent, or whatever -- adds some amount of overhead to that client. But that overhead is gonna be fixed-cost, and paid one-time at e.g. session initialization, not every time per e.g. request/response. So I'm struggling to imagine a situation where those costs are anything other than statistical line noise, compared to the costs of actually processing user requests. > https://docs.anthropic.com/en/docs/build-with-claude/tool-us... To be clear, this concept of "tool" is completely unrelated to MCP. > https://github.com/invariantlabs-ai/mcp-injection-experiment... I don't really understand this repo or its criticisms. The authors wrote a related blog post https://invariantlabs.ai/blog/whatsapp-mcp-exploited which says (among other things) that > In this blog post, we will demonstrate how an untrusted MCP server ... But there is no such thing as "an untrusted MCP server". Every MCP server is assumed to be trusted, at least as the protocol is defined today.
In Everything wrong with MCP
> they only incur a cost to the client, and only impact the user context, if/when they're invoked. Look it up. Look up the cross server injection examples. I guarantee you this is not true. An MCP server is at it's heart some 'thing' that provides a set of 'tools' that an LLM can invoke. This is done by adding a 'tool definition'. A 'tool definition' is content that goes into the LLM prompt. That's how it works. How do you imagine an LLM can decide to use a tool? It's only possible if the tool definition is in the prompt. The API may hide this, but I guarantee you this is how it works. Putting an arbitrary amount of 3rd party content into your prompts has a direct tangible impact on LLM performance (and cost). The more MCP servers you enable the more you pollute your prompt with tool definitions, and, I assure you, the worse the results a
Read the rest
re as a result. Just like pouring any large amount of unrelated crap into your system prompt does. At a small scale, it's ok; but as you scale up, the LLM performance goes down. Here's some background reading for you: https://github.com/invariantlabs-ai/mcp-injection-experiment... https://docs.anthropic.com/en/docs/build-with-claude/tool-us...
In Everything wrong with MCP
The post highlights and cites a few attack scenarios we originally described in a security note (tool poisoning, shadowing, MCP rug pull), published a few days ago [1]. I am the author of said blog post at Invariant Labs. Different from what many suspect, the security problem with MCP-style LLM tool calling is not in isolating different MCP server implementations. MCP server implementations that run locally should be vetted by the package manager you use to install them (remote MCP servers are actually harder to verify). Instead, the problem here is a special form of indirect prompt injection that you run into, when you use MCP in an agent system. Since the agent includes all installed MCP server specifications in the same context, one MCP server (that may be untrusted), can easily override and manipulate the agent's behavior with respect
Read the rest
to another MCP server (e.g. one with access to your sensitive database). This is what we termed tool shadowing. Further, MCP's dynamic nature makes it possible for an MCP server to change its provided tool set at any point or for any specific user only. This means MCP servers can turn malicious at any point in time. Current MCP clients like Claude and Cursor, will not notify you about this change, which leaves agents and users vulnerable. For anyone, more interested, please have a look at our more detailed blog post at [1]. We have been working on agent security for a while now (both in research and now at Invariant). We have also released some code snippets for everyone to play with, including a tool poisoning attack on the popular WhatsApp MCP server [2]. [1] https://invariantlabs.ai/blog/mcp-security-notification-tool... [2] https://github.com/invariantlabs-ai/mcp-injection-experiment...
In The “S” in MCP Stands for Security

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.