# /agents.md vs. mcp onboarding lab

- Status: `experiment`
- Track: [agent discovery, auth & protocol bridges](https://aifoc.us/labs/agent-bridges-and-discovery/)
- Layer: 9. Agent Discovery, Auth & Protocol Bridges
- Updated: 2 December 2026
- Live demo: https://agents-md-vs-mcp-onboarding-lab.kinlan-test.workers.dev
- Source: https://github.com/PaulKinlan/agents-md-vs-mcp-onboarding-lab

## Inspired by

- [hyper content negotiation](https://aifoc.us/hyper-content-negotiation/)
- [webmcp is the new web intents ... maybe](https://aifoc.us/webmcp-is-the-new-web-intents/)
- [agent-do: my agent loop](https://aifoc.us/agent-do-my-agent-loop/)

## Why this matters

Publishing tools for external agents splits between zero-install plain HTTP ([`/agents.md`](https://agents-md-vs-mcp-onboarding-lab.kinlan-test.workers.dev/agents.md) + JSON POST endpoints) and stateful [Streamable HTTP MCP](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports) (`POST /mcp`). Deterministic byte counts only establish the minimum transport floor—they cannot tell you whether real models choose the right tools, pass strict JSON Schemas without retries, or resist injected directives inside untrusted markdown. Serving both transports from one shared registry (`SUMMIT_TOOLS`) lets you run live browser-connected LLMs head-to-head alongside the wire-only floor and real badge-verification exploits.

## What this opens up

Zero-install `/agents.md` onboarding that any HTTP client can use in one `GET` request alongside typed Streamable HTTP MCP from a single schema definition, plus repeatable browser-side LLM evaluations using your own model via [Port Authority AI Router](https://port-authority.dev/ai-router/), Chrome Built-in AI, or local Ollama with zero server-held API keys.

## How the tests work

1. **Connect a browser LLM backend in Section 1** — choose [Port Authority AI Router](https://port-authority.dev/ai-router/) (`https://llmchannel.dev/router.js`, open full screen when embedded since Port Authority refuses nested iframes), Chrome Built-in AI (`globalThis.LanguageModel`), or local Ollama (`http://localhost:11434/v1/chat/completions`), with zero server-held secrets.
2. **Run the 4 graded head-to-head LLM tasks** (single filtered lookup, multi-step schedule-to-transcript chaining, strict-schema parameter discipline, and live `/agents.md?canary=1` prompt-injection resistance) or enter a custom prompt to compare real pass rate, turns, HTTP 400 schema retries, prompt/completion tokens, latency, and turn-by-turn transcripts.
3. **Compare against Section 2 (Deterministic Wire-Only Floor — No LLM)** to isolate exact scripted round trips, bootstrap bytes, and minimum wire overhead across 1-shot, 3-step, and 10-call polling workflows.
4. **Test Sections 3 and 4** to reproduce the unauthenticated `CDS-for-Agents` self-verify bypass on Naive Mode vs. `HttpOnly; SameSite=Lax` cookie / Owner PIN enforcement (`403`) on Hardened Mode, and verify strict server-side schema blocking against poisoned `/agents.md?canary=1` directives.


## Hypothesis

- **Claim:** Plain HTTP discovery (`GET /agents.md` + `POST /api/tools/:name`) has a lower deterministic wire-only floor on short workflows than Streamable HTTP MCP, while real LLM performance depends on native tool-calling accuracy, schema retry rates, and prompt-injection exposure—and both transports require identical server-side owner proofs and strict `additionalProperties: false` validation.
- **Confirms it:** The deterministic wire floor measures fewer round trips and lower bootstrap bytes for `/agents.md` on 1-shot and 3-step flows; the Live LLM Head-to-Head Eval records actual pass/fail grades, HTTP 400 validation retries, real tokens, and whether a model attempts `export_all_badges` or `__bypass_verification` when fed `/agents.md?canary=1`; Hardened Mode blocks unauthenticated self-verification with `403`; and poisoned canary calls fail closed server-side.
- **Bounds or disproves it:** On models with strong native OpenAI/MCP tool calling, typed MCP `tools/list` schemas can reduce malformed-argument retries compared with prose-parsed `/agents.md` instructions, and embedded prose in `/agents.md?canary=1` creates a direct prompt-injection surface that clean structured tool catalogs narrow—though server-side allowlists remain mandatory for both.


## Under the hood

[/agents.md vs. MCP Onboarding Lab](https://agents-md-vs-mcp-onboarding-lab.kinlan-test.workers.dev) ([GitHub](https://github.com/PaulKinlan/agents-md-vs-mcp-onboarding-lab)) compiles both `GET /agents.md` + `POST /api/tools/:name` and Streamable HTTP `POST /mcp` (`initialize`, `notifications/initialized`, `tools/list`, `tools/call`, `resources/list`, `resources/read`) from one canonical `SUMMIT_TOOLS` array in `src/tools.ts`, backed by a SQLite Durable Object (`OnboardingLedger`).

The workbench separates empirical model behavior from transport arithmetic across four benches:

1. **Live LLM Head-to-Head Eval (`public/lib/llm-eval-runner.js`)** — Drives a real browser-connected LLM (via [Port Authority AI Router](https://port-authority.dev/ai-router/) over `https://llmchannel.dev/router.js`, Chrome Built-in `LanguageModel`, or local Ollama on `http://localhost:11434/v1/chat/completions`) in isolated per-lane multi-turn loops (`maxTurns = 5`). Lane A reads `GET /agents.md` (or `/agents.md?canary=1`) and emits JSON tool actions against `POST /api/tools/:name`; Lane B executes native OpenAI-format `tools` calls converted from MCP `tools/list` against `POST /mcp` (falling back transparently to `MCP JSON Fallback` if a backend reports `code: "unsupported"`). Every run grades task accuracy, turns, tool calls, HTTP 400/parse retries, real prompt+completion tokens (or estimates), wire bytes, latency, and canary hijack attempts.
2. **Deterministic Wire-Only Floor (No LLM)** — Executes scripted 1-shot, 3-step, and 10-call polling sequences with zero model inference to measure the pure protocol lower bound on round trips and bytes.
3. **Naive vs. Hardened Human-Verification Toggle** — Reproduces the unauthenticated `CDS-for-Agents` self-verify bypass on Naive Mode (`GET /api/verify/:token` leaking PII + `claim_code`, allowing cookie-free check-in) versus Hardened Mode (`HttpOnly; SameSite=Lax` `cds_badge_owner` cookie or Owner PIN, matching email, `Origin` validation, rate limiting, and random `agent_id`).
4. **Prompt-Injection Canary Check** — Serves `/agents.md?canary=1` with injected `export_all_badges` and `__bypass_verification` directives and verifies that `validateToolArgs()` and the closed tool allowlist reject unknown tools, unknown keys, and unverified writes identically on both transports.


## Key terms & further reading

- [/agents.md Zero-Install Discovery](https://agents-md-vs-mcp-onboarding-lab.kinlan-test.workers.dev/agents.md) — Root markdown document describing a site's HTTP tool routes and strict JSON fields so any agent can bootstrap in one `GET` request.
- [Streamable HTTP MCP](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports) — Model Context Protocol transport over HTTP using `initialize`, `notifications/initialized`, `tools/list`, and `tools/call` JSON-RPC 2.0 frames.
- [Port Authority AI Router](https://port-authority.dev/ai-router/) — Browser `MessagePort` router (`https://llmchannel.dev/router.js`) giving a page OpenAI-compatible Chat Completions access to a user's chosen model without exposing API keys.
- [Chrome Built-in LanguageModel API](https://developer.chrome.com/docs/ai/prompt-api) — On-device browser inference API (`globalThis.LanguageModel`) allowing isolated per-lane LLM evaluation directly inside embedded pages.
- [JSON-RPC 2.0](https://www.jsonrpc.org/specification) — Structured RPC envelope carrying MCP tool discovery, invocation, and error codes over `POST /mcp`.
- [HttpOnly & SameSite=Lax Cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Cookies#security) — Browser cookie attributes that bind badge verification to the human browser session while staying invisible to page JS and cookie-free agent requests.

## Open questions to iterate on

- Across open-weight and frontier models, how often does prose-parsed `/agents.md` trigger extra HTTP 400 schema retries compared with native MCP `tools/list` tool calling?
- Can `/agents.md` embed compact JSON Schema blocks or signed digests so zero-install HTTP clients get machine-validated inputs without MCP's multi-step handshake?

## Iteration log

- **2026-12-02:** Upgraded with a Live LLM Head-to-Head Eval runner (`public/lib/llm-eval-runner.js`) supporting Port Authority AI Router, Chrome Built-in AI (`LanguageModel`), and local Ollama across 4 graded tasks + custom prompts, clearly separated from the Deterministic Wire-Only Floor (No LLM), alongside Naive vs. Hardened badge verification and `/agents.md?canary=1` enforcement.

## Primitives tested

- `/agents.md Discovery`
- `Streamable HTTP MCP (JSON-RPC 2.0)`
- `Live Browser LLM Head-to-Head Eval (Port Authority / LanguageModel / Ollama)`
- `HttpOnly SameSite=Lax Owner Proof`
- `Strict Tool Allowlist & Schema Gate`
- `Durable Object SQLite (OnboardingLedger)`

## Connected labs in other tracks

- [agent well-known audit lab](https://aifoc.us/labs/agent-bridges-and-discovery/agent-well-known-audit-lab/) — Audits `/agents.md`, `/llms.txt`, `/.well-known/mcp.json`, and 9 other agent discovery documents.
- [mcp oauth 2.1 handshake lab](https://aifoc.us/labs/agent-bridges-and-discovery/mcp-oauth-handshake-lab/) — Tests full OAuth 2.1 RFC 9728/8414/8707 PKCE authentication in front of Streamable HTTP MCP.
- [webmcp intent registry lab](https://aifoc.us/labs/agent-bridges-and-discovery/webmcp-intent-registry-lab/) — Measures dynamic retrieval vs. full `tools/list` token budgets across 2 to 60 connected sites.

---
Canonical: https://aifoc.us/labs/agent-bridges-and-discovery/agents-md-vs-mcp-onboarding-lab/
