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

@ucptools/validator

v1.0.1

Published

Validate and generate UCP (Universal Commerce Protocol) Business Profiles

Readme

@ucptools/validator

npm version License: MIT

Validate and generate UCP (Universal Commerce Protocol) Business Profiles for AI-powered shopping agents like ChatGPT, Google AI Mode, and Copilot checkout.

Try it online: ucptools.dev - Free AI Commerce Readiness Checker


What is UCP?

The Universal Commerce Protocol is an open standard enabling AI agents to discover, browse, and complete purchases on any UCP-enabled merchant. Google announced UCP on January 11, 2026, with support from Shopify, Target, Walmart, and 20+ ecosystem partners.

This library helps you:

  • Validate your UCP profile for compliance
  • Generate properly formatted UCP profiles
  • Verify schemas and capability declarations

Installation

npm install @ucptools/validator

Quick Start

Validate a Profile

import { validateProfile, validateQuick, validateRemote } from '@ucptools/validator';

// Validate a local profile object
const report = await validateProfile(myProfile);
console.log(report.ok ? 'Valid!' : 'Issues found:', report.issues);

// Quick validation (no network calls)
const quickReport = validateQuick(myProfile);

// Validate a remote profile by domain
const remoteReport = await validateRemote('example.com');

Generate a Profile

import { buildProfile, generateMinimalProfile } from '@ucptools/validator';

// Generate a minimal profile (checkout only)
const minimal = generateMinimalProfile({
  endpoint: 'https://api.yourstore.com/ucp/v1',
});

// Generate a full profile
const result = await buildProfile({
  merchant: {
    merchantId: 'store-123',
    primaryDomain: 'yourstore.com',
  },
  transport: {
    rest: { endpoint: 'https://api.yourstore.com/ucp/v1' },
  },
  capabilities: {
    checkout: true,
    order: true,
    fulfillment: false,
    discount: false,
    product: false,
    inventory: false,
  },
});

console.log(result.profileJson);

Generate Signing Keys

import { generateSigningKeyPair } from '@ucptools/validator';

// Generate Ed25519 key pair for Order capability
const { publicKey, privateKey, kid } = await generateSigningKeyPair('Ed25519');

Validation Levels

1. Structural Validation (Fast, Offline)

  • JSON structure verification
  • Required fields check
  • Version format validation (YYYY-MM-DD)

2. UCP Rules Validation (Offline)

  • Namespace/origin binding (dev.ucp.* must use ucp.dev URLs)
  • Extension chain validation (no orphaned extends)
  • Endpoint rules (HTTPS, no trailing slash)
  • Signing keys requirement for Order capability

3. Network Validation (Online)

  • Fetch and verify remote schemas
  • Self-describing schema validation
  • Schema/capability version matching

Validation Report

interface ValidationReport {
  ok: boolean;                    // true if no errors
  profile_url?: string;           // URL of validated profile
  ucp_version?: string;           // UCP version from profile
  issues: ValidationIssue[];      // Array of issues found
  validated_at: string;           // ISO timestamp
  validation_mode: ValidationMode;
}

interface ValidationIssue {
  severity: 'error' | 'warn' | 'info';
  code: string;                   // e.g., 'UCP_NS_ORIGIN_MISMATCH'
  path: string;                   // JSON path, e.g., '$.ucp.capabilities[0]'
  message: string;
  hint?: string;                  // Suggestion to fix
}

Error Codes

| Code | Severity | Description | |------|----------|-------------| | UCP_MISSING_ROOT | error | Missing ucp object at root | | UCP_MISSING_VERSION | error | Missing version field | | UCP_INVALID_VERSION_FORMAT | error | Version not in YYYY-MM-DD format | | UCP_NS_ORIGIN_MISMATCH | error | Schema URL doesn't match namespace origin | | UCP_ORPHANED_EXTENSION | error | Extends references non-existent capability | | UCP_ENDPOINT_NOT_HTTPS | error | Endpoint must use HTTPS | | UCP_ENDPOINT_TRAILING_SLASH | warn | Remove trailing slash from endpoint | | UCP_MISSING_SIGNING_KEYS | error | Order capability requires signing_keys | | UCP_SCHEMA_FETCH_FAILED | warn | Could not fetch remote schema |


CLI Usage

# Validate a local file
npx @ucptools/validator validate -f ucp.json

# Validate a remote profile
npx @ucptools/validator validate -r yourstore.com

# Generate a minimal profile
npx @ucptools/validator generate-minimal -e https://api.example.com/ucp/v1 -o ucp.json

Online Tool

Don't want to install anything? Use our free online tool:

ucptools.dev - AI Commerce Readiness Checker

  • Validates UCP profiles + Schema.org requirements
  • Generates UCP profiles with a simple form
  • Creates Schema.org snippets (MerchantReturnPolicy, shippingDetails)
  • Provides A-F grading and actionable recommendations

Resources


Contributing

Contributions are welcome! Please read our Contributing Guide for details.


License

MIT - See LICENSE for details.