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

@contextgraphprotocol/typescript-sdk

v0.1.0

Published

Zero-dependency TypeScript SDK for building conformant Context Graph Protocol providers.

Readme

@contextgraph/sdk — TypeScript

A zero-dependency TypeScript SDK for building conformant Context Graph Protocol providers. Implement one interface, hand it to the runtime, and you have a provider that speaks the line-oriented JSON wire over stdio and passes the same conformance suite that judges the Rust reference provider.

This is the second independent implementation (after the Rust reference), and it passes the full conformance suite — the concrete evidence behind the protocol's "enforced by contract, not convention" claim. See sdk/README.md for the multi-language picture.

Install

npm install @contextgraph/sdk

Write a provider

import { runStdioProvider, budgetTokens, type Provider } from "@contextgraph/sdk";

const provider: Provider = {
  info: () => ({
    name: "my-docs-provider",
    version: "0.1.0",
    // Nothing leaves the machine ⇒ declare the honest local-only egress scope.
    data_flow: { reads: true, writes: false, egress: false, egress_scopes: ["local-only"] },
  }),
  capabilities: () => ({ query: { kinds: ["doc"] }, correlation: true, verify: true }),
  query: () => ({
    frames: [
      {
        id: "doc:1",
        kind: "doc",
        title: "Getting started",
        content: "Install the binding, then implement the required methods.",
        content_digest: `sha256:${"11".repeat(32)}`,
        score: 0.9,
        // token_cost MUST equal ceil(utf8_len(content)/4) — the SDK computes it.
        token_cost: budgetTokens("Install the binding, then implement the required methods."),
        valid_from: "2026-01-01T00:00:00Z",
        provenance: [{ type: "file", uri: "file:///docs/start.md", range: "L1-10", digest: `sha256:${"11".repeat(32)}` }],
        citation_label: "start.md L1-10",
        relations: [],
      },
    ],
    truncated: false,
  }),
};

runStdioProvider(provider);

The runtime handles the whole lifecycle a host drives — handshake, query (echoing the correlation id), verify, shutdown — and stays alive with a typed error on a malformed line rather than crashing.

What it gives you

  • Wire types (ContextFrame, ContextQuery, Capabilities, Envelope, …) mirrored from the JSON Schema — the language-neutral source of truth.
  • runStdioProvider(provider) — the stdio lifecycle loop.
  • budgetTokens(content) — the canonical B3 cost, ceil(utf8_len/4).
  • A runnable example provider (examples/example-docs.ts) that passes all seven conformance checks.

Prove it conformant

Build, then run the reference suite against your provider:

npm run build
# from the repository root, with the Rust bins built (cargo build --workspace --bins):
./.github/scripts/conformance-external.sh -- node sdk/typescript/dist/examples/example-docs.js

A green run is the machine-checkable claim that your provider honors the protocol — the same bar every implementation is held to.

License

MIT OR Apache-2.0, matching the Context Graph Protocol crates.