tab-mcp
Let any AI app use your web page, right in the user's tab.
Your page becomes its own MCP server for each user, while their tab is open. No server of your own: a relay passes the calls.
A tool is something the page lets an AI app do: a name, a description that tells the
AI app when to use it, the arguments it takes, and a function that runs in the page.
The todo list offers add_todo, the
diagram editor offers add_shapes.
The AI app picks the tool that fits your request and calls it.
The tab-mcp browser extension, for pages with WebMCP tools:
For users
Use Claude, ChatGPT or another AI app with a page: through the tab-mcp extension if you have it, otherwise with the page's "Connect your AI app" button.
For site owners
It works today, with the AI apps your users already have, and you build no new API of your own.
Where tab-mcp fits
Where does the state live? If it lives on your server, build an MCP server. If it lives in the tab and the user should see the AI work, use tab-mcp. Even a site with a backend has state that lives only in the tab: an unsaved diagram, a half-filled form, the user's signed-in session. The user sees at once when the AI is wrong and corrects it in the same page.
Today: most AI apps run outside the browser: Claude, ChatGPT, Claude Code, Codex, pi, opencode. They cannot reach a tab on their own. The tab-mcp relay connects them to it, in any browser.
Coming: some browsers and AI apps now bring their own AI, such as the browser built into the ChatGPT desktop app, or Gemini in Chrome (US only, for now). Such an AI can call a page's tools through WebMCP; ChatGPT's browser already does. It needs no tab-mcp.
WebMCP is the browser's own API for page tools
(document.modelContext.registerTool()), a draft of the W3C
Web Machine Learning
Community Group (repository).
tab-mcp has three parts. The relay is a server in the middle. AI apps
add it as a remote MCP server, pages and the extension connect to it with a
WebSocket, and the relay passes the calls between them. The
browser library @ractive-ch/tab-mcp-client is for site
owners. A page that includes it registers its tools and connects to the relay itself.
The tab-mcp browser extension is for users. It passes the WebMCP
tools of the active tab on to their AI app.
Which do I need?
| The AI runs | The site offers | What is needed |
|---|---|---|
| outside the browser | tab-mcp-client |
nothing to install; the user clicks the page's "Connect your AI app" button |
| outside the browser | WebMCP tools only | the user installs the tab-mcp extension |
| in the browser | WebMCP tools | nothing from tab-mcp (coming; preview) |
By default a page with tab-mcp-client also registers its tools with
WebMCP wherever the tab has it, so the extension and the browser's own AI find them
too (more for site owners).
Only Chromium-based browsers support WebMCP today, and it is still a preview. Chrome
has it for sites in an
origin trial
or behind chrome://flags/#enable-webmcp-testing, Edge for sites in its own
origin trial. Where the browser has no WebMCP, the tab-mcp extension adds it to each
page once you give it access to all sites. In Firefox, that is always the case. More
in
How the parts
fit together on GitHub.
Examples
-
Diagram editor
Your AI app draws boxes and arrows with you, reads them and rearranges them. The page has example prompts to try.
-
Todo list
A simple todo list. It shows a React app built with the tab-mcp React library.
-
Sign-in example
Notes behind a Google sign-in. The AI app pairs by identity instead of a code, so only the signed-in person's AI app can use them.
-
saturnus
HP calculator emulators in the browser. Your AI app can use them.
Use a page with your AI app
The AI in your browser needs nothing from tab-mcp. For Claude, ChatGPT, Claude Code, Codex and other AI apps outside the browser:
-
You have the tab-mcp extension: use it. You connect your AI app to
the extension once, in its side panel. That one connection reaches every page with
tools in the active tab. The extension asks you before it runs a tool that the page
did not mark read-only, and before its navigation tools take the tab to another
site. In Chrome or Edge, the extension sees a page's tools only where WebMCP is on:
sites in the browser's origin trial, or Chrome with
chrome://flags/#enable-webmcp-testing. Elsewhere, click "Give access to all sites" in its side panel. Firefox always needs that access. -
No extension, but the page has a "Connect your AI app" button:
click it. It shows the page's address and a code. The address is the relay's
address for this web app, ending in
/s/{app}/mcp, not the one in your browser's address bar. Add that address to your AI app as a connector. When the AI app opens a sign-in page, type the code. On pages where you sign in, such as the sign-in example, your sign-in replaces the code. Connecting an AI app shows the steps in Claude, ChatGPT, Codex and Claude Code, and what to do when it fails. The compatibility list shows which AI apps work. - Neither: install the tab-mcp extension from the Chrome Web Store or, for Firefox, from addons.mozilla.org, then go on as in 1. The listing for Edge is still in review, and there is none for Safari. Its source is on GitHub.
Offer tools on your site
Why tab-mcp
With tab-mcp-client, your page becomes its own MCP server for each user,
while their tab is open. You build no new API of your own: the tools call the code
your UI calls, with the user's session and permissions. There is no new
authentication, no tokens and no rate limits to build. It works in every current
browser. There is no extension for Safari, so Safari users reach your page only
through tab-mcp-client.
That is also a much smaller surface: no new endpoint of your own. Without an open, paired tab, there is nothing to reach. The relay is a server on the internet too, but a generic one. It holds no data of yours and forwards calls only to tabs paired by a code or a sign-in. You trust its operator, or you run your own relay. The privacy notice says what the hosted relay passes on and stores. One thing does not change: an AI app can do anything the user could do in that page. That is why tools can ask the user first. Prompt injection is a risk here, as with any AI agent.
With a coding agent
You only need to install the package:
npm install @ractive-ch/tab-mcp-client
Then tell your coding agent (Claude Code, Codex or another):
Read node_modules/@ractive-ch/tab-mcp-client/skill/SKILL.md and add tab-mcp to this app.
Then say what you want: which features of your page AI apps may use, and which of
them ask you first. The guide (skill/SKILL.md) comes with the package and
matches the installed version.
Register tools yourself
Each registerTool call adds an MCP tool. The AI app gets its name,
description, input schema (the arguments) and annotations from
tools/list. execute is the function that runs.
consequentialHint is a WebMCP hint that MCP does not have. The AI app
sees it as MCP's destructiveHint. When an AI app calls the tool through
the relay, the page asks the user first, on every call. For calls through WebMCP, see
Offer the tools to the browser's own AI below. Set the hint on tools whose effect
the user cannot undo on the page, on tools that act outside it (send, buy, delete for
good), and on tools the user would want to approve first. A change that the user sees
and can take back needs no question. The examples still ask before a few changes that
Undo can take back, so you can try the "Always allow" switches.
With alwaysAllow: true in new TabMcp({ … }), the library's
question also offers "Always allow". It lets that AI app call the tool without a
question until the AI app is disconnected. The connect dialog then shows one switch per
tool that asks, plus an "Always allow everything" switch. The examples show the same
switches under each connected AI app.
import { TabMcp } from "@ractive-ch/tab-mcp-client";
let notes: { id: string; text: string }[] = [];
let next = 1;
const mcp = new TabMcp({
relay: "https://relay.example.com",
server: { name: "notes", version: "1.0.0" },
appName: "Notes",
});
// Reads only. The texts are the user's, not instructions for the model.
await mcp.registerTool({
name: "list_notes",
description: "List the notes on the page with their ids",
annotations: { readOnlyHint: true, untrustedContentHint: true },
execute: () => notes,
});
// Changes the page, but you see the note and can delete it: no question.
await mcp.registerTool<{ text: string }>({
name: "add_note",
title: "Add a note",
description: "Add a note (at most 500 characters) to the list on the page and return its id.",
inputSchema: {
type: "object",
properties: { text: { type: "string", minLength: 1, maxLength: 500 } },
required: ["text"],
additionalProperties: false,
},
execute: ({ text }) => {
const note = { id: `n${next++}`, text };
notes.push(note);
return note;
},
});
// Cannot be undone: consequentialHint, so the page asks you before each call of an AI app.
await mcp.registerTool<{ id: string }>({
name: "delete_note",
title: "Delete a note",
description: "Delete a note by its id from list_notes. It cannot be restored.",
inputSchema: {
type: "object",
properties: { id: { type: "string" } },
required: ["id"],
additionalProperties: false,
},
annotations: { consequentialHint: true },
execute: ({ id }) => {
if (!notes.some((note) => note.id === id)) throw new Error(`No note with id ${id}`);
notes = notes.filter((note) => note.id !== id);
return "Deleted.";
},
});
// Your Connect button opens the dialog with the address and the code.
document.querySelector("#connect")?.addEventListener("click", () => mcp.showConnectDialog());
The library also loads from a CDN, without a bundler. It has React bindings for single-page apps. See the quick start for page authors and the library's README.
Offer the tools to the browser's own AI
By default the library also registers the page's tools with the browser's WebMCP,
where the tab has it. The browser's own AI then calls them without connecting. The
tab-mcp extension reads them too and passes them on to its users' AI apps. To turn
this off, set webmcp: false in new TabMcp({ … }) or on
TabMcpProvider.
Any WebMCP caller then gets every tool you did not keep back, and the library does
not ask the user first. To keep a tool out of WebMCP, set callers in its
registration, for example ["relay", "local"]. To refuse a single call,
use the page's onConfirm. For a tool that asks first, who asks depends
on the caller:
-
An AI app through the relay: the page asks, with the library's
question or with the page's own
onConfirm. - An AI app through the tab-mcp extension: the extension asks, in its side panel. It then vouches for exactly that call (the tool, its arguments and the AI app), and the page does not ask again.
-
Any other WebMCP caller (an AI in the browser, another extension, a
frame of an origin named in
exposedTo): the page does not ask. The tool runs unless the page'sonConfirmrefuses it. An AI that respectsconsequentialHintasks you in its own chat.
The page also learns which AI apps reach it through the extension
(mcp.extension and the event extensionchange). The examples'
card names them, and each of their calls names both the AI app and the extension.
Both examples register all their tools with WebMCP, including those that ask first:
the diagram editor's delete_elements, layout and
clear_diagram, and the todo list's complete_todo and
delete_todos.
Join the WebMCP
origin trial
(from Chrome 149) with your site: then Chrome users with the extension see your tools
without giving it access to all sites. To test locally, turn on
chrome://flags/#enable-webmcp-testing. See Chrome's
WebMCP documentation.
Tell your users
Your users cannot see that a page offers tools. Tell them in the page or in your help that they can connect their AI app with the "Connect your AI app" button, and that the tools also work with the tab-mcp extension.
Run your own relay
The relay at tab-mcp.ractive.ch accepts only the examples on ractive.ch,
the tab-mcp browser extension and a few other sites. For your own sites, run your own
relay. It is one process with a SQLite file. It comes as the Docker image
ractive/tab-mcp (also ghcr.io/ractive/tab-mcp, for
linux/amd64 and linux/arm64) and on npm as @ractive-ch/tab-mcp.
docker run -d -p 127.0.0.1:8080:8080 -v tab-mcp-data:/data \
-e TAB_MCP_PUBLIC_URL=https://relay.example.com \
-e TAB_MCP_ALLOWED_ORIGINS=https://docs.example.com,https://app.example.org \
ractive/tab-mcp
One relay serves pages from every origin in TAB_MCP_ALLOWED_ORIGINS,
across domains. Each app gets its own MCP endpoint. Think of it as one MCP server for
all your static sites, where every open tab brings its own tools. Put the relay
behind a reverse proxy with TLS.
Self-hosting
covers WebSockets, event streams, proxy time limits and every setting.
Limits
The tools exist only while the tab is open. An autonomous AI agent, one that runs on a schedule or without you, finds no open tab and so no tools. It needs a real MCP server. If your state lives on your server, an MCP server is the better choice anyway: see Where tab-mcp fits.
How it works
Both sides connect out to the relay, so neither has to be reachable from the
internet. The page connects with a WebSocket (protocol tab-mcp.v1).
Each web app has one MCP endpoint on the relay, /s/{app}/mcp. It is the
same for every page of the web app and for every user. The AI app uses that endpoint like
any remote MCP server: Streamable HTTP, authorized with OAuth. During authorization
you type a code of 8 letters that only the page shows. The code alone decides which
page the AI app pairs with. So only someone who has the code can pair an AI app with
the page.
Web apps with a login can pair by identity instead of a code
(TAB_MCP_IDENTITY=oidc). The web app and the relay are then both
clients of the same OpenID Connect provider (Google, Keycloak, Auth0, Okta,
Microsoft Entra ID or your own). You sign in to the web app with your account there.
When an AI app connects, you sign in to the relay with the same account. Usually you
do not have to log in again, because the provider still knows you. With any other
account, the relay pairs nothing. Logging out of the web app ends the connection. The
web app's backend tells the relay who is signed in to the page: it signs a short
assertion. An edge function is enough for that. See
identity binding.
The relay knows no tools. It checks the AI app's token and its limits, then forwards
each MCP request over the WebSocket. The page answers tools/list and
tools/call itself. When the tab closes, the tools are gone, and the AI
app gets "the page is not open". The AI app stays paired for the next time the page
connects.
Demo
The connection step by step
Read the privacy notice of the hosted relay and the tab-mcp browser extension. Ask questions and report bugs in GitHub issues.
