<?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: Krystian</title>
    <description>The latest articles on DEV Community by Krystian (@phantompixeldev).</description>
    <link>https://dev.to/phantompixeldev</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%2F1576972%2Fa10eb5b3-df58-4d71-bd15-9c991c92b619.png</url>
      <title>DEV Community: Krystian</title>
      <link>https://dev.to/phantompixeldev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/phantompixeldev"/>
    <language>en</language>
    <item>
      <title>I Built a Better Web Search MCP for AI Agents — No API Key Required</title>
      <dc:creator>Krystian</dc:creator>
      <pubDate>Sun, 27 Sep 2026 09:35:18 +0000</pubDate>
      <link>https://dev.to/phantompixeldev/i-built-a-better-web-search-mcp-for-ai-agents-no-api-key-required-51k2</link>
      <guid>https://dev.to/phantompixeldev/i-built-a-better-web-search-mcp-for-ai-agents-no-api-key-required-51k2</guid>
      <description>&lt;h2&gt;
  
  
  BetterWebSearch MCP — smarter web search, better data extraction, flexible and extensible, open source
&lt;/h2&gt;

&lt;p&gt;Web search for AI agents sounds simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Search the web&lt;/li&gt;
&lt;li&gt;Open the results&lt;/li&gt;
&lt;li&gt;Extract useful information&lt;/li&gt;
&lt;li&gt;Feed it back to the model&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In reality, it gets messy pretty quickly.&lt;/p&gt;

&lt;p&gt;Some websites work with a simple HTTP request. Others render almost everything through JavaScript. Search APIs often require accounts, API keys or paid plans, and dumping entire webpages into an LLM context wastes a huge amount of tokens.&lt;/p&gt;

&lt;p&gt;That's why I built &lt;strong&gt;BetterWebSearch MCP&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://www.npmjs.com/package/better-web-search-mcp" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/better-web-search-mcp&lt;/a&gt;&lt;br&gt;&lt;br&gt;
👉 &lt;a href="https://github.com/PhantomPixelDev/BetterWebSearch-MCP" rel="noopener noreferrer"&gt;https://github.com/PhantomPixelDev/BetterWebSearch-MCP&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's a local, open-source &lt;strong&gt;Model Context Protocol server for web search, extraction and deep research&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;And the default setup requires &lt;strong&gt;no API key, no account and no cloud service&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Zero-config web search
&lt;/h2&gt;

&lt;p&gt;BetterWebSearch uses &lt;strong&gt;DuckDuckGo by default&lt;/strong&gt;, so you can get started immediately.&lt;/p&gt;

&lt;p&gt;Optional providers are also supported:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DuckDuckGo — keyless&lt;/li&gt;
&lt;li&gt;Brave Search — optional&lt;/li&gt;
&lt;li&gt;Tavily — optional&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The easiest way to run it is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx &lt;span class="nt"&gt;-y&lt;/span&gt; better-web-search-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or add it directly to your MCP configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"better-web-search-mcp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"better-web-search-mcp"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it.&lt;/p&gt;

&lt;p&gt;No &lt;code&gt;.env&lt;/code&gt; file is required for the default setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bigger problem isn't search — it's extraction
&lt;/h2&gt;

&lt;p&gt;Getting ten URLs isn't particularly useful if your agent can't actually read them.&lt;/p&gt;

&lt;p&gt;Modern websites can require very different extraction strategies.&lt;/p&gt;

&lt;p&gt;BetterWebSearch uses a &lt;strong&gt;three-tier extraction pipeline&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;Tier 1: Fast HTTP fetch
       ↓
Tier 2: Structured / hydration data
       JSON-LD, __NEXT_DATA__, __NUXT__
       ↓
Tier 3: Playwright browser
       full rendering + API interception
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important part is that it &lt;strong&gt;only escalates when necessary&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If normal HTTP extraction works, there's no reason to launch Chromium.&lt;/p&gt;

&lt;p&gt;If the page is JavaScript-heavy, BetterWebSearch can progressively fall back to structured application data and finally Playwright.&lt;/p&gt;

&lt;p&gt;This keeps simple pages fast while still supporting modern web apps.&lt;/p&gt;

&lt;h2&gt;
  
  
  Built for research, not just search results
&lt;/h2&gt;

&lt;p&gt;The MCP server currently exposes tools including:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;web_search&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Search across providers, deduplicate and rerank results&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;web_research&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Search, extract and return cited research passages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;deep_search&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Alias for &lt;code&gt;web_research&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;web_extract&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Extract clean content from a URL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;web_find&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Search inside a specific website&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;web_news&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Search recent news with diversity filtering&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The tool I find especially useful is &lt;code&gt;web_research&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Instead of making the agent manually do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;web_search
↓
web_extract result 1
↓
web_extract result 2
↓
web_extract result 3
↓
web_extract result 4
↓
web_extract result 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;it can perform the search, extraction and passage selection inside the MCP server and return a much smaller research payload.&lt;/p&gt;

&lt;h2&gt;
  
  
  It can dramatically reduce agent context usage
&lt;/h2&gt;

&lt;p&gt;This was one of the main things I wanted to improve.&lt;/p&gt;

&lt;p&gt;I ran a benchmark comparing two workflows.&lt;/p&gt;

&lt;h3&gt;
  
  
  Traditional workflow
&lt;/h3&gt;

&lt;p&gt;The agent:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;performs a search&lt;/li&gt;
&lt;li&gt;opens the top five pages&lt;/li&gt;
&lt;li&gt;receives their extracted contents&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  BetterWebSearch research workflow
&lt;/h3&gt;

&lt;p&gt;The agent makes one &lt;code&gt;web_research&lt;/code&gt; call and receives selected passages with citations.&lt;/p&gt;

&lt;p&gt;Across &lt;strong&gt;12 live-web research questions&lt;/strong&gt;, the results were:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Traditional&lt;/th&gt;
&lt;th&gt;&lt;code&gt;web_research&lt;/code&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Payload&lt;/td&gt;
&lt;td&gt;820,229 chars&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;110,973 chars&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Estimated tokens&lt;/td&gt;
&lt;td&gt;~205,000&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~28,000&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wall clock&lt;/td&gt;
&lt;td&gt;137.3s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;49.6s&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That's an &lt;strong&gt;86.5% reduction in returned text overall&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The median per-question reduction was &lt;strong&gt;83.8%&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Of course, returning less text isn't useful if the important answer disappears.&lt;/p&gt;

&lt;p&gt;So I added a second benchmark for answer retention.&lt;/p&gt;

&lt;p&gt;Across 34 questions with known factual markers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Numbers             8 / 8
HTTP status codes   6 / 6
Acronym expansions 12 / 12
Facts               7 / 8

Overall: 33 / 34
Retention: 97.1%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The benchmark source is included in the repository, so you can reproduce it yourself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run build
npm run bench
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Query expansion
&lt;/h2&gt;

&lt;p&gt;Another useful feature is automatic query expansion.&lt;/p&gt;

&lt;p&gt;Instead of searching only the exact sentence given by the model, BetterWebSearch can rewrite it into several related searches.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Unlimited mobile internet Germany
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;might also produce queries around:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;unbegrenztes Datenvolumen Deutschland
unlimited data SIM Germany
German unlimited mobile plans
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Those queries can run in parallel before the results are deduplicated and reranked.&lt;/p&gt;

&lt;p&gt;This helps especially with searches where terminology differs between websites or languages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Source independence
&lt;/h2&gt;

&lt;p&gt;Search result count can also be misleading.&lt;/p&gt;

&lt;p&gt;If the same wire story is republished by five websites, that isn't really five independent sources.&lt;/p&gt;

&lt;p&gt;BetterWebSearch clusters similar content before citation so duplicated stories are less likely to be treated as separate evidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  Self-learning extraction
&lt;/h2&gt;

&lt;p&gt;Different domains require different extraction techniques.&lt;/p&gt;

&lt;p&gt;BetterWebSearch remembers which extraction strategy worked for a domain.&lt;/p&gt;

&lt;p&gt;So if the first visit discovers that a site only works properly through a particular structured-data path or browser fallback, later requests can skip unnecessary stages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Security matters too
&lt;/h2&gt;

&lt;p&gt;Web content is untrusted input, especially when it's being consumed automatically by AI agents.&lt;/p&gt;

&lt;p&gt;BetterWebSearch includes several protections.&lt;/p&gt;

&lt;h3&gt;
  
  
  SSRF protection
&lt;/h3&gt;

&lt;p&gt;URLs are validated and requests to things like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;localhost
private IP ranges
link-local addresses
reserved addresses
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;are rejected.&lt;/p&gt;

&lt;p&gt;Redirects are checked again at every hop.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prompt-injection detection
&lt;/h3&gt;

&lt;p&gt;Extracted content is treated as untrusted.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;web_extract&lt;/code&gt; can flag text that appears to contain instructions attempting to manipulate an agent.&lt;/p&gt;

&lt;p&gt;The original content isn't rewritten, but the result carries security information so the calling model can treat it appropriately.&lt;/p&gt;

&lt;h2&gt;
  
  
  It runs locally
&lt;/h2&gt;

&lt;p&gt;Another design goal was avoiding unnecessary infrastructure.&lt;/p&gt;

&lt;p&gt;BetterWebSearch runs locally over MCP stdio.&lt;/p&gt;

&lt;p&gt;There is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;no BetterWebSearch cloud&lt;/li&gt;
&lt;li&gt;no proxy server&lt;/li&gt;
&lt;li&gt;no telemetry&lt;/li&gt;
&lt;li&gt;no analytics service&lt;/li&gt;
&lt;li&gt;no mandatory account&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your queries go to the search provider and target websites, not through another hosted intermediary.&lt;/p&gt;

&lt;h2&gt;
  
  
  Works with most MCP clients
&lt;/h2&gt;

&lt;p&gt;It should work with any MCP client supporting stdio, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claude Desktop&lt;/li&gt;
&lt;li&gt;Claude Code&lt;/li&gt;
&lt;li&gt;Cursor&lt;/li&gt;
&lt;li&gt;VS Code Copilot&lt;/li&gt;
&lt;li&gt;Windsurf&lt;/li&gt;
&lt;li&gt;Cline&lt;/li&gt;
&lt;li&gt;Zed&lt;/li&gt;
&lt;li&gt;OpenCode&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I personally built it primarily around coding-agent and AI research workflows, but there's nothing client-specific about the server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;The fastest way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx &lt;span class="nt"&gt;-y&lt;/span&gt; better-web-search-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NPM:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/better-web-search-mcp" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/better-web-search-mcp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;GitHub:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/PhantomPixelDev/BetterWebSearch-MCP" rel="noopener noreferrer"&gt;https://github.com/PhantomPixelDev/BetterWebSearch-MCP&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Documentation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://phantompixeldev.github.io/BetterWebSearch-MCP/" rel="noopener noreferrer"&gt;https://phantompixeldev.github.io/BetterWebSearch-MCP/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's &lt;strong&gt;MIT licensed&lt;/strong&gt;, so feel free to use it, fork it or contribute.&lt;/p&gt;

&lt;p&gt;If you're using MCP agents heavily, I'd especially be interested in hearing about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;websites where extraction fails&lt;/li&gt;
&lt;li&gt;unusual JavaScript-heavy sites&lt;/li&gt;
&lt;li&gt;search-quality issues&lt;/li&gt;
&lt;li&gt;agent workflows that consume too much context&lt;/li&gt;
&lt;li&gt;providers you'd like to see supported&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Issues and PRs are welcome.&lt;/p&gt;




&lt;h3&gt;
  
  
  TL;DR
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;BetterWebSearch MCP&lt;/strong&gt; gives AI agents:&lt;/p&gt;

&lt;p&gt;🔍 Keyless web search with DuckDuckGo&lt;br&gt;&lt;br&gt;
🧠 Deep research with citations&lt;br&gt;&lt;br&gt;
⚡ HTTP-first extraction&lt;br&gt;&lt;br&gt;
💧 Structured-data extraction&lt;br&gt;&lt;br&gt;
🎭 Playwright fallback when required&lt;br&gt;&lt;br&gt;
📉 Up to ~86% smaller research payloads in my benchmark&lt;br&gt;&lt;br&gt;
🔐 SSRF and prompt-injection protections&lt;br&gt;&lt;br&gt;
🔌 Support for popular MCP clients&lt;br&gt;&lt;br&gt;
🏠 Local execution&lt;br&gt;&lt;br&gt;
💸 No mandatory paid API&lt;br&gt;&lt;br&gt;
🛠️ Open source / MIT&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx &lt;span class="nt"&gt;-y&lt;/span&gt; better-web-search-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>ai</category>
      <category>webdev</category>
      <category>mcp</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
