Skip to content
ta1kunPublic

About

WCP is to the web what [MCP](https://modelcontextprotocol.io) is to tools. While MCP connects AI models to local tools and services, **WCP connects AI agents to websites** via standard HTTP.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WCP β€” Web Context Protocol

WCP β€” Because the web should talk to AI, not be scraped by it.

npm version License: MIT TypeScript Express

WCP (Web Context Protocol) is an open standard that defines how websites expose structured information and capabilities to AI agents. This repository contains the official specification and the Express.js SDK implementation.


🎯 What is WCP?

WCP is to the web what MCP is to tools. While MCP connects AI models to local tools and services, WCP connects AI agents to websites via standard HTTP.

The Problem

Today, AI agents interact with the web through fragile, inefficient hacks:

  • Scraping β€” Parsing HTML meant for humans, breaking constantly
  • Proprietary APIs β€” Every site has its own API requiring custom integration
  • No discovery β€” No standard way to ask "What can I do here?"
  • No token awareness β€” APIs return kilobytes when agents need 200 tokens
  • No consent model β€” Sites can't declare what AI agents can access

The Solution

WCP provides six capabilities no existing standard offers:

Capability Description
πŸ” Discovery A single /.well-known/wcp.json file tells agents what a site offers
πŸ“ Context Compression AI-ready summaries optimized for LLM context windows
🎫 Token Awareness Responses sized and shaped for LLM consumption
πŸ“š Dynamic Catalogs Machine-readable lists of available data and operations
βœ… Confirmation Flow Safe execution of irreversible or sensitive actions
πŸ“ˆ Progressive Disclosure From static file β†’ dynamic endpoints β†’ full SDK

πŸ“¦ Packages

Package Version Description
@anthropic/wcp-express 0.2.0 WCP SDK for Express.js β€” Make your website AI-ready

πŸš€ Quick Start

Installation

npm install @anthropic/wcp-express
# or
yarn add @anthropic/wcp-express
# or
pnpm add @anthropic/wcp-express

Basic Usage

import express from 'express';
import { WCP } from '@anthropic/wcp-express';

const app = express();

// Create a WCP instance
const wcp = new WCP({
  site: {
    name: 'TechStore',
    url: 'https://www.techstore.com',
    type: 'ecommerce',
    description: 'Consumer electronics and accessories',
  },
  context: 'TechStore is an online electronics retailer with 15,000+ products across 5 categories.',
});

// Define a resource
wcp.resource('products', {
  type: 'product',
  fields: {
    id: 'string',
    name: 'string',
    price: 'number',
    category: 'string',
    in_stock: 'boolean',
  },
  handler: async (params) => {
    // Your data fetching logic here
    return {
      data: products,
      total: products.length,
    };
  },
});

// Define an action
wcp.action('add_to_cart', {
  level: 1,
  auth: 'agent',
  params: {
    product_id: { type: 'string', required: true },
    quantity: { type: 'integer', required: false, default: 1 },
  },
  handler: async (params, context) => {
    // Your action logic here
    return { success: true };
  },
});

// Mount WCP router
app.use(wcp.router());

app.listen(3000, () => {
  console.log('WCP-enabled server running on port 3000');
});

What You Get

After mounting the router, your site automatically exposes:

  • GET /.well-known/wcp.json β€” Discovery manifest
  • GET /wcp/context β€” AI-ready site summary
  • GET /wcp/resources β€” Resource catalog
  • GET /wcp/resources/:name β€” Resource data with filtering, sorting, pagination
  • GET /wcp/actions β€” Action catalog
  • POST /wcp/actions/:name β€” Action execution

πŸ“š Examples

This repository includes working examples:

Example Description Complexity
examples/pizzeria Static restaurant site with inline data ⭐ Level 1
examples/techstore Dynamic e-commerce with full WCP features ⭐⭐⭐ Level 3

Run an example:

cd examples/pizzeria
npm install
npm run dev

πŸ“– Documentation

Specification

The complete WCP specification is available in docs/wcp/WCP-SPEC-v0.2.md:

  • Discovery Layer β€” Manifest format and discovery endpoints
  • Context Layer β€” AI-optimized summaries and hierarchical context
  • Resource Layer β€” Data catalogs, field selection, pagination
  • Action Layer β€” Operations, confirmation flows, idempotency
  • Authentication β€” Multi-level auth from open to OAuth 2.1
  • Security β€” Best practices and security considerations

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   LAYER 4 β€” AI AGENT LAYER                 β”‚
β”‚   Claude Β· GPT Β· Gemini Β· Custom Agents    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   LAYER 3 β€” WCP PROTOCOL LAYER             β”‚
β”‚   Discovery Β· Context Β· Resources Β· Actionsβ”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   LAYER 2 β€” REUSED STANDARDS               β”‚
β”‚   Schema.org Β· OAuth 2.1 Β· RFC 9457        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   LAYER 1 β€” YOUR WEBSITE                   β”‚
β”‚   Database Β· REST API Β· CMS Β· HTML         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Relationship with MCP

WCP and MCP are complementary, not competing:

  • MCP = agent ↔ local tools (stdio/SSE, host-mediated)
  • WCP = agent ↔ remote websites (HTTP, direct)
AI Agent
   β”œβ”€β”€ MCP Client β†’ Local Tools (files, DBs, CLIs)
   └── WCP Client β†’ Remote Websites (shops, APIs, blogs)

πŸ› οΈ Implementation Levels

WCP supports progressive complexity:

Level Effort What You Get
Level 1 5 minutes Static wcp.json file β€” identity, context, inline data
Level 2 30 minutes Simple endpoints β€” dynamic context and catalogs
Level 3 5 minutes (with SDK) Full implementation β€” resources, actions, auth
Level 4 1 click CMS plugins β€” WCP for WordPress, Shopify, etc.

πŸ” Authentication Levels

WCP defines four authentication tiers:

Level Method Use Case
Level 0 Open Access Public data, no auth required
Level 1 WCP-Key Agent identity verification
Level 2 JWT/JWKS Decentralized agent identity
Level 3 OAuth 2.1 User-level authorization for sensitive actions

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development

# Clone the repository
git clone https://github.com/anthropics/wcp.git
cd wcp

# Install dependencies
npm install

# Build packages
npm run build

# Run tests
npm test

# Run linting
npm run lint

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


🌐 Links


πŸ™ Acknowledgments

WCP is inspired by and designed to work alongside:


Make your website AI-ready with WCP
Read the spec Β· Try the SDK Β· See examples

About

WCP is to the web what [MCP](https://modelcontextprotocol.io) is to tools. While MCP connects AI models to local tools and services, **WCP connects AI agents to websites** via standard HTTP.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages