DEV Community

z z
z z

Posted on

I built an MCP server that searches the web

MCP servers become a lot more useful when they can reach the internet. A file-reader is nice. A tool that fetches live data is something else.

I built a web search tool for MCP. It uses DuckDuckGo (free, no API key needed) and returns LLM-formatted results.

The tool

The tool accepts a query and optional maxResults. It searches DuckDuckGo's HTML endpoint (no API key required) and returns titles, snippets, and URLs.

The code pattern

ypescript
async function searchDuckDuckGo(query: string, maxResults = 5) {
const url = https://html.duckduckgo.com/html/?q=;
const res = await fetch(url);
const html = await res.text();
// parse results...
}

DuckDuckGo's HTML endpoint works without API keys. No rate limiting for reasonable use.

Adding it to your server

The full implementation with error handling, timeout, and result formatting is in the premium MCP kit. The free starter has the basic pattern.

Why this matters

An MCP server that stays local is a typewriter. An MCP server that reaches the web is a computer. Your LLM can check current prices, look up documentation, verify facts -- while you watch.

The starter repo is here.

Top comments (0)