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

@braedonsaunders/appkit-mcp

v0.1.0

Published

Expose an app's governed tool catalogue over the Model Context Protocol — framework-neutral streamable-HTTP handling, request-boundary validation, gated tool registration with audit hooks, and static resources.

Readme

@braedonsaunders/appkit-mcp

Expose an app's governed tool catalogue over the Model Context Protocol.

The design rule this package enforces: the agent surface is a thin adapter over the same gated engines the app already uses, never a parallel API. An app defines its capabilities once as a catalogue; MCP registration, transport handling, boundary defence, and audit are the reusable part. A tool the caller may not use is never registered — the model cannot see it, so it cannot ask for it. Everything a tool throws passes through one error mapper; anything the mapper declines collapses to a generic failure, so stack frames, SQL, and secrets can never reach the model by accident.

Framework-neutral: everything speaks web-standard Request/Response, so the same handler serves Next.js route handlers, Hono, Bun, or plain Node.

The pieces

| Module | What it owns | | --- | --- | | catalog | McpCatalogTool — one entry in the app's canonical capability catalogue — and registerToolCatalog, which registers only the visible ones, wraps execution in the result contract, times it, and reports every call to an audit hook. | | handler | handleStreamableHttpRequest — one stateless streamable-HTTP exchange: fresh transport, auth info forwarded, X-Request-ID + no-store stamped, transport and server always torn down. resolveMcpRequestId accepts a well-formed caller id and replaces anything else. | | boundary | Host validation (DNS-rebinding defence) and cross-origin allowlisting, plus JSON-RPC error responses, CORS preflight, and 405. | | result | mcpSuccess / mcpFailure and the McpErrorMapper seam. | | resources | registerStaticResources — ship ground rules, playbooks, and live schemas as readable resources, so an agent learns the app's doctrine from the surface itself. |

Usage

import {
  handleStreamableHttpRequest,
  mcpBoundaryResponse,
  registerStaticResources,
  registerToolCatalog,
  resolveMcpRequestId,
} from '@braedonsaunders/appkit-mcp'
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'

export async function POST(request: Request): Promise<Response> {
  const rejected = mcpBoundaryResponse(request, { allowedOrigins: TRUSTED_ORIGINS })
  if (rejected) return rejected

  const auth = await authenticate(request)          // the app's own auth
  const server = new McpServer({ name: 'my-app', version: VERSION }, { instructions })

  registerToolCatalog(server, TOOL_CATALOG, {
    context: appContext(auth),                      // tenant + RBAC-bound
    mapError: (e) => (e instanceof AppError ? { code: e.code, message: e.message } : null),
    audit: (event) => auditLog(auth, event),
  })
  registerStaticResources(server, PLAYBOOKS)

  return handleStreamableHttpRequest(request, {
    server,
    requestId: resolveMcpRequestId(request),
    authInfo: { token: auth.keyId, clientId: auth.clientId, scopes: auth.scopes },
  })
}

What stays in the app

Authentication, rate limiting, the catalogue itself, and every domain rule. Tools must terminate in the app's governed services — permissions, validation, idempotency, period locks — so the MCP surface can never do something a normal API caller could not, and the agent acts as the authenticated user, never as the platform.