npm WebMCP
Browser tool configuration for npm
Tools (1)
npm_search()
Search npm packages via registry API
Parameters
JavaScript Handler
(params) => {
const run = async function(args) {
const query = args.query;
if (!query) return {error: 'Missing required argument: query'};
const size = Math.min(args.count || 20, 250);
const url = `https://registry.npmjs.org/-/v1/search?text=${encodeURIComponent(query)}&size=${size}`;
const resp = await fetch(url);
if (!resp.ok) return {error: 'HTTP ' + resp.status};
const data = await resp.json();
const packages = (data.objects || []).map(obj => {
const pkg = obj.package || {};
const score = obj.score || {};
return {
name: pkg.name,
version: pkg.version,
description: (pkg.description || '').substring(0, 300),
author: pkg.publisher?.username || pkg.author?.name || null,
date: pkg.date,
url: pkg.links?.npm || `https://www.npmjs.com/package/${pkg.name}`,
homepage: pkg.links?.homepage || null,
repository: pkg.links?.repository || null,
score: Math.round((score.final || 0) * 100) / 100,
searchScore: Math.round((obj.searchScore || 0) * 100) / 100,
keywords: (pkg.keywords || []).slice(0, 8)
};
});
return {total: data.total || packages.length, count: packages.length, packages};
};
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.npm.com/...
Third-party clients can use the same endpoint as mcp-chrome. Execute the returned JavaScript handler in your own browser page context.