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

mcp-secure-builder

v0.1.1

Published

Secure-by-default MCP server builder: policy, timeouts, output caps, optional auth, stdio scaffold, registry helper.

Readme

mcp-secure-builder

Small slices so the security model stays easy to understand. Package name on npm: mcp-secure-builder.

This repo is built in small slices so the security model stays easy to understand.

Builder rules (friendly + safe)

Slice 1 — Policy is required

  • Every tool must declare a policy.
  • Missing policy = blocked (deny-by-default).

Why: prevents tools from silently shipping without guardrails.

Slice 2 — Timeout

  • Tools have a timeout (timeoutMs).
  • Slow tools fail fast instead of hanging the server.

Why: reliability and DoS-resistance.

Slice 3 — Output cap

  • Tool output is capped (maxOutputBytes).
  • This protects context size, cost, and reduces accidental data dumping.

Why: tools often return content that ends up in the model context.

Local master key (stdio-friendly)

For tools that should not run unless the server is “configured”, use requireLocalKey: true in policy.

  • Set MCP_LOCAL_KEY in the server environment (at least 8 characters).
  • Cursor stdio: put MCP_LOCAL_KEY in your MCP server env config so only your machine/session has the key.
  • If you pass ctx.localKey or Authorization: Bearer ..., it must match MCP_LOCAL_KEY (optional stricter check).
  • If you do not pass a key in ctx, we only require that MCP_LOCAL_KEY is set on the process (simple “server must be configured” gate).

Search (opt-in)

Search is powerful and higher-risk, so it is opt-in:

  • Search is disabled by default.
  • Mark a tool as search with capability: "search".
  • To enable search tools, create the builder with enableSearch: true.

Search output default cap

  • Normal tools default to a smaller output cap.
  • Search tools default to 64KB output cap if maxOutputBytes is not set.

Paging (safe + easy to remember)

For search results, prefer paging so each call stays small:

  • Input: limit, pageToken
  • Output: results, nextPageToken

This avoids giant outputs and prevents clients from requesting extreme offsets.

Slice 5 — Scaffold a stdio server (CLI)

Default (after publishing): the template uses mcp-secure-builder from npm (^0.1.0 or current version in this repo’s package.json).

npx -p mcp-secure-builder create-mcp-server --name my-mcp-server --out .
# or from a clone of this repo:
node ./scripts/create-mcp-server.mjs --name my-mcp-server --out .

Contributors hacking this repo locally should link the workspace:

node ./scripts/create-mcp-server.mjs --name my-mcp-server --out . --link-local

That writes file: URL dependency to this checkout instead of semver.

Then:

cd my-mcp-server
npm install
npm run build
npm start

After npm link or global install of this package, you can run create-mcp-server on your PATH.

Publish mcp-secure-builder to npm

  1. Create an npm account and log in: npm login
  2. From this repo: npm publish
    • prepublishOnly runs tests first.
  3. Consumers: npm install mcp-secure-builder and use the scaffold default (no --link-local).

If the package name is taken, change "name" in package.json and publish under your scope, e.g. @youruser/mcp-secure-builder.

Slice 6 — MCP Registry (publish metadata)

The registry hosts metadata (not your server binary). Publishing flow is usually:

  1. Publish your npm package (if you use npm as the artifact source).
  2. Create/update server.json (official tool: mcp-publisher init).
  3. Authenticate (mcp-publisher login ...).
  4. Publish metadata (mcp-publisher publish).

This repo includes a small helper mcp-registry that:

  • downloads the official mcp-publisher binary (cached under ~/.cache/sellapp-mcp), and
  • forwards init, login, publish
  • adds validate with a basic server.json shape check (not a full registry gate)

Examples:

# Basic local validation (fast)
npm run registry -- validate .

# Official CLI (interactive / network)
npm run registry -- init .
npm run registry -- login github
npm run registry -- publish .

GitHub Actions automation (OIDC) is documented upstream:
https://github.com/modelcontextprotocol/registry/blob/main/docs/modelcontextprotocol-io/github-actions.mdx

Run tests

npm install
npm test