<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Muhammed Halil Akkaynak on Medium]]></title>
        <description><![CDATA[Stories by Muhammed Halil Akkaynak on Medium]]></description>
        <link>https://medium.com/@mhakkaynak?source=rss-f750b008bc0e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Fd9tcprHvnwkYYNTCgAiRA.jpeg</url>
            <title>Stories by Muhammed Halil Akkaynak on Medium</title>
            <link>https://medium.com/@mhakkaynak?source=rss-f750b008bc0e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 09:26:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mhakkaynak/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Agentic Era: Preparing Web Apps for AI Agents with WebMCP]]></title>
            <link>https://medium.com/@mhakkaynak/the-agentic-era-preparing-web-apps-for-ai-agents-with-webmcp-70e0805b1b90?source=rss-f750b008bc0e------2</link>
            <guid isPermaLink="false">https://medium.com/p/70e0805b1b90</guid>
            <category><![CDATA[what-is-webmcp]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web-mcp]]></category>
            <dc:creator><![CDATA[Muhammed Halil Akkaynak]]></dc:creator>
            <pubDate>Sat, 28 Nov 2026 21:03:17 GMT</pubDate>
            <atom:updated>2026-11-28T21:03:17.502Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2KsL_7t3h48vtDTzyxi9Mg.png" /></figure><p>Imagine giving an event application a request like this:</p><blockquote><strong><em>“Find beginner-level AI sessions in the afternoon and add one that does not conflict with my schedule.”</em></strong></blockquote><p>For a human, this is a fairly natural task. We use the filters, review the available sessions, compare their times, and add the one we want to our schedule.</p><p>For an AI agent, the same task can be more complicated. The agent may need to understand the interface, locate the correct elements, interpret the results, compare time slots, and perform the necessary actions.</p><p>But what if the web application could explicitly tell the agent what it is capable of doing?</p><p>In this article, we will explore how WebMCP approaches this problem using the <strong>DevFest Session Planner</strong> I built for a workshop, and how an existing web application can expose its capabilities to AI agents.</p><p>You can find the complete source code here:</p><p><a href="https://github.com/mhakkaynak/agent-ready-web">https://github.com/mhakkaynak/agent-ready-web</a></p><h3>Assistants Answer. Agents Take Action.</h3><p>An assistant can tell us which sessions are available. An agent can go a step further: find the right session, check whether it conflicts with the user’s schedule, and add it.</p><p>For that, the agent needs access to the capabilities provided by the application.</p><h3>Web Interfaces Were Designed for Humans</h3><p>When we use a web application, we see search fields, filters, buttons, and navigation elements. As humans, we can usually understand what these elements do simply by looking at the interface.</p><p>An agent can also try to extract this information from the DOM, the accessibility tree, or the visual interface. It may then imitate user actions such as clicking, typing, and navigating.</p><p>This approach can work, but every step requires interpreting the interface, and it may become fragile when the UI changes.</p><p>This leads to an important distinction:</p><p><strong>UI and application capability are not the same thing.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*amYckdq_UehhXQmneAcK5g.png" /></figure><p>The interface is only one way to reach a capability. The user’s goal is not to click a dropdown; it is to <strong>filter sessions by level</strong>. WebMCP lets the application expose that capability directly as a structured tool.</p><h3>What Is MCP?</h3><p>Before looking at WebMCP, it helps to establish where MCP fits.</p><p><strong>Model Context Protocol (MCP)</strong> is an open standard designed to help AI applications connect to tools, data sources, and workflows in external systems through a common protocol.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jEv4IIDclqcEr0DUNsUc6Q.png" /></figure><p>An MCP server exposes tools to an MCP client. The client discovers available tools, while the AI application determines which tools to use based on the user’s request. The client can then invoke the selected tools with structured input and receive their results.</p><p>MCP is not limited to tools, but because this article focuses on WebMCP, we will mainly discuss the tool aspect.</p><h3>What About the Browser?</h3><p>A web application is more than just an API.</p><p>When an agent interacts with a web application, the browser may already contain the current page, an authenticated user session, application state, locally stored data, and the visible interface.</p><p>This creates a live application context that WebMCP tools can operate within.</p><p>This is where WebMCP comes in.</p><h3>What Is WebMCP?</h3><p>WebMCP is a proposed web standard that allows web applications to expose their capabilities to AI agents as <strong>structured tools</strong>.</p><p>In traditional browser automation, an agent typically interacts with a web application through its user interface. It may need to inspect the DOM or accessibility tree, identify the correct element, perform a click or input action, and then observe what changed.</p><p>That works, but the agent is effectively trying to infer the application’s capabilities from the UI.</p><p>With WebMCP, the application can describe those capabilities directly.</p><p>Instead of figuring out how to click a “Filter by Level” dropdown, the agent can discover a tool such as:</p><p>filter_sessions_by_level</p><p>Instead of locating an “Add to Schedule” button, it can call:</p><p>add_to_schedule</p><p>The important shift is this:</p><p>With traditional browser automation, agents interact with the UI.</p><p>With WebMCP, agents can invoke application capabilities through structured tools.</p><p>The UI does not disappear. It still serves human users. WebMCP simply adds another structured interface that agents can use.</p><p>For example, some capabilities in the DevFest application can be exposed as:</p><pre>search_sessions<br>get_session<br>filter_sessions_by_level<br>get_my_schedule<br>add_to_schedule<br>remove_from_schedule</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sN5pI5zP0PRvrg7iHygCbQ.png" /></figure><p><strong>One application. One business logic layer. Two interfaces.</strong></p><h3>Are MCP and WebMCP the Same Thing?</h3><p>No. They share the idea of exposing structured tools to agents, but they work in different contexts.</p><p><strong>MCP</strong> is typically used to connect an AI application to external systems through an MCP server. Those systems might be APIs, databases, developer tools, or other services.</p><p><strong>WebMCP</strong>, on the other hand, works within the context of the web application that is already open in the user’s browser. It allows that application to expose its own capabilities directly to an agent.</p><p>So the distinction is simple:</p><p><strong>MCP connects agents to external systems.</strong><br><strong>WebMCP exposes capabilities from the current web application.</strong></p><p>WebMCP is not simply an MCP server running in the browser. The two approaches can complement each other. For example, backend capabilities can be exposed through MCP, while actions tied to the user’s active browser state can be exposed through WebMCP.</p><h3>Two Approaches to WebMCP</h3><p>Chrome currently documents two approaches to exposing application capabilities through WebMCP: the Declarative API and the Imperative API.</p><h3>Declarative API</h3><p>The Declarative API aims to expose existing HTML forms as tools by adding metadata to them.</p><p>For example:</p><pre>&lt;form toolname=&quot;search_sessions&quot; tooldescription=&quot;Search DevFest sessions by topic&quot;&gt;<br>  &lt;input name=&quot;topic&quot; type=&quot;text&quot; placeholder=&quot;Enter topic...&quot; /&gt;<br>  &lt;button type=&quot;submit&quot;&gt;Search&lt;/button&gt;<br>&lt;/form&gt;</pre><p>This example illustrates tool registration through HTML. The actual search logic remains the responsibility of the application.</p><p>This approach is particularly natural for:</p><ul><li>search,</li><li>filtering,</li><li>form-based workflows.</li></ul><p>One important detail is that the agent can fill the form fields using structured input. Automatic form submission is a separate behavior and can be controlled through mechanisms such as toolautosubmit.</p><h3>Imperative API</h3><p>The Imperative API registers tools programmatically in JavaScript and is better suited to dynamic application state, navigation, and non-form workflows.</p><pre>await document.modelContext.registerTool({<br>  name: &quot;filter_sessions_by_level&quot;,<br>  description: &quot;Return DevFest sessions matching the requested difficulty level.&quot;,<br>  inputSchema: {<br>    type: &quot;object&quot;,<br>    properties: {<br>      level: {<br>        type: &quot;string&quot;,<br>        enum: [&quot;beginner&quot;, &quot;intermediate&quot;, &quot;advanced&quot;],<br>        description: &quot;The difficulty level of the sessions.&quot;<br>      }<br>    },<br>    required: [&quot;level&quot;]<br>  },<br>  execute: async ({<br>    level<br>  }) =&gt; {<br>    return filterSessionsByLevel(level);<br>  }<br>});</pre><p>The workshop repository uses the <strong>Imperative API</strong>, so the rest of this article focuses on that approach.</p><p>There is also a maturity difference worth noting: Chrome documents both approaches, while the current WebMCP explainer focuses primarily on the imperative API. They should not necessarily be treated as equally mature.</p><h3>Architecture of the Example Application</h3><p>The important part of this architecture is not the framework choice. It is that both the UI and WebMCP tools operate on the same application state and business logic.</p><p>The DevFest Session Planner uses Next.js App Router, React, TypeScript, and Tailwind CSS. Session and speaker data are stored locally, while the user’s personal schedule is managed through React state and localStorage.</p><p>The demo is intentionally simple: there is no server-side database, authentication system, or cross-device synchronization.</p><p>The WebMCP implementation mainly lives in two files:</p><pre>components/WebMcpTools.tsx<br>lib/webmcp/handlers.ts</pre><p>WebMcpTools.tsx contains the tool definitions and registration lifecycle. handlers.ts contains the application logic that runs when the tools are invoked.</p><h3>Anatomy of a WebMCP Tool</h3><p>Let’s look at the get_session tool from the repository.</p><pre>{<br>  name: &quot;get_session&quot;,<br>  title: &quot;Get session&quot;,<br>  description: &quot;Get one DevFest session and its speaker by session ID.&quot;,<br>  inputSchema: {<br>    type: &quot;object&quot;,<br>    properties: {<br>      id: {<br>        type: &quot;string&quot;,<br>        description: &quot;The session ID.&quot;<br>      }<br>    },<br>    required: [&quot;id&quot;],<br>    additionalProperties: false<br>  },<br>  annotations: {<br>    readOnlyHint: true<br>  },<br>  execute: webMcpHandlers.getSession<br>}</pre><p>The main parts are straightforward:</p><ul><li>name identifies the capability.</li><li>title provides an optional, human-readable label.</li><li>description helps the agent decide when to use the tool.</li><li>inputSchema defines the input contract.</li><li>annotations provide hints about the expected behavior of the tool.</li><li>execute connects the tool to application logic.</li></ul><p>The key point is that the tool does not reimplement the business logic. It exposes logic that already exists in the application.</p><h3>Is Schema Validation Enough?</h3><p>No.</p><p>A schema describes the shape of the input, but business validation still needs to happen at runtime.</p><pre>getSession: async (<br>  input: ToolInput,<br>  { signal }: ToolSignal<br>) =&gt; {<br>  signal.throwIfAborted();<br><br>  const id = readString(input, &quot;id&quot;);<br><br>  const session = id<br>    ? getSessionById(id)<br>    : undefined;<br><br>  if (!session) {<br>    return {<br>      found: false,<br>      error: &quot;Session not found.&quot;<br>    };<br>  }<br><br>  return {<br>    found: true,<br>    session,<br>    speaker: getSpeakerInfo(session.speakerId),<br>    url: `/sessions/${encodeURIComponent(session.id)}`<br>  };<br>};</pre><p>The schema defines the expected input: a required string named id.<br>The handler answers: <strong>“Does this ID actually exist?”</strong></p><p>That distinction matters.</p><h3>A Note on Lifecycle and Cancellation</h3><p>WebMCP registrations and tool executions can both use AbortSignal, but for different purposes.</p><p>The registration signal controls the lifetime of a registered tool, while the execution signal allows the handler to respond to cancellation requests.</p><p>In this project, tool registrations are tied to a React useEffect lifecycle using an AbortController. The following code is a simplified excerpt from the registration effect.</p><pre>const modelContext = document.modelContext;<br>if (!modelContext) return;<br>const controller = new AbortController();<br>for (const tool of createWebMcpTools(scheduleHandlers)) {<br>  void modelContext<br>    .registerTool(tool, {<br>      signal: controller.signal<br>    })<br>    .catch(console.error);<br>}<br>return () =&gt; controller.abort();</pre><p>The feature check is also important: if document.modelContext is unavailable, the regular user interface continues to work. This makes WebMCP suitable as a form of <strong>progressive enhancement</strong>.</p><p>The repository also includes a local TypeScript declaration for the experimental API. It only provides types; it does not polyfill WebMCP at runtime.</p><h3>Tools That Modify State</h3><p>Now let’s look at a more interesting example: add_to_schedule.</p><pre>{<br>  name: &quot;add_to_schedule&quot;,<br>  title: &quot;Add session to schedule&quot;,<br>  description:<br>    &quot;Add a session to the user&#39;s schedule and return resulting conflicts.&quot;,<br>  inputSchema: {<br>    type: &quot;object&quot;,<br>    properties: {<br>      sessionId: {<br>        type: &quot;string&quot;,<br>        description: &quot;The session ID to add.&quot;<br>      }<br>    },<br>    required: [&quot;sessionId&quot;],<br>    additionalProperties: false<br>  },<br>  annotations: {<br>    consequentialHint: true<br>  },<br>  execute: scheduleHandlers.addToSchedule<br>}</pre><p>This tool does not simply read data. It changes application state.</p><p>Its handler eventually calls the same add() logic used by the UI. When the agent invokes add_to_schedule, React state and localStorage are updated and the change becomes visible in the interface.</p><p>The UI and the agent do not need separate implementations. Both eventually reach the same application logic.</p><h3>A Small Demo Limitation</h3><p>The demo is intentionally simple. Scheduling conflicts do not block insertion; they are reported after the session is added.</p><p>In a production system, mutation results should make states such as <strong>already existed</strong>, <strong>added successfully</strong>, or <strong>blocked by conflict</strong> explicit.</p><h3>What Can the Agent Do?</h3><p>The demo exposes 16 tools across session discovery, speaker information, schedule queries and mutations, plus navigation. Some representative examples are:</p><pre>search_sessions<br>filter_sessions_by_level<br>get_my_schedule<br>check_schedule_conflict<br>add_to_schedule<br>open_session</pre><p>Imagine the user asks:</p><blockquote><strong><em>“Find a beginner-level AI session that does not conflict with my schedule.”</em></strong></blockquote><p>A compatible agent might first filter sessions by topic, narrow the results by level, and then call check_schedule_conflict for a candidate. Since the application exposes separate topic and level filters, the agent may need to combine their results before checking for scheduling conflicts. If the user asks to add it, the agent can call add_to_schedule.</p><p>This plan is not hard-coded in the repository. The repository does not contain an agent or a model. Tool selection and ordering depend on the client, the model, and the user’s prompt.</p><h3>How Do You Design a Good WebMCP Tool?</h3><p>There are four useful principles.</p><h3>1. Be Specific</h3><p>Prefer:</p><pre>filter_sessions_by_level()</pre><p>over something generic like:</p><pre>process()</pre><h3>2. Keep Tools Atomic</h3><p>A tool should ideally represent one clear and understandable capability.</p><h3>3. Keep Inputs Structured</h3><p>The input schema should be explicit. When possible, constrained inputs can reduce ambiguity:</p><pre>{<br>  type: &quot;string&quot;,<br>  enum: [&quot;beginner&quot;, &quot;intermediate&quot;, &quot;advanced&quot;]<br>}</pre><p>Outputs should also have predictable structures that the agent can interpret reliably.</p><h3>4. Design Around Intent</h3><p>A tool such as:</p><pre>openSpeakerModal()</pre><p>describes a UI implementation detail.</p><p>A tool such as:</p><pre>get_speaker()</pre><p>describes the user’s actual goal.</p><p>The important question is not <strong>“Which element is the user clicking?”</strong> but <strong>“What is the user trying to accomplish?”</strong></p><h3>Annotations Are Hints, Not Security Boundaries</h3><p>The repository uses readOnlyHint: true for read-only tools and consequentialHint: true for some state-changing tools.</p><p>These annotations describe expected behavior to the client and model, but they do not enforce authorization, permissions, confirmation, or read-only behavior.</p><p>Real applications still need to enforce authentication, authorization, validation, business rules, and where appropriate explicit user confirmation.</p><p>WebMCP does not replace existing security layers, and tool metadata is not a security boundary.</p><p>Not every state-changing operation is necessarily consequential. This annotation should be used based on the significance and potential impact of the action.</p><h3>Trying WebMCP Today</h3><p>As of November 2026, Chrome’s WebMCP documentation describes an origin trial beginning with Chrome 149 and a local development flag:</p><pre>chrome://flags/#enable-webmcp-testing</pre><p>WebMCP is not yet a stable web API supported by every browser. That makes feature detection important:</p><pre>if (!document.modelContext) {<br>  return;<br>}</pre><p>It is best thought of as progressive enhancement rather than a replacement for the existing web experience. The application should continue to work for human users even when WebMCP is unavailable.</p><p>To inspect and test registered WebMCP tools, developers can use the Model Context Tool Inspector. It allows them to discover registered tools, inspect their input schemas, and test tool execution.</p><p>WebMCP provides the browser-side API, but a compatible agent or client is still required to discover and invoke these tools.</p><h3>Conclusion</h3><p>WebMCP is not about teaching agents where to click. It is about exposing what an application can actually do.</p><p>The most important architectural idea is simple: humans can continue to use the UI, while agents use structured tools both backed by the same application logic.</p><p>Start small. Expose one read-only capability, test it with a compatible agent, observe how discovery and validation behave, and only then move toward state-changing operations.</p><p>You can find the full source code here:</p><p><a href="https://github.com/mhakkaynak/agent-ready-web">https://github.com/mhakkaynak/agent-ready-web</a></p><p>For the latest API details and browser support, follow the <a href="https://developer.chrome.com/docs/ai/webmcp">Chrome WebMCP documentation</a> and the <a href="https://github.com/webmachinelearning/webmcp">WebMCP explainer</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70e0805b1b90" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>