duckduckgo WebMCP
Browser tool configuration for duckduckgo
Tools (1)
duckduckgo_search()
DuckDuckGo search (HTML lite, no JS needed)
Parameters
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 || {});
}
WebMCP clients
Use mcp-chrome, or fetch the same tools from the public API in your own browser automation runtime.
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/...
Third-party clients can use the same endpoint as mcp-chrome. Execute the returned JavaScript handler in your own browser page context.