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-attributes

v0.1.2

Published

Type-safe framework agnostic utilities for WebMCP tool attributes

Readme

webmcp-attributes

Type-safe framework agnostic utilities for adding WebMCP tool attributes to forms and links.

Installation

npm install webmcp-attributes

Usage

Import the mcp utility and spread the returned attributes onto your forms and links. Works with React, Vue, Angular, Svelte, or any framework:

React Example

import { mcp } from 'webmcp-attributes';

function ContactForm() {
  return (
    <form 
      action="/api/contact"
      {...mcp.tool('send-message', 'Send a contact message')}
    >
      <input 
        name="email"
        type="email"
        required
        {...mcp.param('Your email address', { 
          type: 'string', 
          required: true 
        })}
      />
      
      <textarea 
        name="message"
        required
        {...mcp.param('Your message', { 
          type: 'string', 
          required: true,
          min: 10 
        })}
      />
      
      <button type="submit">Send</button>
    </form>
  );
}

function QuickAction() {
  return (
    <a 
      href="/api/logout"
      {...mcp.tool('logout', 'Log out the current user')}
    >
      Logout
    </a>
  );
}

Vue Example

<template>
  <form action="/api/contact" v-bind="mcp.tool('send-message', 'Send a contact message')">
    <input 
      name="email" 
      type="email" 
      required
      v-bind="mcp.param('Your email address', { type: 'string', required: true })"
    />
    <button type="submit">Send</button>
  </form>
</template>

<script>
import { mcp } from 'webmcp-attributes';

export default {
  setup() {
    return { mcp };
  }
};
</script>

Vanilla JavaScript Example

import { mcp } from 'webmcp-attributes';

const form = document.createElement('form');
const toolAttrs = mcp.tool('add-todo', 'Add a new todo item');
Object.assign(form, toolAttrs);

const input = document.createElement('input');
const paramAttrs = mcp.param('Todo text', { type: 'string', required: true });
Object.assign(input, paramAttrs);

API

mcp.tool(name, description?)

Creates attributes for MCP tool registration on forms and links.

  • name (string): The tool name used as the MCP tool identifier
  • description (string, optional): Description of what the tool does

Returns an object with tool-name and optionally tool-description attributes.

mcp.param(description, schema?)

Creates attributes for MCP parameter descriptions on form inputs.

  • description (string): Description of what this parameter represents
  • schema (object, optional): Schema validation (reserved for future use)

Returns an object with tool-param-description attribute.

How it Works

This package generates the HTML attributes that the WebMCP extension looks for:

  • Forms and links with tool-name and tool-description become MCP tools
  • Inputs with tool-param-description become tool parameters
  • The WebMCP extension automatically generates MCP servers from these attributes

TypeScript Support

Full TypeScript support with proper typing for all attributes and return values.