WCP β Because the web should talk to AI, not be scraped by it.
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.
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.
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
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 |
| Package | Version | Description |
|---|---|---|
@anthropic/wcp-express |
0.2.0 |
WCP SDK for Express.js β Make your website AI-ready |
npm install @anthropic/wcp-express
# or
yarn add @anthropic/wcp-express
# or
pnpm add @anthropic/wcp-expressimport 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');
});After mounting the router, your site automatically exposes:
GET /.well-known/wcp.jsonβ Discovery manifestGET /wcp/contextβ AI-ready site summaryGET /wcp/resourcesβ Resource catalogGET /wcp/resources/:nameβ Resource data with filtering, sorting, paginationGET /wcp/actionsβ Action catalogPOST /wcp/actions/:nameβ Action execution
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 devThe 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
βββββββββββββββββββββββββββββββββββββββββββββββ
β 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 β
βββββββββββββββββββββββββββββββββββββββββββββββ
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)
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. |
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 |
We welcome contributions! Please see our Contributing Guide for details.
# 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 lintThis project is licensed under the MIT License β see the LICENSE file for details.
- π Full Specification
- π¦ npm Package
- π Issue Tracker
- π¬ Discussions
WCP is inspired by and designed to work alongside:
- MCP (Model Context Protocol) β For local tool integration
- Schema.org β For data vocabulary
- OAuth 2.1 β For authentication
- RFC 9457 β For error handling
Make your website AI-ready with WCP
Read the spec Β·
Try the SDK Β·
See examples