Implementation

WebMCP: Making Your Website Agent-Native

B

Benjamin Hopwood

Operations Scaling | Agentic AI Orchestration

March 28, 2026|12 min read

What Is WebMCP and Why Does It Matter

The Model Context Protocol is an open standard that defines how AI agents interact with external tools and data sources. Originally designed for local tool connections, MCP has evolved into a web-native protocol with the Streamable HTTP transport specification. WebMCP is the practice of running an MCP server on your website, making your services, content, and capabilities directly accessible to any AI agent that speaks the protocol.

Think of it this way: your website currently serves HTML pages to human browsers. WebMCP adds a parallel interface that serves structured tool definitions to AI agents. A human visitor reads your services page and fills out a contact form. An AI agent calls your MCP tools to assess service fit, request proposals, and initiate engagement, all programmatically.

This is not theoretical. The MCP specification, published by Anthropic, is already supported by Claude, and implementations are emerging across the AI ecosystem. Making your website agent-native through WebMCP is one of the highest-leverage technical investments an organization can make today.

The Architecture of a WebMCP Server

A WebMCP server sits alongside your existing web application and exposes a set of tools that agents can discover and invoke. The architecture has four key layers.

The discovery layer tells agents that your MCP server exists and what it offers. This is handled by a server card, a JSON document at a well-known URL that describes your server's capabilities, authentication requirements, and endpoint URLs. Agents that encounter your domain can check for this card to determine whether MCP interaction is available.

The authentication layer controls which agents can access your tools. MCP supports OAuth 2.1 with both Authorization Code plus PKCE for interactive flows and Client Credentials for server-to-server communication. You can also support API key authentication for simpler use cases. The authentication layer ensures that only authorized agents can access sensitive tools while keeping public tools openly available.

The tool layer defines the actual capabilities you expose. Each tool has a name, a description that helps agents understand when to use it, an input schema that defines what parameters the tool accepts, and a handler that executes the tool logic and returns results. Tools can range from simple queries to complex multi-step operations.

The transport layer handles the HTTP communication between the agent and your server. The Streamable HTTP transport defined in the MCP specification uses standard HTTP requests and server-sent events for streaming responses. This means your MCP server works through standard web infrastructure, including CDNs, load balancers, and API gateways, without any special network configuration.

Implementing Your First MCP Server

The implementation starts with the mcp-handler npm package, which provides the server framework for Next.js applications. You define your tools as functions with typed input schemas, register them with the server, and mount the server on an API route.

Here is the conceptual flow for a service-oriented website. You would define a service catalog tool that returns your available services with descriptions and pricing tiers. You would define a fit assessment tool that takes a prospect's requirements and returns an analysis of which services match their needs. You would define a content tool that returns relevant articles, case studies, or documentation based on a topic query.

Each tool follows the same pattern: a clear name, a description that tells the agent what the tool does and when to use it, a Zod schema that validates the input, and a handler function that executes the logic and returns structured results.

The tool descriptions are critically important. They are the primary mechanism by which agents decide which tools to use. A vague description like "gets information" will be ignored. A precise description like "returns a scored assessment of whether Agentic Solutions' consulting services match the prospect's technical requirements, team size, and timeline" gives the agent everything it needs to decide when this tool is relevant.

Authentication Patterns for WebMCP

Authentication for WebMCP follows OAuth 2.1, which is a significant upgrade from the looser OAuth 2.0 patterns many developers are familiar with. OAuth 2.1 mandates PKCE for all authorization code flows, eliminates the implicit grant entirely, and requires exact redirect URI matching.

For a website MCP server, you typically implement two grant types. The Authorization Code plus PKCE flow handles cases where a human user is directing an agent to interact with your site. The agent redirects to your authorization endpoint, the user authenticates and consents, and the agent receives a token. The Client Credentials flow handles server-to-server cases where an agent platform has pre-registered credentials with your system.

You also support Dynamic Client Registration as defined in RFC 7591. This allows agents that have never interacted with your server to register themselves, receive client credentials, and begin the OAuth flow, all without manual intervention. This is essential for the open web: you cannot manually onboard every agent that might want to interact with your services.

The scopes you define control what each agent can access. A minimal scope set might include a read scope for accessing public content and service information, a lead scope for creating leads and requesting proposals, and an admin scope for internal tools that only trusted agents should access. Each tool declares which scopes it requires, and the authentication middleware enforces these requirements before the tool handler executes.

Discovery: Making Your MCP Server Findable

An MCP server that exists but cannot be found is useless. Discovery requires publishing structured metadata at predictable locations.

The MCP Server Card goes at a well-known URL on your domain. It declares your server's name, description, version, supported transports, endpoint URLs, authentication requirements, and the list of tools available. An agent that encounters your domain checks this URL first.

The Agent Card, defined by Google's A2A protocol, provides a broader description of your agent capabilities including the protocols you support. If you implement both MCP and ACP, the Agent Card links to both.

The llms.txt file, following an emerging convention, provides a plain-text summary of your site optimized for LLM consumption. This is not a protocol specification but a practical aid: many agents will read this file to quickly understand what your organization does before deciding whether to initiate a more structured protocol interaction.

Your robots.txt should explicitly allow the major AI crawlers and agent user agents. Your sitemap should include your agent discovery URLs alongside your human-facing pages.

Together, these files create a layered discovery system. An agent scanning your domain encounters robots.txt first, finds allowed paths, discovers your llms.txt for a quick overview, locates your MCP Server Card for detailed tool information, and initiates authentication if it decides to interact.

Rate Limiting and Abuse Prevention

AI agents can send requests at machine speed. Without proper rate limiting, a single agent could overwhelm your server or consume disproportionate resources.

Rate limiting for MCP tools requires a different approach than traditional API rate limiting. Agent interactions tend to be bursty: an agent might call several tools in rapid succession during a single evaluation, then go silent. A simple requests-per-minute limit would penalize legitimate bursty usage.

The recommended pattern is per-key rate limiting with tool-specific budgets. Each authenticated agent gets a rate limit that allows reasonable burst behavior, with tighter limits on expensive tools like proposal generation and looser limits on cheap tools like service catalog queries. Unauthenticated requests get the tightest limits.

All rate limit responses should include the Retry-After header, telling the agent exactly when it can try again. Well-behaved agents respect this header. Agents that ignore it and continue making requests should be blocked at the infrastructure level.

Monitoring Agent Interactions

Agents interact with your site differently than humans. Understanding these interaction patterns requires dedicated monitoring.

An audit log should capture every tool invocation with the authenticated agent identity, the tool called, the input parameters, the response status, and the latency. This log serves three purposes: security monitoring to detect abuse patterns, business intelligence to understand what agents are looking for, and debugging when an agent reports unexpected behavior.

Analytics should track which tools are most popular, what query patterns agents use most frequently, where agents drop off in multi-step interactions, and how agent-originated leads compare to human-originated leads in quality and conversion rate.

This data feeds back into your MCP server design. If agents frequently call a tool but get poor results, the tool description or logic needs improvement. If agents never call a tool, either the description is unclear or the capability is not valuable to agents. If agents always call two tools in sequence, consider combining them or adding a convenience tool that handles the common pattern.

The Business Case for WebMCP

Making your website agent-native is not a technology project. It is a business strategy.

Every day, more commercial activity moves through AI agents. Enterprises use agents to evaluate service providers, compare options, and shortlist candidates. If your competitors are MCP-accessible and you are not, agents will evaluate them and skip you. Not because your services are worse, but because they are invisible.

The first-mover advantage in agent discoverability mirrors the early days of SEO. Organizations that invested in search optimization in the early 2000s built enduring competitive advantages. Organizations that invest in agent-native infrastructure today are building the same kind of advantage for the agent economy.

The implementation cost is modest. A basic MCP server with a service catalog, fit assessment, and content tools can be built in a week by a single developer. The ongoing maintenance is minimal because the tools wrap existing business logic. The potential return is access to an entirely new channel of commercial discovery and engagement.

Getting Started

Start with three tools: a service catalog that returns what you offer, a fit assessment that evaluates whether a prospect's needs match your capabilities, and a content tool that returns relevant articles or documentation. Implement OAuth 2.1 with Dynamic Client Registration. Publish your discovery files. Monitor what happens.

The agents will come. The question is whether they will find you.