# Endpoint Context Protocol

> A lightweight HTTP content negotiation method that makes any existing website agent-friendly by serving semantic content to AI agents and HTML to browsers from the same URL.

Endpoint Context Protocol (ECP) is an open-source method for making any existing website readable by AI agents without changing URLs, adding infrastructure, or breaking the human-facing experience. It leverages HTTP content negotiation headers — specifically `Accept` and `Sec-Fetch-Dest` — that have been part of the web standard since RFC 2616 in 1999. The project is MIT-licensed and available on GitHub under the `endpointcontextprotocol` organization.

## What It Is

ECP is not a new protocol layered on top of the web — it is a method for acting on HTTP content negotiation that browsers and HTTP clients have always supported. When a browser navigates to a URL, it sends `Sec-Fetch-Dest: document` and `Accept: text/html`. AI agents, LLMs, curl, and automated scripts do not. ECP instructs your server to inspect those two headers and return clean semantic content (typically Markdown) to agentic callers while returning the existing HTML to everyone else. The canonical URL never changes, no new routing is required, and no subdomains are needed.

## How It Works

Implementation requires two steps:

- **Create `ecp.json`** in your site root. This JSON file (validated against a published schema) maps URL paths to Markdown files or external URLs that agents should receive.
- **Wire agent/human request handling** in your edge or server middleware. The handler checks the incoming headers and either serves the mapped Markdown content or falls through to the normal HTML response.

The project ships stack-specific instructions for Cloudflare Workers, Vercel, Netlify, Firebase, Express/Node, Next.js, WordPress/PHP, and Deno. Running `npx endpointcontext` generates LLM-ready, stack-specific instructions from the actual codebase. An optional `<link rel="alternate" type="text/markdown">` tag in the HTML `<head>` provides a fallback breadcrumb for agents that scrape full HTML instead of negotiating headers directly.

## What It Unlocks

The site describes four capabilities that ECP enables for a canonical domain:

- **URL-first discovery** — no prior relationship required for an agent to discover capabilities.
- **Live operational context** — inventory, specials, availability, and status can be updated in real time.
- **Actionable API & MCP discovery** — agents can find endpoints plus auth and token instructions at request time.
- **One trusted authority** — humans and agents both resolve to the same canonical domain.

## Hosted ECP Context Servers and the ECP Ecosystem

Beyond the self-hosted path, the project references a companion service at ecpservers.com that provides hosted ECP Context Servers. These deliver a dynamically maintained knowledge cache without requiring ongoing site changes, and they unlock an `agents.*` subdomain for advanced context delivery, API token generation, and agent-specific capabilities. The project also maintains ecp.directory, a free opt-in index where sites can register a verified presence for agent discovery, and ecptest.com, a tool for verifying that a site correctly serves HTML to browsers and semantic content to agents with the right `Vary` headers.

## Open-Source Deployment Model

ECP is released under the MIT license. The core implementation requires no external packages — only a JSON config file and a few lines of middleware logic. The GitHub organization (`endpointcontextprotocol`) hosts the specification and tooling. The `npx endpointcontext` CLI generates platform-specific integration code on demand. Badge assets (ECP Enabled, Agent Access, Agent Friendly) are provided for sites to signal ECP support to human visitors and crawlers alike.

## Features
- HTTP content negotiation for agent vs. browser detection
- Same-URL serving for humans and AI agents
- ecp.json config file for route-to-Markdown mapping
- Stack-specific middleware for Cloudflare, Vercel, Netlify, Firebase, Express, Next.js, WordPress, Deno
- npx endpointcontext CLI for code generation
- Optional HTML <link> fallback for scraping agents
- Hosted ECP Context Servers via ecpservers.com
- agents.* subdomain support for advanced context delivery
- ECP.Directory opt-in agent discovery index
- ecptest.com verification tool
- Vary header support for correct caching
- MIT open-source license
- No external packages required
- Badge assets for ECP-enabled sites

## Integrations
Cloudflare Workers, Vercel, Netlify, Firebase, Express / Node.js, Next.js, WordPress / PHP, Deno, npm, MCP (Model Context Protocol)

## Platforms
WEB, API, CLI, DEVELOPER_SDK

## Pricing
Open Source

## Version
1.0

## Links
- Website: https://endpointcontextprotocol.io
- Documentation: https://endpointcontextprotocol.io/#the-code
- Repository: https://github.com/endpointcontextprotocol/endpointcontextprotocol
- EveryDev.ai: https://www.everydev.ai/tools/endpoint-context-protocol
