npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mcp-web-bridge

v1.0.1

Published

Connect any MCP server to Chrome's WebMCP API

Readme

mcp-web-bridge

Connect any MCP server to Chrome's WebMCP API.

You have MCP servers. You want them in the browser. This module connects to a remote MCP server, discovers its tools, and registers them with navigator.modelContext.

npm install mcp-web-bridge

Usage

import { WebMCPBridge } from 'mcp-web-bridge';

const bridge = new WebMCPBridge('https://mcp.example.com');
await bridge.connect();
bridge.register();

That's it. Tools are now available to Chrome's AI agent.

With context enrichment

const bridge = new WebMCPBridge('https://mcp.example.com', {
  enrichContext: (toolName, args) => ({
    ...args,
    user_locale: navigator.language,
    user_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
  }),
  onResponse: (toolName, result) => {
    console.log(`[${toolName}]`, result);
    return result;
  },
});

await bridge.connect();
bridge.register();

With auth

const bridge = new WebMCPBridge('https://mcp.example.com');
bridge.setAuth({ type: 'bearer', token: 'sk-...' });
await bridge.connect();

Supports bearer, apikey, and basic auth. OAuth with PKCE is handled by the MCPAuth class.

Custom headers

const bridge = new WebMCPBridge('https://mcp.example.com', {
  headers: {
    'X-Custom-Header': 'value',
    'Authorization': 'Bearer sk-...',
  },
});

Custom headers are merged into every request. Auth headers from setAuth() are applied first, then your custom headers override.

Add page-local tools

bridge.register([
  {
    name: 'get_selection',
    description: 'Get the currently selected text on the page',
    inputSchema: { type: 'object', properties: {} },
    execute: async () => ({
      content: [{ type: 'text', text: window.getSelection().toString() }],
    }),
  },
]);

Mix remote MCP tools with local browser capabilities.

API

new WebMCPBridge(serverUrl, options?)

| Option | Type | Description | |--------|------|-------------| | headers | object | Custom headers merged into every request | | enrichContext | (name, args) => args | Enrich tool args before proxying | | onToolCall | (name, args) => void | Called before each tool call | | onResponse | (name, result) => result | Transform responses | | onError | (name, error) => void | Error handler | | logger | object | Custom logger (default: console) |

Methods

| Method | Returns | Description | |--------|---------|-------------| | connect() | { tools, prompts, resources } | Initialize + discover | | register(extraTools?) | tool[] | Register with WebMCP | | callTool(name, args) | result | Call a tool | | getPrompt(name, args) | result | Get a prompt | | readResource(uri) | result | Read a resource | | setAuth({ type, token }) | — | Set auth before connecting | | disconnect() | — | Clear context + logout |

Browser requirements

  • Chrome 146+ with chrome://flags/#enable-webmcp-testing
  • Without WebMCP, connect() and callTool() still work — you just can't register()

License

MIT