bing WebMCP
Browser tool configuration for bing
Tools (1)
bing_search()
Bing 搜索
Parameters
JavaScript Handler
(params) => {
const run = async function(args) {
const query = args.query;
if (!query) return {error: 'query is required'};
const count = args.count || 10;
const url = 'https://www.bing.com/search?q=' + encodeURIComponent(query) + '&count=' + count;
const resp = await fetch(url, {credentials: 'include'});
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('li.b_algo');
const results = [];
items.forEach(li => {
const anchor = li.querySelector('h2 > a');
if (!anchor) return;
const title = anchor.textContent.trim();
const href = anchor.getAttribute('href') || '';
const snippet = (li.querySelector('p') || {}).textContent || '';
results.push({title, url: href, snippet: snippet.trim()});
});
return {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.bing.com/...
Third-party clients can use the same endpoint as mcp-chrome. Execute the returned JavaScript handler in your own browser page context.