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/react

v0.2.1

Published

React components for webMCP AI-optimized web interactions

Readme

@webmcp/react

React components for webMCP AI-optimized web interactions. Reduce form abandonment and optimize user experiences with intelligent AI-powered suggestions.

Features

  • 🤖 AI-Powered Form Optimization - Reduce tokens by 67.6% for AI agent interactions
  • 📊 Real-time Analytics - Track completion rates, token savings, and cost reductions
  • 🛡️ Built-in Security - CSRF protection and JWT scoping
  • Smart Suggestions - AI-driven input completion and validation
  • 📱 Responsive Design - Works seamlessly across all devices

Installation

npm install @webmcp/react @webmcp/core

Quick Start

import React from 'react';
import { WebMCPForm, WebMCPInput, WebMCPButton, useWebMCP } from '@webmcp/react';

function ContactForm() {
  const { analytics } = useWebMCP({
    targetModel: 'gpt-4o',
    compressionLevel: 'advanced'
  });

  const handleSubmit = (data: any) => {
    console.log('Form submitted:', data);
  };

  const handleOptimize = (result: any) => {
    console.log('AI optimization:', result);
  };

  return (
    <WebMCPForm
      onSubmit={handleSubmit}
      onOptimize={handleOptimize}
      goalDescription="Collect user contact information"
      enableAI={true}
    >
      <WebMCPInput
        name="name"
        placeholder="Your name"
        required
        aiSuggestions={true}
      />
      
      <WebMCPInput
        name="email"
        type="email"
        placeholder="[email protected]"
        required
        aiSuggestions={true}
      />
      
      <WebMCPInput
        name="phone"
        type="tel"
        placeholder="Phone number"
        aiSuggestions={true}
      />
      
      <WebMCPButton type="submit">
        Submit Contact Info
      </WebMCPButton>
    </WebMCPForm>
  );
}

Components

WebMCPForm

AI-optimized form wrapper that automatically processes submissions for better AI agent interactions.

<WebMCPForm
  onSubmit={handleSubmit}
  onOptimize={handleOptimize}
  config={{
    targetModel: 'gpt-4o',
    compressionLevel: 'advanced',
    enableAnalytics: true
  }}
  goalDescription="User registration form"
  enableAI={true}
>
  {/* Your form inputs */}
</WebMCPForm>

WebMCPInput

Smart input component with AI-powered suggestions and validation.

<WebMCPInput
  name="email"
  type="email"
  placeholder="Enter email"
  required
  aiSuggestions={true}
  webmcpRole="input.email"
  onChange={(value) => console.log(value)}
/>

WebMCPButton

Enhanced button component with webMCP semantic roles.

<WebMCPButton
  type="submit"
  webmcpRole="button.submit"
  onClick={handleClick}
>
  Submit Form
</WebMCPButton>

WebMCPAnalytics

Display real-time form performance analytics.

import { useWebMCP, WebMCPAnalytics } from '@webmcp/react';

function MyComponent() {
  const { analytics } = useWebMCP();
  
  return <WebMCPAnalytics analytics={analytics} />;
}

Hooks

useWebMCP

Main hook for accessing webMCP functionality.

const {
  optimizeForm,
  validateForm,
  generateAISuggestions,
  isOptimizing,
  analytics,
  processor
} = useWebMCP({
  targetModel: 'gpt-4o',
  compressionLevel: 'advanced',
  enableAnalytics: true
});

Configuration

Configure webMCP behavior through the config object:

const config = {
  apiKey: 'your-api-key', // Optional: for premium features
  targetModel: 'gpt-4o', // 'gpt-4o' | 'claude-3.5-sonnet' | 'gemini-pro'
  compressionLevel: 'advanced', // 'basic' | 'advanced' | 'premium'
  enableAnalytics: true,
  enableSecurity: true
};

Benefits

  • Token Reduction: Average 67.6% reduction in AI processing tokens
  • Better UX: Smart suggestions reduce form abandonment
  • Cost Savings: Lower API costs for AI-powered applications
  • Security: Built-in CSRF protection and secure data handling
  • Analytics: Real-time insights into form performance

Real-World Use Cases

E-commerce Checkout

<WebMCPForm goalDescription="Complete purchase checkout">
  <WebMCPInput name="billing_address" aiSuggestions={true} />
  <WebMCPInput name="card_number" type="text" aiSuggestions={false} />
  <WebMCPButton type="submit">Complete Order</WebMCPButton>
</WebMCPForm>

User Registration

<WebMCPForm goalDescription="Create new user account">
  <WebMCPInput name="username" aiSuggestions={true} />
  <WebMCPInput name="email" type="email" aiSuggestions={true} />
  <WebMCPInput name="password" type="password" aiSuggestions={false} />
  <WebMCPButton type="submit">Create Account</WebMCPButton>
</WebMCPForm>

Lead Generation

<WebMCPForm goalDescription="Collect qualified sales leads">
  <WebMCPInput name="company" aiSuggestions={true} />
  <WebMCPInput name="industry" aiSuggestions={true} />
  <WebMCPInput name="budget" aiSuggestions={true} />
  <WebMCPButton type="submit">Get Quote</WebMCPButton>
</WebMCPForm>

TypeScript Support

Full TypeScript support with comprehensive type definitions:

import type { 
  WebMCPConfig, 
  WebMCPFormProps, 
  OptimizationResult,
  WebMCPAnalytics
} from '@webmcp/react';

Performance

  • Fast: Minimal overhead, client-side processing
  • 🗄️ Cached: Intelligent caching reduces redundant processing
  • 📦 Lightweight: Small bundle size, tree-shakeable
  • 🔄 Optimized: Works with React 16.8+ and all modern browsers

License

MIT - see LICENSE for details.

Support


webMCP React Components - Making forms smarter with AI 🤖✨