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

@h0wzy/mcp-shared

v1.0.7

Published

Shared cross-platform utilities, binary resolvers, resilient error handlers, and generic MCP stdio server for H0wZy/mcp

Readme

⚡ @h0wzy/mcp-shared

npm License: MIT

Reusable core engine, cross-platform binary resolvers, resilient error handlers, credential sanitizers, and generic MCP JSON-RPC 2.0 stdio server for H0wZy/mcp.


📦 What's Inside

@h0wzy/mcp-shared eliminates code duplication across MCP server implementations:

  • createMcpServer({ name, version, tools }): Zero-dependency JSON-RPC 2.0 stdio engine (initialize with protocol version negotiation, ping, tools/list with annotations, tools/call, notifications/cancelled). Tool handlers receive (args, { signal }). Closing stdin stops in-flight calls and the processes they started.
  • executeProcess(command, args, options): Child process runner with timeouts, process-tree kill (process group on POSIX, taskkill /T on Windows), AbortSignal cancellation, per-stream output cap, stdin input, and safe quoting for .cmd/.bat shims.
  • resolveBinary(name, overrideEnvVar): Cross-platform executable discovery. Handles Windows path delimiters (;), extensions (.exe, .cmd, .bat via PATHEXT), and POSIX paths.
  • validateCwd(cwd), normalizePaths(paths, base), clampTimeoutMinutes(value): Validation for values that reach an agent's command line.
  • createAgentConfig({ provider, catalogLoader }): Model and reasoning-effort control: catalogs, tiers (light / balanced / deep), developer ceilings and per-call snapshots.
  • sanitizeOutput(text): Strips OpenAI keys (sk-...), Google/Gemini keys (AIza...), GitHub tokens (ghp_...), npm tokens (npm_...) and Bearer tokens before output reaches host agents.
  • formatResilientResponse({ provider, rawOutput, exitCode }): Turns HTTP 429 / ResourceExhausted quota errors and auth failures into informative { isError: true } responses, so host agents degrade gracefully.

🚀 Installation & Usage

npm install @h0wzy/mcp-shared
import { createMcpServer, resolveBinary, executeProcess } from '@h0wzy/mcp-shared';

const server = createMcpServer({
  name: 'my-custom-mcp-server',
  version: '1.0.0',
  tools: [
    {
      name: 'my_tool',
      description: 'Executes a custom CLI task',
      inputSchema: {
        type: 'object',
        properties: { query: { type: 'string' } },
        required: ['query'],
      },
      annotations: { readOnlyHint: true },
      handler: async ({ query }, { signal }) => {
        const bin = resolveBinary('my-cli', 'MY_CLI_PATH');
        if (!bin) return { text: 'my-cli not found', isError: true };
        const res = await executeProcess(bin, [query], { timeoutMs: 60000, signal });
        return { text: res.ok ? res.stdout : res.stderr, isError: !res.ok };
      },
    },
  ],
});

server.start();

📄 License

Created by Marcos (H0wZy) under the MIT License.
Full repository: 👉 H0wZy/mcp