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

cxp-protocol

v1.0.0

Published

CXP: Context Exchange Protocol - Context lifecycle, provenance, and governance for AI agent ecosystems

Readme

CXP Protocol - TypeScript SDK

Context lifecycle, provenance, and governance for AI agent ecosystems.

Install

npm install cxp-protocol

Quick Start

import { CXPStore, Sensitivity, Fidelity } from 'cxp-protocol';

const store = new CXPStore();

// Register a governed document
const { co } = store.register({
  content: 'Patient: Maria Santos. Dx: NSTEMI.',
  type: 'document',
  sensitivity: Sensitivity.REGULATED,
  aclRead: ['clinician'],
  aclDerive: ['clinician'],
  regulatory: ['hipaa'],
  producer: 'ehr',
});

// Access control
store.fetch(co.uri, 'clinician');  // { granted: true, content: '...' }
store.fetch(co.uri, 'billing');    // { granted: false, error: 'GOV_DENIED' }

// Derive with governance composition
const { co: summary } = store.derive({
  sources: [co.uri],
  content: 'Summary: NSTEMI diagnosis, troponin elevated.',
  type: 'summary',
  producer: 'summarizer',
  method: 'llm',
  actorRole: 'clinician',
});
// summary inherits: REGULATED sensitivity, clinician ACL, HIPAA tag

// Verify provenance
const attest = store.attest(summary.uri);
// { valid: true, chainLength: 2, chain: [...] }

// Privacy scoping
store.scope(co.uri, Fidelity.REDACTED, 'clinician');
// Returns content with SSN/names redacted

With OAuth / JWT Authentication

import { CXPStore, CXPAuthStore } from 'cxp-protocol';

const store = new CXPStore();
const auth = new CXPAuthStore(store, {
  jwtSecret: process.env.JWT_SECRET!,
  issuer: 'cxp-server',
  audience: 'cxp-agents',
});

// Issue tokens for agents
const clinicianToken = auth.issueToken('agent-1', ['clinician'], 'hospital-a');
const billingToken = auth.issueToken('agent-2', ['billing'], 'hospital-a');

// Authenticated operations
const { co } = auth.register(clinicianToken, {
  content: 'Patient note with PHI',
  type: 'document',
  sensitivity: Sensitivity.REGULATED,
  aclRead: ['clinician'],
  regulatory: ['hipaa'],
  producer: 'ehr',
});

auth.fetch(clinicianToken, co.uri);  // granted
auth.fetch(billingToken, co.uri);    // GOV_DENIED

MCP Proxy (zero code changes)

import { CXPStore, CXPMCPProxy, Sensitivity } from 'cxp-protocol';

const store = new CXPStore();
const proxy = new CXPMCPProxy(store, {
  sensitivity: Sensitivity.REGULATED,
  regulatory: ['hipaa'],
  aclRead: ['clinician'],
  aclDerive: ['clinician'],
  actorRole: 'clinician',
});

// Intercept MCP traffic
const { registered } = proxy.interceptRequest(mcpRequest);
const { registered: response } = proxy.interceptResponse(mcpResponse, registered);
// Governance added transparently

OpenTelemetry Export

import { CXPStore, auditToSpans, OTLPHttpExporter } from 'cxp-protocol';

const store = new CXPStore();
// ... operations ...

const spans = auditToSpans(store.getAuditLog());
const exporter = new OTLPHttpExporter('http://localhost:4318/v1/traces');
await exporter.export(spans);

API Reference

CXPStore

| Method | Description | |--------|-------------| | register(opts) | Create governed context object | | fetch(uri, role) | Retrieve with access control | | derive(opts) | Create from sources with governance composition | | scope(uri, fidelity, role) | Privacy-scoped view (full/summary/redacted/aggregated/opaque) | | govern(uri, updates, actor) | Update governance policies | | attest(uri) | Verify provenance chain integrity | | discover(filters) | Find context objects | | invoke(target, handler, uri, role) | Execute tool/agent with governance | | revoke(uri, actor) | Revoke a context object |

Governance Composition (Theorem 1)

For DERIVE from sources {s1, ..., sn}:

  • Sensitivity: max (never decreases)
  • ACL: intersection (never widens)
  • Regulatory: union (never drops obligations)

License

Apache 2.0