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

@josharsh/webmcp-svelte

v0.1.0

Published

Svelte adapter for webmcp-tools — register WebMCP tools with a Svelte action, a runes-friendly helper, and a readable store of registered tools.

Readme

@josharsh/webmcp-svelte

Svelte adapter for webmcp-tools. Register typed, validated WebMCP tools (document.modelContext) from Svelte components — works in Svelte 4 and 5, no compiler integration needed.

Install

pnpm add webmcp-tools @josharsh/webmcp-svelte

Usage

Action (Svelte 4 & 5)

The tool lives as long as the element. Updates take effect on the next call; changing name re-registers.

<script>
  import { webmcpTool } from "@josharsh/webmcp-svelte";

  let product = { sku: "abc-123" };
</script>

<section
  use:webmcpTool={{
    name: "add-to-cart",
    description: "Add the displayed product to the cart",
    confirm: "Add this product to your cart?",
    run: () => addToCart(product.sku),
  }}
>
  ...
</section>

Runes ($effect, Svelte 5)

<script>
  import { registerTool } from "@josharsh/webmcp-svelte";

  let status = $state("pending");

  $effect(() => {
    const t = registerTool("get-status", {
      description: "Read the current order status",
      readOnly: true,
      run: () => status,
    });
    return () => t.unregister();
  });
</script>

Store of registered tools

registeredTools implements the Svelte store contract (use it with $):

<script>
  import { registeredTools } from "@josharsh/webmcp-svelte";
</script>

<ul>
  {#each $registeredTools as t}
    <li>{t.name}</li>
  {/each}
</ul>

API

| Export | Type | Description | | -------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | webmcpTool(node, params) | Svelte action | Registers params.name as a tool on create, unregisters on destroy. Same-name updates route the latest run/confirm without re-registering; a name change unregisters and re-registers. node is unused (lifecycle only) and may be undefined. | | registerTool(name, definition) | function | Plain wrapper around core tool() for $effect usage. Returns a RegisteredTool — call .unregister() in the effect cleanup. | | registeredTools | readable store | { subscribe(cb) } emitting RegisteredTool[] on every register/unregister (initial snapshot on subscribe). | | WebmcpToolParams<I> | type | { name: string } & ToolDefinition<I> — the action's parameter shape. | | WebmcpToolAction<I> | type | The action's return shape: { update(params), destroy() }. |

ToolDefinition, RegisteredTool, ToolResult, ToolContext, ToolInput, and InferToolArgs are re-exported from webmcp-tools for convenience. See the core README for schemas (Zod/Valibot/ArkType or raw JSON Schema), confirm gates, and the ponyfill.