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-registry-spec-sdk

v0.4.0

Published

A minimal, typed client for the official Model Context Protocol (MCP) Registry API.

Readme

MCP Registry SDK (TypeScript)

A minimal, typed client for the official Model Context Protocol (MCP) Registry API.

Install

  • npm: npm install mcp-registry-spec-sdk
  • pnpm: pnpm add mcp-registry-spec-sdk
  • yarn: yarn add mcp-registry-spec-sdk

Requires Node.js 18+.

Quick start

import { MCPRegistryClient } from "mcp-registry-spec-sdk";

// Default: v0.1 (stable) API
const client = new MCPRegistryClient();

// Optionally set a default Bearer token for publish/admin
client.setAuthToken(process.env.MCP_REGISTRY_TOKEN);

// Ping
const ping = await client.ping.ping();
console.log("ping:", ping);

// Health
const health = await client.health.getHealth();
console.log("health:", health);

// List servers (with optional filters)
const list = await client.server.listServers({
  search: "openai",
  limit: 10,
  updatedSince: "2024-01-01T00:00:00Z",
  includeDeleted: false,
});
console.log("servers:", list.servers.length, "next:", list.metadata.nextCursor);

// Get a specific server version
const server = await client.server.getServerVersion("org/server-name", "latest");
console.log("server:", server.server.name);

API Versions:

  • v0.1 (default): Stable version, only additive backward-compatible changes
  • v0: Development version, may evolve with breaking changes
// Explicit v0 if needed
const devClient = new MCPRegistryClient(undefined, "v0");

API surface

The client is namespaced by feature:

  • auth — Token exchange helpers
  • health — Health check
  • ping — Connectivity check
  • server — List/get servers (+ version endpoints)
  • publish — Publish a server
  • admin — Admin-only operations (edit, delete, status updates)

Client

import { MCPRegistryClient } from "mcp-registry-spec-sdk";

const client = new MCPRegistryClient(); // default: official registry, v0.1

// Custom base URL
const custom = new MCPRegistryClient("https://my-registry.example.com");

// Set or clear a default token used by publish/admin
client.setAuthToken("YOUR_REGISTRY_JWT"); // omit or pass undefined to clear

Servers

List servers with optional pagination and filters:

const response = await client.server.listServers({
  cursor: "opaque-cursor",   // optional
  limit: 20,                 // optional
  search: "my query",        // optional
  updatedSince: "2024-01-01T00:00:00Z", // optional (ISO-8601)
  version: "1.0.0",          // optional
  includeDeleted: true,      // optional — include deleted servers
});
// response.servers: ServerResponse[]
// response.metadata: { count: number, nextCursor?: string }

Get a specific server version:

const latest = await client.server.getServerVersion("org/server-name", "latest");
const specific = await client.server.getServerVersion("org/server-name", "1.2.3");

// With include_deleted
const deleted = await client.server.getServerVersion("org/server-name", "1.0.0", {
  includeDeleted: true,
});

List all versions for a server:

const versions = await client.server.listServerVersions("org/server-name");
// Also supports { includeDeleted: true }

Publish

Publish or update a server entry. Requires a registry token (JWT).

import type { ServerJSON } from "mcp-registry-spec-sdk";

const serverPayload: ServerJSON = {
  name: "org/my-server",
  description: "My MCP server",
  version: "1.0.0",
};

// Uses default token set via client.setAuthToken()
const published = await client.publish.publishServer(serverPayload);

// Or pass token per call
const published2 = await client.publish.publishServer(serverPayload, "my-jwt-token");

Admin

Edit, delete, and update status of server versions. All require a registry token.

// Edit a server version
const edited = await client.admin.editServerVersion(
  "org/server-name", "1.0.0",
  { name: "org/server-name", description: "Updated", version: "1.0.0" },
);

// Delete a server version (optional endpoint, not on official registry)
const deleted = await client.admin.deleteServerVersion("org/server-name", "1.0.0");

// Update status of a single version
const updated = await client.admin.updateVersionStatus(
  "org/server-name", "1.0.0",
  { status: "deprecated", statusMessage: "Use v2 instead" },
);

// Update status of ALL versions
const allUpdated = await client.admin.updateAllVersionsStatus(
  "org/server-name",
  { status: "deprecated", statusMessage: "Project archived" },
);
// allUpdated: { updatedCount: number, servers: ServerResponse[] }

Auth (token exchange)

Exchange third-party tokens/signatures for a registry JWT.

// GitHub OAuth access token -> Registry JWT
const jwt1 = await client.auth.exchangeGitHubOAuthAccessTokenForRegistryJWT({
  github_token: "gho_xxx",
});

// GitHub OIDC token -> Registry JWT
const jwt2 = await client.auth.exchangeGitHubOIDCTokenForRegistryJWT({
  oidc_token: "gh-oidc-xxx",
});

// Generic OIDC ID token -> Registry JWT
const jwt3 = await client.auth.exchangeOIDCIDTokenForRegistryJWT({
  oidc_token: "oidc-xxx",
});

// HTTP signature -> Registry JWT
const jwt4 = await client.auth.exchangeHTTPSignatureForRegistryJWT({
  domain: "yourdomain.com",
  signed_timestamp: "base64signature",
  timestamp: new Date().toISOString(),
});

// DNS signature -> Registry JWT
const jwt5 = await client.auth.exchangeDNSSignatureForRegistryJWT({
  domain: "yourdomain.com",
  signed_timestamp: "base64signature",
  timestamp: new Date().toISOString(),
});

Types

All request/response shapes are exported as TypeScript types and Zod schemas.

import type {
  ServerJSON,
  ServerResponse,
  ServerListResponse,
  ListServersOptions,
  TokenResponse,
  ErrorModel,
  StatusUpdateRequest,
  AllVersionsStatusResponse,
  // Transports
  StdioTransport,
  StreamableHttpTransport,
  SseTransport,
  // Arguments (discriminated union)
  Argument,
  PositionalArgument,
  NamedArgument,
  KeyValueInput,
  Input,
  InputWithVariables,
  // Other
  Icon,
  Repository,
  Package,
} from "mcp-registry-spec-sdk";

Zod Schemas

Every type has a corresponding Zod schema exported for runtime validation:

import {
  ServerJSONSchema,
  ServerResponseSchema,
  ArgumentSchema,
  StatusUpdateRequestSchema,
} from "mcp-registry-spec-sdk";

const parsed = ServerJSONSchema.safeParse(myData);
if (!parsed.success) console.error(parsed.error);

Argument Types

Arguments use a discriminated union on the type field:

import type { PositionalArgument, NamedArgument, KeyValueInput } from "mcp-registry-spec-sdk";

const positional: PositionalArgument = {
  type: "positional",
  valueHint: "FILE",
  description: "Input file path",
  format: "filepath",
};

const named: NamedArgument = {
  type: "named",
  name: "--port",
  description: "Port number",
  format: "number",
  default: "3000",
};

// Environment variables and headers use KeyValueInput (requires name)
const envVar: KeyValueInput = {
  name: "API_KEY",
  description: "Your API key",
  isRequired: true,
  isSecret: true,
};

Transport Types

Servers can use three transport types:

import type { StdioTransport, StreamableHttpTransport, SseTransport } from "mcp-registry-spec-sdk";

const stdio: StdioTransport = { type: "stdio" };

const http: StreamableHttpTransport = {
  type: "streamable-http",
  url: "https://api.example.com/mcp",
  headers: [{ name: "Authorization", value: "Bearer {token}" }],
};

const sse: SseTransport = {
  type: "sse",
  url: "https://api.example.com/mcp",
};

URL Template Variables

Remote transports support URL template variables:

import type { Remote } from "mcp-registry-spec-sdk";

const remote: Remote = {
  type: "sse",
  url: "https://api.{tenant_id}.example.com/mcp",
  variables: {
    tenant_id: {
      description: "Tenant identifier",
      isRequired: true,
      placeholder: "your-tenant-id",
    },
  },
};

Icon Schema

import type { Icon } from "mcp-registry-spec-sdk";

const icon: Icon = {
  src: "https://example.com/icon.png", // HTTPS URL, max 255 chars
  mimeType: "image/png",
  sizes: ["32x32", "64x64"],
  theme: "light",
};

Browser usage

This SDK is designed for server-side Node.js. Browser usage requires a fetch polyfill and may hit CORS restrictions.

Migrating to v0.4.0

Breaking Changes

  1. Default API version changed from v0 to v0.1:

    // v0.3.0: defaulted to v0
    const client = new MCPRegistryClient();
    
    // v0.4.0: defaults to v0.1 (stable)
    const client = new MCPRegistryClient(); // now uses v0.1
    
    // Explicitly use v0 if needed
    const client = new MCPRegistryClient(undefined, "v0");
  2. getServerByName() removed — use getServerVersion():

    // Old
    const server = await client.server.getServerByName("org/server");
    
    // New
    const server = await client.server.getServerVersion("org/server", "latest");
  3. ArgumentSchema is now a discriminated union with type: "positional" or type: "named". If you were constructing Argument objects without a type field, add the appropriate type.

  4. KeyValueInputSchema now requires name. Previously it was an alias for ArgumentSchema.

  5. Package.identifier and Package.transport are now required (were optional).

  6. deleteServerVersion() now returns ServerResponse instead of void.

  7. ServerJSONSchema now enforces name pattern (org/name), description max 100 chars, version max 255 chars.

New Features

  • title field on servers (optional display name)
  • placeholder field on inputs
  • statusMessage and statusChangedAt on registry metadata
  • includeDeleted option on list/get endpoints
  • updateVersionStatus() and updateAllVersionsStatus() admin methods
  • StatusUpdateRequestSchema and AllVersionsStatusResponseSchema
  • Proper PositionalArgumentSchema and NamedArgumentSchema
  • Transport URL pattern validation
  • fileSha256 hex pattern validation

Bug Fixes

  • updatedSince query param now correctly sent as updated_since to the API

Additional Resources

License

MIT © Cameron Pak - [email protected]