duckduckgo WebMCP
Browser tool configuration for duckduckgo
URL Pattern: ^https?://duckduckgo\.com(/.*)?$
Allowed Extra Domains: duckduckgo.com, html.duckduckgo.com
Tools (1)
duckduckgo_search()
DuckDuckGo search (HTML lite, no JS needed)
Parameters
query
string
required
- Search query
JavaScript Handler
(params) => {
const run = async function(args) {
if (!args.query) return {error: 'Missing argument: query', hint: 'Provide a search query string'};
const url = 'https://html.duckduckgo.com/html/?q=' + encodeURIComponent(args.query);
const resp = await fetch(url);
if (!resp.ok) return {error: 'HTTP ' + resp.status};
const html = await resp.text();
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
const items = doc.querySelectorAll('.result');
const results = [];
items.forEach(el => {
const anchor = el.querySelector('.result__a');
if (!anchor) return;
const title = anchor.textContent.trim();
let href = anchor.getAttribute('href') || '';
// DuckDuckGo lite wraps URLs in a redirect; extract the actual URL if present
const udMatch = href.match(/[?&]uddg=([^&]+)/);
if (udMatch) href = decodeURIComponent(udMatch[1]);
const snippetEl = el.querySelector('.result__snippet');
const snippet = snippetEl ? snippetEl.textContent.trim() : '';
results.push({title, url: href, snippet});
});
return {query: args.query, count: results.length, results};
};
return run(params || {});
}
🔌 Chrome MCP Server Extension
Use these tools with Claude, ChatGPT, and other AI assistants.
How to Use WebMCP
WebMCP tools are designed for browser extensions or automation frameworks. The browser extension matches the current URL against the pattern and executes the JavaScript handler when the tool is invoked.
API Endpoint:
GET /api/webmcp/match?url=https://www.duckduckgo.com/...