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

webmcp-chat

v0.5.2

Published

Open-source React chat assistant for WebMCP apps. Drop in a production-ready Gemini-powered widget with built-in UI and fast setup.

Readme

webmcp-chat

Open-source React chat assistant for WebMCP apps.

If your React app already has WebMCP tools, this package gives you a ready-to-use chat assistant UI so you can ship faster. Add one component and get a modern launcher, panel, minimize behavior, and Gemini-based tool calling.

Why webmcp-chat

  • Built for WebMCP React apps
  • Drop-in widget with production-ready default UI
  • Floating chat icon launcher with open/close and minimize
  • Tool-calling assistant powered by Google GenAI (Gemini)
  • TypeScript declarations included
  • Fully customizable layout, labels, icon, size, and position
  • MIT licensed open-source project

Install

npm i webmcp-chat @google/genai @mcp-b/react-webmcp @modelcontextprotocol/sdk @mcp-b/transports zod zod-to-json-schema

If your browser does not provide navigator.modelContext, install the polyfill:

npm i @mcp-b/global

Mandatory Setup: McpClientProvider

WebMcpChatWidget requires a WebMCP client context. Wrap your app root with McpClientProvider.

import '@mcp-b/global'
import { createRoot } from 'react-dom/client'
import { McpClientProvider } from '@mcp-b/react-webmcp'
import { Client } from '@modelcontextprotocol/sdk/client/index.js'
import { TabClientTransport } from '@mcp-b/transports'
import App from './App.jsx'

const client = new Client({ name: 'MyApp', version: '1.0.0' })
const transport = new TabClientTransport({ targetOrigin: window.location.origin })

createRoot(document.getElementById('root')).render(
  <McpClientProvider client={client} transport={transport}>
    <App />
  </McpClientProvider>,
)

Quick Start

import { WebMcpChatWidget } from 'webmcp-chat'

// Plain CSS build-safe import (works without Tailwind in your app)
import 'webmcp-chat/styles.css'

export default function App() {
  return (
    <>
      {/* Your app UI */}

      <WebMcpChatWidget
        apiKey={import.meta.env.VITE_GEMINI_API_KEY}
        title="Chat Assistant"
      />
    </>
  )
}

What You Need In Your App

  • A React app that already exposes WebMCP tools
  • A McpClientProvider already initialized in your app shell
  • Gemini API key for current model support
  • Required packages for tool calling: @mcp-b/react-webmcp, @modelcontextprotocol/sdk, @mcp-b/transports
  • Some WebMCP tool stacks also require: zod, zod-to-json-schema

Default UX

By default, WebMcpChatWidget provides:

  • Floating assistant launcher icon
  • Click launcher to open/close panel
  • Header minimize button
  • Styled chat panel with status, messages, and composer
  • Smart mobile behavior and responsive sizing

By default, styles are auto-injected by the widget.

You can also import styles explicitly:

  • Plain CSS (recommended for all apps): import 'webmcp-chat/styles.css'
  • Tailwind source CSS (for Tailwind-based override workflows): import 'webmcp-chat/styles.tailwind.css'

Use the Tailwind stylesheet only when your app already compiles Tailwind CSS.

Props

Runtime

  • apiKey?: string
  • model?: string (default: gemini-2.5-flash)
  • systemPrompt?: string

Widget Behavior

  • defaultOpen?: boolean
  • showLauncher?: boolean
  • showMinimizeButton?: boolean

Placement and Size

  • position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'
  • size?: 'sm' | 'md' | 'lg'

Launcher Customization

  • launcherIcon?: ReactNode
  • launcherLabel?: string
  • closeLauncherLabel?: string
  • launcherClassName?: string

Chat Content and Labels

  • title?: string
  • placeholder?: string
  • emptyState?: string
  • sendLabel?: string
  • clearLabel?: string
  • minimizeLabel?: string
  • showClearButton?: boolean

Styling Hooks

  • className?: string
  • panelClassName?: string
  • chatClassName?: string

Customization Example

import { WebMcpChatWidget } from 'webmcp-chat'

function MyChatIcon() {
  return <span style={{ fontSize: 18 }}>AI</span>
}

export default function App() {
  return (
    <WebMcpChatWidget
      apiKey={import.meta.env.VITE_GEMINI_API_KEY}
      title="Product Assistant"
      position="bottom-left"
      size="lg"
      launcherIcon={<MyChatIcon />}
      launcherLabel="Open product assistant"
      closeLauncherLabel="Close product assistant"
      minimizeLabel="Minimize product assistant"
    />
  )
}

Model Support

Current:

  • Gemini (Google GenAI)

Planned roadmap:

  • GPT
  • Claude
  • Groq
  • Additional providers through a provider-agnostic adapter layer

Open Source

webmcp-chat is an open-source project under MIT license.

Contributions are welcome for:

  • New model providers
  • Better theming presets
  • Accessibility enhancements
  • Extended test coverage
  • Docs/examples

See contribution guidelines in CONTRIBUTING.md.

Owner details are in OWNER.md.

License details are in LICENSE.

Community rules are in CODE_OF_CONDUCT.md.

Security reporting policy is in SECURITY.md.

Local Development

npm run dev
npm run test
npm run build

Publish

npm publish --access public