<?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: Swapnil Surdi</title>
    <description>The latest articles on DEV Community by Swapnil Surdi (@swapnilsurdi).</description>
    <link>https://dev.to/swapnilsurdi</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3540457%2F2ed25d4a-9d22-476c-9ce7-2917e63fda8f.png</url>
      <title>DEV Community: Swapnil Surdi</title>
      <link>https://dev.to/swapnilsurdi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/swapnilsurdi"/>
    <language>en</language>
    <item>
      <title>Solving response Token 25k limit Wall: Introducing mcp-cache</title>
      <dc:creator>Swapnil Surdi</dc:creator>
      <pubDate>Tue, 30 Sep 2025 20:12:52 +0000</pubDate>
      <link>https://dev.to/swapnilsurdi/solving-ais-25000-token-wall-introducing-mcp-cache-1fie</link>
      <guid>https://dev.to/swapnilsurdi/solving-ais-25000-token-wall-introducing-mcp-cache-1fie</guid>
      <description>&lt;p&gt;I've been working with Claude and MCP servers extensively—building web automation, analyzing codebases, automating testing workflows. But I kept hitting the same frustrating wall:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: Response exceeds maximum allowed tokens (25,000)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Modern applications generate massive responses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Web page DOMs: 1.3MB+ (154K tokens)&lt;/li&gt;
&lt;li&gt;GitHub PR diffs: 36K tokens (44% over limit)&lt;/li&gt;
&lt;li&gt;Figma exports: 351K tokens (1,300% over)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every time I asked Claude to analyze a real web page. Not because the AI couldn't handle it—because MCP had a hard ceiling at 25,000 tokens.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real-World Impact
&lt;/h2&gt;

&lt;p&gt;Looking at GitHub issues across popular MCP servers, I found hundreds of developers facing identical problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chrome MCP: "screenshot always gives 'exceeds maximum tokens' error"&lt;/li&gt;
&lt;li&gt;GitHub MCP: "get_pull_request_diff fails for any substantial PR"&lt;/li&gt;
&lt;li&gt;Playwright MCP: "DOM content returns 'Conversation Too Long' error"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The pattern was clear: MCP works beautifully for toy examples. Breaks on real-world complexity.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: mcp-cache
&lt;/h2&gt;

&lt;p&gt;I built &lt;strong&gt;mcp-cache&lt;/strong&gt;—a universal response manager that wraps any MCP server and solves the token limit automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Claude Desktop
    ↓
mcp-cache (transparent proxy)
├─ Intercepts large responses
├─ Caches full data locally
├─ Returns summary + query tools
└─ AI searches cached data on demand
    ↓
Target MCP Server (unchanged)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Before mcp-cache:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;→ "Get the DOM and find payment forms"
❌ Error: Response exceeds maximum length
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;After mcp-cache:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;→ "Get the DOM and find payment forms"
✅ Cached as resp_xyz (1.2MB)
→ "Show forms with 'payment' in action"
✅ Found 3 forms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Zero Configuration
&lt;/h2&gt;

&lt;p&gt;The best part? It's completely transparent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Instead of:&lt;/span&gt;
npx @playwright/mcp@latest

&lt;span class="c"&gt;# Just add mcp-cache:&lt;/span&gt;
npx @hapus/mcp-cache npx @playwright/mcp@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;That's it.&lt;/strong&gt; No server modifications. No client changes.&lt;/p&gt;

&lt;p&gt;Works with ANY MCP server:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Playwright, Chrome, GitHub, Filesystem&lt;/li&gt;
&lt;li&gt;✅ Python, Node.js, Go, Rust servers&lt;/li&gt;
&lt;li&gt;✅ Your custom MCP servers&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Real Results
&lt;/h2&gt;

&lt;p&gt;Since integrating mcp-cache:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;E-Commerce Testing:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Full accessibility trees cached (was: 250K token errors)&lt;/li&gt;
&lt;li&gt;✅ AI queries specific elements from 1.2MB+ responses&lt;/li&gt;
&lt;li&gt;✅ Complex multi-page flows automated successfully&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Performance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;⚡ &amp;lt;10ms overhead for normal responses&lt;/li&gt;
&lt;li&gt;⚡ &amp;lt;200ms for cached queries&lt;/li&gt;
&lt;li&gt;⚡ 90%+ cache hit rate&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Current:&lt;/strong&gt; Local file-based caching&lt;br&gt;
&lt;strong&gt;Coming:&lt;/strong&gt; Redis-backed distributed caching for teams&lt;br&gt;
&lt;strong&gt;Vision:&lt;/strong&gt; Vector embeddings + semantic search&lt;/p&gt;

&lt;p&gt;Imagine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🏢 Organization-wide shared cache&lt;/li&gt;
&lt;li&gt;🔍 Semantic search: "Find pages similar to our checkout flow"&lt;/li&gt;
&lt;li&gt;📊 Compliance audit trails&lt;/li&gt;
&lt;li&gt;🧠 Knowledge graphs from cached responses&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Key Technical Highlights
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Client-Aware Intelligence:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Auto-detects client (Claude Desktop, Cursor, Cline)&lt;/li&gt;
&lt;li&gt;Adjusts token limits accordingly&lt;/li&gt;
&lt;li&gt;No manual configuration needed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Powerful Query Interface:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Text search&lt;/span&gt;
&lt;span class="nf"&gt;query_response&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;resp_id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;submit button&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// JSONPath for structured data&lt;/span&gt;
&lt;span class="nf"&gt;query_response&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;resp_id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;$.div[?(@.class=="navbar")]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// Regex patterns&lt;/span&gt;
&lt;span class="nf"&gt;query_response&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;resp_id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/href=".*&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s1"&gt;.pdf"/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Try It Today
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @hapus/mcp-cache

&lt;span class="c"&gt;# Or use directly:&lt;/span&gt;
npx @hapus/mcp-cache &amp;lt;your-server-command&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Links:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;⭐ GitHub: &lt;a href="https://github.com/swapnilsurdi/mcp-cache" rel="noopener noreferrer"&gt;https://github.com/swapnilsurdi/mcp-cache&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;📦 npm: @hapus/mcp-cache&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Looking For
&lt;/h2&gt;

&lt;p&gt;✅ &lt;strong&gt;Testers&lt;/strong&gt; - Try it with your MCP workflows&lt;br&gt;
✅ &lt;strong&gt;Feedback&lt;/strong&gt; - What features would help you most?&lt;br&gt;
✅ &lt;strong&gt;Contributors&lt;/strong&gt; - Interested in building Redis/vector DB layers?&lt;br&gt;
✅ &lt;strong&gt;Use cases&lt;/strong&gt; - What are you trying to automate?&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This started as a side project to scratch my own itch. Now I'm hoping it helps others facing the same problem.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>typescript</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
