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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@xyd-js/mcp

v0.0.0-build-c9af03a-20251224161251

Published

Model Context Protocol (MCP) utilities for xyd (library mode)

Readme

@xyd-js/mcp

Utilities for building Model Context Protocol (MCP) servers in the xyd ecosystem.

This package exposes helpers to:

  • Register API Reference resources (as Markdown) derived from a Uniform source
  • Register callable MCP tools from OpenAPI or GraphQL specs with structured input schemas

Currently supported Uniform sources:

  • OpenAPI: .json, .yaml, .yml
  • GraphQL schema files: .graphql, .graphqls

Typescript/React sources are not supported yet.

Installation

bun add @xyd-js/mcp

Peer/runtime requirements: Bun or Node.js compatible ESM environment.

API

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { mcpUniformResources, mcpUniformTools } from "@xyd-js/mcp";

const server = new McpServer({ name: "xyd-mcp", version: "0.1.0" });

// Path to a Uniform source (OpenAPI JSON/YAML or GraphQL schema)
const uniformSource = "./openapi.json";

// Register API reference resources (text/markdown) under uri: api-reference://<canonical>
await mcpUniformResources(server, uniformSource);

// Register tools; if your API needs auth, pass a token which will be sent
// as Authorization: Bearer <token> for outgoing requests
await mcpUniformTools(server, uniformSource, process.env.API_TOKEN || "");

mcpUniformResources(server, uniformSource)

Generates Markdown API reference pages from the provided Uniform source and registers them as MCP resources using api-reference://<canonical> URIs with mimeType: text/markdown.

mcpUniformTools(server, uniformSource, token)

Creates MCP tools for each operation discovered in the Uniform source. Tool input schemas are derived from the API definition and grouped by:

  • pathParams
  • queryParams
  • headers
  • requestBody

When a tool is invoked it will:

  • Perform a fetch using the operation method and URL
  • Include Authorization: Bearer <token> if a token was provided
  • Return both a resource_link to the associated API reference and the JSON response (as text)

Uniform Source Detection

uniformSource can be any of:

  • OpenAPI spec: .json, .yaml, .yml
  • GraphQL schema: .graphql, .graphqls

If the extension cannot be detected or the source cannot be loaded, no tools/resources will be registered.

Example

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { mcpUniformResources, mcpUniformTools } from "@xyd-js/mcp";

const server = new McpServer({ name: "example", version: "0.0.0" });
await mcpUniformResources(server, "./demo/simple/openapi.json");
await mcpUniformTools(server, "./demo/simple/openapi.json", "my-access-token");

Notes

  • Responses are currently assumed to be JSON when returning tool results.
  • Markdown rendering uses xyd components highlighting where possible.
  • This library is ESM-only.