<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mehdi Belckadi</title>
    <description>The latest articles on DEV Community by Mehdi Belckadi (@mbelckadi).</description>
    <link>https://dev.to/mbelckadi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3945036%2Fd13e8a1c-9690-4d47-b55f-1b14473df20e.jpg</url>
      <title>DEV Community: Mehdi Belckadi</title>
      <link>https://dev.to/mbelckadi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mbelckadi"/>
    <language>en</language>
    <item>
      <title>I found a duplicate-charge bug in an MCP tool via static analysis — here's the finding and the fix (NEXUM-004)</title>
      <dc:creator>Mehdi Belckadi</dc:creator>
      <pubDate>Tue, 18 Aug 2026 11:46:58 +0000</pubDate>
      <link>https://dev.to/mbelckadi/i-found-a-duplicate-charge-bug-in-an-mcp-tool-via-static-analysis-heres-the-finding-and-the-fix-5a64</link>
      <guid>https://dev.to/mbelckadi/i-found-a-duplicate-charge-bug-in-an-mcp-tool-via-static-analysis-heres-the-finding-and-the-fix-5a64</guid>
      <description>&lt;h2&gt;
  
  
  A duplicate-charge bug in an MCP tool, found by static analysis before it shipped
&lt;/h2&gt;

&lt;p&gt;A few weeks ago I ran a small side project of mine — &lt;a href="https://getnexum.dev" rel="noopener noreferrer"&gt;Nexum&lt;/a&gt;, a deterministic static scanner for OpenAPI/MCP specs — against a public MCP server: &lt;a href="https://github.com/fabianwilliams/adotob-mcp" rel="noopener noreferrer"&gt;&lt;code&gt;adotob-mcp&lt;/code&gt;&lt;/a&gt; by &lt;a href="https://linkedin.com/in/fabiangwilliams/" rel="noopener noreferrer"&gt;Fabian Williams&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It flagged something real.&lt;/p&gt;

&lt;h3&gt;
  
  
  The finding
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;purchase_free_bundle&lt;/code&gt; tool had no idempotency protection. In plain terms: nothing in the spec stopped the same call from executing twice.&lt;/p&gt;

&lt;p&gt;For a human-driven API, that's a bug ticket. For an MCP tool exposed to an AI agent, it's a different category of risk. Agents retry. A network blip, a timeout, a retry-loop in whatever framework is orchestrating the agent — any of these can trigger the same tool call twice, with no human in the loop to notice. No &lt;code&gt;Idempotency-Key&lt;/code&gt; header, no &lt;code&gt;request_id&lt;/code&gt; field in the body, nothing for the server to deduplicate against.&lt;/p&gt;

&lt;p&gt;This is one of five deterministic rules Nexum runs (&lt;code&gt;NEXUM-004 — IdempotencyMissing&lt;/code&gt;). No LLM in the core detection path — it's pattern matching against the spec, on purpose, so the output is reproducible and explainable.&lt;/p&gt;

&lt;h3&gt;
  
  
  What happened next
&lt;/h3&gt;

&lt;p&gt;I opened a PR. Fabian merged it the same day:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Credit where it is due &lt;a class="mentioned-user" href="https://dev.to/mbelckadi"&gt;@mbelckadi&lt;/a&gt; — your trust-manifest is a clean static-analysis schema."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's the best outcome this kind of scanning can have — a real fix, shipped fast, by someone who didn't have to engage with a stranger's static-analysis output at all.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why this matters beyond one bug
&lt;/h3&gt;

&lt;p&gt;The interesting part isn't the individual finding — it's the threat model. Most security tooling for APIs (Snyk, dependency scanners, generic SAST) answers "is this code/dependency vulnerable." Nexum asks a narrower, more specific question: &lt;strong&gt;what could an AI agent with real tool-calling access do if something goes wrong here&lt;/strong&gt; — not if it's attacked, just if a retry happens, a param is missing, or a schema is looser than intended.&lt;/p&gt;

&lt;p&gt;That's a smaller question than "is this API secure," and I think that's exactly why it's tractable to check for deterministically, without an LLM guessing at intent.&lt;/p&gt;

&lt;h3&gt;
  
  
  The full write-up
&lt;/h3&gt;

&lt;p&gt;Case study with the actual finding, evidence, and fix: &lt;a href="https://getnexum.dev/blog/nexum-004-fabian-williams" rel="noopener noreferrer"&gt;getnexum.dev/blog/nexum-004-fabian-williams&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks to Fabian for merging fast and for being fine with this being written up publicly.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Nexum only analyzes the spec you send it — no access to your production infra or MCP environment required. If you're running MCP servers or exposing APIs to AI agents and want to know what a scan would flag, the free scanner is at &lt;a href="https://getnexum.dev" rel="noopener noreferrer"&gt;getnexum.dev&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>ai</category>
      <category>api</category>
      <category>mcp</category>
    </item>
  </channel>
</rss>
