{"id":3843,"date":"2026-06-01T11:36:54","date_gmt":"2026-06-01T11:36:54","guid":{"rendered":"https:\/\/www.infobip.com\/developers\/?p=3843"},"modified":"2026-06-01T11:36:55","modified_gmt":"2026-06-01T11:36:55","slug":"how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server","status":"publish","type":"post","link":"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server","title":{"rendered":"How we moved prompt injection protections from the agent into the MCP server"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Prompt injection is one of the hardest problems in AI security, and&nbsp;almost every&nbsp;proposed solution focuses on the agent. But&nbsp;there&#8217;s&nbsp;another place to build defences: the MCP server itself. At Infobip,&nbsp;we&nbsp;mostly&nbsp;deal with 2-way communication between businesses and their end users. AI agents processing inbound SMS messages open themselves to prompt injection from those&nbsp;texts, unless&nbsp;proper safeguards are put in place. We&nbsp;have&nbsp;built those safeguards into our MCP servers, so that they can be reused by various agents that rely on our platform for communicating with their users.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This&nbsp;blog post walks through how those safeguards work, what trade-offs they impose on connected agents, and where the same pattern could apply beyond&nbsp;CPaaS.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Current Landscape<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When Simon Willison coined\u00a0the term, <a href=\"https:\/\/simonwillison.net\/2022\/Sep\/12\/prompt-injection\/\">prompt injection<\/a>,\u00a0back in 2022\u00a0it was primarily viewed in context of jailbreaking, though understood even back then as a unique concept. With the advent of tool usage, later standardized through the adoption of the MCP specification, the surface area for exploits against AI agents grew. Willison\u00a0identified\u00a0a set of capabilities he refers to as a\u00a0<a href=\"https:\/\/simonwillison.net\/2025\/Jun\/16\/the-lethal-trifecta\/\">lethal\u00a0trifecta<\/a> that leave agents vulnerable to prompt injection:\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. Processing content from untrusted sources&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. Access to sensitive systems or&nbsp;private data&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. Ability to communicate externally or change state of the system&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-medium\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"292\" src=\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-300x292.png\" alt=\"\" class=\"wp-image-3845\" srcset=\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-300x292.png 300w, https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image.png 579w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><figcaption class=\"wp-element-caption\">The lethal trifecta<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Whenever an agentic system has all 3 capabilities it becomes susceptible to exploit. Capabilities could be implemented by agent&#8217;s built-in tools, or by one or more of the installed MCP servers. They can come from&nbsp;different sources&nbsp;and from different services and providers.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Meta engineers\u00a0identified\u00a0this as a problem and\u00a0came up with\u00a0the <a href=\"https:\/\/ai.meta.com\/blog\/practical-ai-agent-security\/\">Agents Rule of\u00a0Two<\/a> framework. The rule\u00a0states\u00a0that an AI agent can freely implement 2 of these\u00a0capabilities, but\u00a0must omit or restrict the 3rd one. This framework helps us build safer agents by allowing us to make trade-offs and decide which capability to sacrifice. Researchers from Google&#8217;s DeepMind devised <a href=\"https:\/\/arxiv.org\/abs\/2503.18813v2\">an approach<\/a> in which AI agent encodes its actions as\u00a0Python code\u00a0which in turn\u00a0operates\u00a0on potentially malicious data to prevent it from influencing the LLM. A group of authors composed an overview of\u00a0<a href=\"https:\/\/arxiv.org\/abs\/2506.08837v3\">design\u00a0patterns<\/a> that can be used to architect agentic applications resilient to prompt injection.\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Crucial to the success of all these mitigation strategies is the fact that they are deterministic and focus on long standing engineering principles like securing the data flow and control flow. They also focus on the agent application, or harness. This is a reasonable starting point, because agent source code has the greatest amount of control over the flows. Developers of the agent application can decide on what&nbsp;trade-offs&nbsp;make sense for the use-cases they are implementing.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>CPaaS\u00a0Considerations<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before looking at how we addressed prompt injection, it helps to first understand the risks&nbsp;CPaaS&nbsp;platforms already&nbsp;have to&nbsp;manage. These are the same risks that an AI agent with communication capabilities could easily amplify if those capabilities are exposed without the right safeguards.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One of the clearest examples is spam,\u00a0or unsolicited messages,\u00a0which\u00a0CPaaS\u00a0platforms like\u00a0<a href=\"https:\/\/www.infobip.com\/\">Infobip<\/a>\u00a0need to guard against. Some regions, such as the US for example, impose strict restrictions and require brands and businesses that send texts and other messages to respect opt-outs from their users. Businesses that end up sending unwanted messages, even unwillingly, can face investigation and fines.\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Closely related to spam is phishing&nbsp;(smishing, for SMS).&nbsp;SMS texts, e-mails,&nbsp;and OTT channels&nbsp;(such as WhatsApp, Viber, etc.)&nbsp;are often a vehicle used by fraudsters to deliver phishing messages. In these&nbsp;cases,&nbsp;attackers try to trick users by impersonating brands that users know and trust. It is important to protect senders: phone numbers, email addresses,&nbsp;and similar identifiers&nbsp;that brands use to communicate with their users from such attackers.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These same protections against spam and phishing must also be considered&nbsp;when building&nbsp;CPaaS-capable AI agents. Such agents provide high utility, being capable of communication with end users over channels that users already&nbsp;know&nbsp;and&nbsp;are&nbsp;comfortable with. However, exposing naive implementation of these capabilities would leave agents vulnerable.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>A Vulnerable MCP Server Setup<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Consider&nbsp;a scenario in which we&nbsp;expose&nbsp;an MCP server with 2 tools, one to receive raw inbound SMS texts, and one to send outbound texts. An AI agent could use OAuth or API keys to&nbsp;authenticate business customer which would grant it access to business&#8217; senders. Then the agent could send and receive SMS from the official phone number that users already know and use&nbsp;it&nbsp;to interact with a brand they trust.&nbsp;&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Without&nbsp;additional&nbsp;protections against prompt injection an agent connected to such an MCP server would be vulnerable, since all 3 lethal trifecta capabilities would be present:&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. Agent could receive maliciously crafted messages from inbound SMS texts.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. Agent would have access to a trusted sender.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. Agent could send outbound spam or phishing SMS texts.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Each agent connected to such a server would violate\u00a0<em>Agents Rule of Two <\/em>and\u00a0would need to implement some protections and limitations on at least one of these capabilities.\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"901\" height=\"538\" src=\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-1.png\" alt=\"\" class=\"wp-image-3846\" srcset=\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-1.png 901w, https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-1-300x179.png 300w, https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-1-768x459.png 768w\" sizes=\"auto, (max-width: 901px) 100vw, 901px\" \/><figcaption class=\"wp-element-caption\">Vulnerable MCP server setup<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Asking every agent application to reimplement these protections seemed fragile.\u00a0That&#8217;s\u00a0why\u00a0we decided\u00a0to build\u00a0them into Infobip&#8217;s MCP server directly. That way, the safeguards are implemented once and can be reused by every application that connects to the server.\u00a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Safe 2-way SMS Conversations<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Typically, security&nbsp;features are&nbsp;usually&nbsp;a compromise between utility and safety. In case of an AI agent with capability to communicate over texts one such compromise is to lock one agent session into conversation with one phone.&nbsp;In this scenario, during one agent session,&nbsp;(i.e.,&nbsp;one agentic task)&nbsp;or a series of LLM calls that share memory, the agent is only allowed to receive messages from and send messages to a single user. This compromise still allows for 2-way conversations between users and the agent, which covers&nbsp;the majority of&nbsp;potential&nbsp;use cases.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"901\" height=\"538\" src=\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-2.png\" alt=\"\" class=\"wp-image-3847\" srcset=\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-2.png 901w, https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-2-300x179.png 300w, https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-2-768x459.png 768w\" sizes=\"auto, (max-width: 901px) 100vw, 901px\" \/><figcaption class=\"wp-element-caption\">Attack prevention with safe 2-way system<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">One limitation of this approach is that users\u00a0won&#8217;t\u00a0be\u00a0able\u00a0to instruct the agent to send messages to third parties.\u00a0There are a few\u00a0additional\u00a0limitations that will become clear as we dive deeper into the implementation details\u00a0discussed below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Implementation\u00a0we ended up with<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s&nbsp;look at the specific implementation that we ended up with in Infobip, and how we lock the agent into conversation with one user at a time.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We implemented the 2-way SMS agentic capability by starting from an inbound text message sent by a user to the agent. Prior to sending the message to the agent with a webhook, the server creates a limited-time session with a random token. The webhook payload&nbsp;contains&nbsp;both the inbound message details and the session token.&nbsp;Agent code, a harness, can use the message sender as a key of persisted memory that it feeds&nbsp;to&nbsp;the LLM tasked with processing received messages.&nbsp;&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The agent is connected to Infobip&#8217;s MCP server for responding. The server&#8217;s tool descriptions and input schemas instruct the agent to return the session token in&nbsp;subsequent&nbsp;tool calls when sending outbound messages. The session is linked to the information about the user on Infobip side. This includes their phone number, from which they sent the original inbound message, but can also include data from their CDP (Customer Data Platform) profile, such as e-mail address.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The AI agent is free to interpret the inbound text however it sees fit. For example,&nbsp;a RAG system might be used in combination with the 2-way SMS to build a knowledge agent capable of answering domain-specific questions. If the agent decides to respond by sending an outbound SMS text, it needs to include the session token in its tool call. MCP server checks that the token is present, corresponds to an active session, and that the agent is interacting with the same user that sent the original inbound message.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"901\" height=\"576\" src=\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-3.png\" alt=\"\" class=\"wp-image-3848\" srcset=\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-3.png 901w, https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-3-300x192.png 300w, https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-3-768x491.png 768w\" sizes=\"auto, (max-width: 901px) 100vw, 901px\" \/><figcaption class=\"wp-element-caption\">Legitimate processing with safe 2-way system<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This can be expanded in a few ways. Based on the conversation, the agent might decide to update the CDP profile of the user. Or it might switch the conversation from SMS to one of the richer communication channels such as RCS or e-mail. In each case,\u00a0it would need to provide the session token, and the server would verify that token matches the\u00a0initial\u00a0user.\u00a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Implications<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">By using a cryptographically secure&nbsp;pseudorandom&nbsp;value for the session token,&nbsp;we ensure that the LLM cannot hallucinate a valid token value. The only way for it to obtain a valid session token is to receive it from the webhook payload. Inbound messages are ephemeral on the server side; once delivered,&nbsp;they cannot be accessed again, ensuring there is only ever a single session for each inbound message.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The MCP server rejects&nbsp;tool calls&nbsp;to send outbound messages without a valid session token. Likewise, server rejects tool calls that&nbsp;attempt&nbsp;to&nbsp;target&nbsp;users other than the one the session is linked to. This forces the agent to interact only with the&nbsp;initial&nbsp;user and their data.&nbsp;This includes sending messages, but also updating user\u2019s profile in CDP, etc.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The session is time-bound and expires after a set interval of few minutes. This gives the agent a time window to respond. It is enough time for an LLM based system to produce a response to the&nbsp;initial&nbsp;inbound&nbsp;message, but&nbsp;prevents reuse of old tokens. For example, even if the session token leaks into persisted memory and agent gets compromised by a prompt injection from a different source&nbsp;later on, an expired session cannot be used any more. Lastly, depending on configuration, sessions can be created as one-time use, meaning only the first tool call within time window will succeed.&nbsp;Subsequent&nbsp;attempts by the agent to reuse the same session token will be rejected by the server.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Each new inbound message results in a new session with a new token being generated and sent to the agent. This creates a risk of the LLM getting confused and reusing an old and no longer valid token. This can be mitigated with clear tool descriptions and server instructions. The upside is having single-use time-based tokens.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Limitations<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">There are a few&nbsp;additional&nbsp;limitations of this system.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This approach intentionally splits receiving inbound messages from sending outbound ones. The AI workload is triggered by a webhook call from Infobip to the agent. This requires the agent application to expose a web server. It complicates the deployment&nbsp;setup, but&nbsp;makes it easier for classic agent code to keep LLM memory separate for each user. Which in turn guards from memory poisoning attacks.&nbsp;&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An AI agent connected to the MCP server for responding&nbsp;can&#8217;t&nbsp;proactively start a conversation by sending an outbound text. It must first receive&nbsp;a&nbsp;webhook with an inbound message from a user&nbsp;to&nbsp;reply to it. This can be worked around by using a different flow with a different, unrestricted MCP server to initialize the conversation by sending the first outbound message. In this initialization flow the LLM would not need to process inbound messages, so there is no risk of prompt injection.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There is still&nbsp;a risk of&nbsp;an inbound message tricking the agent into calling other tools besides those exposed by the response MCP server which enforces the session token checks. In these&nbsp;cases,&nbsp;a classic HTTP API&nbsp;can be exposed alongside the MCP server which can be used to&nbsp;validate&nbsp;session tokens. Then the agent can be instructed to include the token with those&nbsp;additional&nbsp;tool calls, and the tool implementation can be extended to&nbsp;validate&nbsp;the token with a classic API call.&nbsp;&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">CDP data can be used to give&nbsp;additional&nbsp;context to the session retrieved from the API. This added context can be used to perform authorization on&nbsp;additional&nbsp;tools. This, of course, requires developers to have control over the implementation of these tools, which might not always be the case.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"901\" height=\"538\" src=\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-4.png\" alt=\"\" class=\"wp-image-3849\" srcset=\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-4.png 901w, https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-4-300x179.png 300w, https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/image-4-768x459.png 768w\" sizes=\"auto, (max-width: 901px) 100vw, 901px\" \/><figcaption class=\"wp-element-caption\">Attack prevention with system extended to 3<sup>rd<\/sup>\u00a0party tools<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">At\u00a0Infobip,\u00a0we\u00a0have applied the\u00a0<em>Agents Rule of Two<\/em>\u00a0framework to our implementation of a system that empowers AI agents with 2-way communication capabilities. The underlying principle extends beyond\u00a0CPaaS. Wherever an agent responds to requests from known parties: a customer support ticket, an incoming webhook, an appointment callback, that\u00a0initiating\u00a0event can serve as a session anchor enforced at the MCP server level.\u00a0This\u00a0demonstrates\u00a0how prompt injection mitigation need not be limited to source code of AI agents. Preventative controls can be implemented on the MCP server side and reused across all agents that connect to it.\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Our approach benefits from having a focused domain (2-way communication) and a tight tool surface. This results in smaller server footprint and is a good approach to designing MCP servers in general. Additionally, it imposes a specific compromise to agents connected to the server. This is why we also expose fully featured MCP servers without these limitations as lower-level primitives that can be used by those agents that require different trade-offs.&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prompt injection is one of the hardest problems in [&hellip;]<\/p>\n","protected":false},"author":24,"featured_media":3854,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[50,28],"tags":[144,309],"coauthors":[169],"class_list":["post-3843","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","category-blog-post","tag-developer-ecosystem","tag-mcp-servers"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How we moved prompt injection protections from the agent into the MCP server - Infobip Developers Hub<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How we moved prompt injection protections from the agent into the MCP server - Infobip Developers Hub\" \/>\n<meta property=\"og:description\" content=\"Prompt injection is one of the hardest problems in [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server\" \/>\n<meta property=\"og:site_name\" content=\"Infobip Developers Hub\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/infobip\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-06-01T11:36:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-01T11:36:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/auto_cropTUFITENDNmNrRXMjMSNiOTMwYjhmMzBjZDE1Y2ZmNGYzYjc0ZDFjMWEwMDBhZSMxMjAwIyNUUkFOU0ZPUk1BVElPTl9SRVFVRVNU-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Josip Antolis\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InfobipDev\" \/>\n<meta name=\"twitter:site\" content=\"@InfobipDev\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Josip Antolis\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server\"},\"author\":{\"name\":\"Josip Antolis\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/1a55233b1c6b1f737bc46d29a7308380\"},\"headline\":\"How we moved prompt injection protections from the agent into the MCP server\",\"datePublished\":\"2026-06-01T11:36:54+00:00\",\"dateModified\":\"2026-06-01T11:36:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server\"},\"wordCount\":2303,\"publisher\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/auto_cropTUFITENDNmNrRXMjMSNiOTMwYjhmMzBjZDE1Y2ZmNGYzYjc0ZDFjMWEwMDBhZSMxMjAwIyNUUkFOU0ZPUk1BVElPTl9SRVFVRVNU-1.png\",\"keywords\":[\"developer ecosystem\",\"MCP servers\"],\"articleSection\":[\"AI\",\"Blog Post\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server\",\"url\":\"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server\",\"name\":\"How we moved prompt injection protections from the agent into the MCP server - Infobip Developers Hub\",\"isPartOf\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/auto_cropTUFITENDNmNrRXMjMSNiOTMwYjhmMzBjZDE1Y2ZmNGYzYjc0ZDFjMWEwMDBhZSMxMjAwIyNUUkFOU0ZPUk1BVElPTl9SRVFVRVNU-1.png\",\"datePublished\":\"2026-06-01T11:36:54+00:00\",\"dateModified\":\"2026-06-01T11:36:55+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server#primaryimage\",\"url\":\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/auto_cropTUFITENDNmNrRXMjMSNiOTMwYjhmMzBjZDE1Y2ZmNGYzYjc0ZDFjMWEwMDBhZSMxMjAwIyNUUkFOU0ZPUk1BVElPTl9SRVFVRVNU-1.png\",\"contentUrl\":\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/auto_cropTUFITENDNmNrRXMjMSNiOTMwYjhmMzBjZDE1Y2ZmNGYzYjc0ZDFjMWEwMDBhZSMxMjAwIyNUUkFOU0ZPUk1BVElPTl9SRVFVRVNU-1.png\",\"width\":1200,\"height\":675,\"caption\":\"How we moved prompt injection protections from the agent into the MCP server\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.infobip.com\/developers\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How we moved prompt injection protections from the agent into the MCP server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#website\",\"url\":\"https:\/\/www.infobip.com\/developers\/\",\"name\":\"Infobip Developers Hub\",\"description\":\"Build meaningful customer relationships across any channel\",\"publisher\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.infobip.com\/developers\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#organization\",\"name\":\"Infobip Developers Hub\",\"url\":\"https:\/\/www.infobip.com\/developers\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2023\/03\/Infobip_logo_favicon.png\",\"contentUrl\":\"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2023\/03\/Infobip_logo_favicon.png\",\"width\":696,\"height\":696,\"caption\":\"Infobip Developers Hub\"},\"image\":{\"@id\":\"https:\/\/www.infobip.com\/developers\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/infobip\/\",\"https:\/\/x.com\/InfobipDev\",\"https:\/\/www.youtube.com\/channel\/UCUPSTy53VecI5GIir3J3ZbQ\",\"https:\/\/github.com\/infobip-community\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/1a55233b1c6b1f737bc46d29a7308380\",\"name\":\"Josip Antolis\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/image\/bf45e3811f4d1e56f1c137013d06202f\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ab3617f90edf6e20af8be6af394d61020674d878e53ba960a3f57b6135a9b8b8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ab3617f90edf6e20af8be6af394d61020674d878e53ba960a3f57b6135a9b8b8?s=96&d=mm&r=g\",\"caption\":\"Josip Antolis\"},\"description\":\"Josip is a principal engineer at Infobip, doing his part in keeping our infrastructure sound and always ready to scale, sharing knowledge with coworkers, and mentoring startups every chance he gets.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/josip-antoli-2a0594219\/\"],\"url\":\"https:\/\/www.infobip.com\/developers\/blog\/author\/josip-antolis\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How we moved prompt injection protections from the agent into the MCP server - Infobip Developers Hub","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server","og_locale":"en_US","og_type":"article","og_title":"How we moved prompt injection protections from the agent into the MCP server - Infobip Developers Hub","og_description":"Prompt injection is one of the hardest problems in [&hellip;]","og_url":"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server","og_site_name":"Infobip Developers Hub","article_publisher":"https:\/\/www.facebook.com\/infobip\/","article_published_time":"2026-06-01T11:36:54+00:00","article_modified_time":"2026-06-01T11:36:55+00:00","og_image":[{"width":1200,"height":675,"url":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/auto_cropTUFITENDNmNrRXMjMSNiOTMwYjhmMzBjZDE1Y2ZmNGYzYjc0ZDFjMWEwMDBhZSMxMjAwIyNUUkFOU0ZPUk1BVElPTl9SRVFVRVNU-1.png","type":"image\/png"}],"author":"Josip Antolis","twitter_card":"summary_large_image","twitter_creator":"@InfobipDev","twitter_site":"@InfobipDev","twitter_misc":{"Written by":"Josip Antolis","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server#article","isPartOf":{"@id":"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server"},"author":{"name":"Josip Antolis","@id":"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/1a55233b1c6b1f737bc46d29a7308380"},"headline":"How we moved prompt injection protections from the agent into the MCP server","datePublished":"2026-06-01T11:36:54+00:00","dateModified":"2026-06-01T11:36:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server"},"wordCount":2303,"publisher":{"@id":"https:\/\/www.infobip.com\/developers\/#organization"},"image":{"@id":"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server#primaryimage"},"thumbnailUrl":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/auto_cropTUFITENDNmNrRXMjMSNiOTMwYjhmMzBjZDE1Y2ZmNGYzYjc0ZDFjMWEwMDBhZSMxMjAwIyNUUkFOU0ZPUk1BVElPTl9SRVFVRVNU-1.png","keywords":["developer ecosystem","MCP servers"],"articleSection":["AI","Blog Post"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server","url":"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server","name":"How we moved prompt injection protections from the agent into the MCP server - Infobip Developers Hub","isPartOf":{"@id":"https:\/\/www.infobip.com\/developers\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server#primaryimage"},"image":{"@id":"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server#primaryimage"},"thumbnailUrl":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/auto_cropTUFITENDNmNrRXMjMSNiOTMwYjhmMzBjZDE1Y2ZmNGYzYjc0ZDFjMWEwMDBhZSMxMjAwIyNUUkFOU0ZPUk1BVElPTl9SRVFVRVNU-1.png","datePublished":"2026-06-01T11:36:54+00:00","dateModified":"2026-06-01T11:36:55+00:00","breadcrumb":{"@id":"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server#primaryimage","url":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/auto_cropTUFITENDNmNrRXMjMSNiOTMwYjhmMzBjZDE1Y2ZmNGYzYjc0ZDFjMWEwMDBhZSMxMjAwIyNUUkFOU0ZPUk1BVElPTl9SRVFVRVNU-1.png","contentUrl":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2026\/06\/auto_cropTUFITENDNmNrRXMjMSNiOTMwYjhmMzBjZDE1Y2ZmNGYzYjc0ZDFjMWEwMDBhZSMxMjAwIyNUUkFOU0ZPUk1BVElPTl9SRVFVRVNU-1.png","width":1200,"height":675,"caption":"How we moved prompt injection protections from the agent into the MCP server"},{"@type":"BreadcrumbList","@id":"https:\/\/www.infobip.com\/developers\/blog\/how-we-moved-prompt-injection-protections-from-the-agent-into-the-mcp-server#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.infobip.com\/developers\/"},{"@type":"ListItem","position":2,"name":"How we moved prompt injection protections from the agent into the MCP server"}]},{"@type":"WebSite","@id":"https:\/\/www.infobip.com\/developers\/#website","url":"https:\/\/www.infobip.com\/developers\/","name":"Infobip Developers Hub","description":"Build meaningful customer relationships across any channel","publisher":{"@id":"https:\/\/www.infobip.com\/developers\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.infobip.com\/developers\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.infobip.com\/developers\/#organization","name":"Infobip Developers Hub","url":"https:\/\/www.infobip.com\/developers\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.infobip.com\/developers\/#\/schema\/logo\/image\/","url":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2023\/03\/Infobip_logo_favicon.png","contentUrl":"https:\/\/www.infobip.com\/developers\/wp-content\/uploads\/2023\/03\/Infobip_logo_favicon.png","width":696,"height":696,"caption":"Infobip Developers Hub"},"image":{"@id":"https:\/\/www.infobip.com\/developers\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/infobip\/","https:\/\/x.com\/InfobipDev","https:\/\/www.youtube.com\/channel\/UCUPSTy53VecI5GIir3J3ZbQ","https:\/\/github.com\/infobip-community"]},{"@type":"Person","@id":"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/1a55233b1c6b1f737bc46d29a7308380","name":"Josip Antolis","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.infobip.com\/developers\/#\/schema\/person\/image\/bf45e3811f4d1e56f1c137013d06202f","url":"https:\/\/secure.gravatar.com\/avatar\/ab3617f90edf6e20af8be6af394d61020674d878e53ba960a3f57b6135a9b8b8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ab3617f90edf6e20af8be6af394d61020674d878e53ba960a3f57b6135a9b8b8?s=96&d=mm&r=g","caption":"Josip Antolis"},"description":"Josip is a principal engineer at Infobip, doing his part in keeping our infrastructure sound and always ready to scale, sharing knowledge with coworkers, and mentoring startups every chance he gets.","sameAs":["https:\/\/www.linkedin.com\/in\/josip-antoli-2a0594219\/"],"url":"https:\/\/www.infobip.com\/developers\/blog\/author\/josip-antolis"}]}},"_links":{"self":[{"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/posts\/3843","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/users\/24"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/comments?post=3843"}],"version-history":[{"count":5,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/posts\/3843\/revisions"}],"predecessor-version":[{"id":3853,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/posts\/3843\/revisions\/3853"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/media\/3854"}],"wp:attachment":[{"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/media?parent=3843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/categories?post=3843"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/tags?post=3843"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.infobip.com\/developers\/wp-json\/wp\/v2\/coauthors?post=3843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}