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

@hlos/mcp-sdk

v0.2.0

Published

Surface SDK for HLOS MCP servers — bootstrap, auth, and Kernel client

Readme

@hlos/mcp-sdk

Core authentication and utilities for HLOS MCP server packages.

Wave 2: env validation + bootstrapServer

Downstream server packages should use bootstrapServer() to get consistent startup behavior:

  • Validation: required env vars (from ServerMetadata.env) are validated before start() runs.
  • Help text: formatEnvHelp(metadata) prints deterministic, sorted env var help.
  • Redaction guarantee:
    • Env var names are safe to print.
    • Env var values are never printed by validation errors.
    • If a thrown error message accidentally contains a secret, bootstrapServer strips exact values for env vars marked sensitive: true in ServerMetadata.env (and also applies token-pattern redaction).

Minimal pattern:

import { bootstrapServer, formatEnvHelp, type ServerMetadata } from '@hlos/mcp-sdk';

export const SERVER_METADATA: ServerMetadata = {
  id: 'my-server',
  packageName: '@hlos/mcp-server-my-server',
  binName: 'mcp-server-my-server',
  description: '…',
  hostedEndpoint: 'https://mcp.hlos.ai/my-server',
  env: [{ name: 'HLOS_ACCESS_TOKEN', required: true, sensitive: true }],
  capabilities: [],
};

if (process.argv.includes('--help')) {
  console.log(formatEnvHelp(SERVER_METADATA));
  process.exit(0);
}

await bootstrapServer({
  metadata: SERVER_METADATA,
  start: async ({ env, logger }) => {
    logger.info(`Starting ${SERVER_METADATA.id}`);
    // Use env[...] and never log secrets.
  },
});

How to update schemas (generated contracts)

This package maintains canonical contracts (auth result shapes, hosted config shapes, shared metadata) and generates deterministic artifacts into src/generated/.

  • Versioning: CONTRACTS_VERSION follows SemVer:

    • patch: docs / non-breaking clarifications (no schema shape changes)
    • minor: additive-only changes (new optional fields, new enum variants, etc.)
    • major: breaking changes (removals, renames, stricter validation)
  • Update / add Zod schemas in scripts/schema.ts

  • Regenerate committed artifacts:

pnpm -C packages/core generate:schemas
  • CI guard (verify no diffs):
pnpm -C packages/core generate:schemas:check

Downstream usage (example)

import { CONTRACTS_SCHEMA, CONTRACTS_VERSION, assertContractsVersion } from '@hlos/mcp-sdk';

// Fail fast if you expect a compatible contracts major version:
assertContractsVersion('1.');

// CONTRACTS_SCHEMA is an embedded JSON Schema bundle you can feed into Ajv, etc.
console.log(CONTRACTS_VERSION, Object.keys((CONTRACTS_SCHEMA as any).schemas));

Attribution Metadata

MCP servers can forward optional attribution metadata for downstream billing and analytics:

import type { AttributionMetadata } from '@hlos/mcp-sdk';

const attribution: AttributionMetadata = {
  distributionSurface: 'discord',  // "discord", "slack", "cli", "api", "web", "unknown"
  clientType: 'claude_desktop',    // "claude_desktop", "claude_code", "chatgpt", "ide", "api", "unknown"
};

Server-Level Default

Set defaults via environment variables:

| Env Var | Field | Example | |---------|-------|---------| | HLOS_DISTRIBUTION_SURFACE | distributionSurface | "discord" | | HLOS_CLIENT_TYPE | clientType | "claude_desktop" |

These defaults are baked into ServerMetadata.attribution and passed to the BootstrapContext:

await bootstrapServer({
  metadata: SERVER_METADATA,
  start: async (ctx) => {
    // ctx.attribution?.distributionSurface
    // ctx.attribution?.clientType
  },
});

Request-Level Override (Future)

Server-level attribution is a default. Per-request attribution overrides (via headers or context) may be added in the future. Prefer per-request values when available.