Set up one web page, one local relay, and one MCP client so a desktop AI agent can call tools on your page.
In this tutorial, we will set up a web page with a WebMCP tool, run the local relay, and connect a desktop MCP client so the AI agent can discover and call the tool. By the end, you will have a working pipeline from a browser tab to Claude Desktop (or any MCP client).
The first script tag loads @mcp-b/global, which sets up document.modelContext. The tool registration is the same pattern from the first tool tutorial. The last script tag loads embed.js, which creates a hidden iframe that connects the page’s tools to the local relay via WebSocket. The embed also detects tools registered later, so the script order is not a discovery requirement.
2
Configure the relay in your MCP client
Add the relay to your MCP client’s configuration. The exact location depends on your client.
Claude Desktop
Cursor
Claude Code
Open Claude Desktop settings, go to the MCP section, and add:
claude mcp add webmcp-local-relay -- npx -y @mcp-b/webmcp-local-relay@latest
When the MCP client starts, it launches the relay process. The relay prefers
ws://127.0.0.1:9333 and can discover another relay port automatically if that port is occupied.
The no-argument setup allows tools from every page origin. To limit this tutorial to its local
page, add --widget-origin http://localhost:3000 to the relay command.
3
Serve and open the page
From the directory containing relay-demo.html, start a local server:
npx --yes serve . --listen 3000
Open http://localhost:3000/relay-demo.html in your browser.
Serving the page over localhost gives it a non-opaque origin that the WebMCP execution path can use.The page registers the tool and the embed.js script connects to the relay via WebSocket (see Transports and Bridges for details). The relay now knows about the get_page_title tool on this tab.
4
Verify the connection from your MCP client
In your MCP client, the relay exposes management tools. Ask the agent:
List the connected WebMCP sources.
The agent calls webmcp_list_sources, which returns something like:
The agent calls the get_page_title tool and returns:
Expected response
Relay Demo Page
You have called a browser-side tool from a desktop AI agent through the local relay.
6
Try with a live website
Open webmcp.sh in a separate tab. It has WebMCP tools for navigation, SQL queries, entity management, and more. Ask the agent to list sources again. You will see tools from both tabs. The relay aggregates tools from all connected pages.
webmcp.sh dashboard: a production app with WebMCP tools the relay can discover
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"WebMCP Documentation","description":"Task-focused WebMCP documentation with package references, tutorials, how-to guides, and concise implementation concepts.","colors":{"primary":"#005F8F","light":"#006D9F","dark":"#004D73"},"logo":{"light":"https://mintcdn.com/mcp-b/ubXGdMz3VU92HGBa/logo/mcp-b-logo.png?fit=max\u0026auto=format\u0026n=ubXGdMz3VU92HGBa\u0026q=85\u0026s=bfd4f881cd73802f2c5482dcfed9fd72","dark":"https://mintcdn.com/mcp-b/ubXGdMz3VU92HGBa/logo/mcp-b-logo.png?fit=max\u0026auto=format\u0026n=ubXGdMz3VU92HGBa\u0026q=85\u0026s=bfd4f881cd73802f2c5482dcfed9fd72"},"favicon":"https://mintcdn.com/mcp-b/ubXGdMz3VU92HGBa/favicon.ico?fit=max\u0026auto=format\u0026n=ubXGdMz3VU92HGBa\u0026q=85\u0026s=516345baa365e286ec6bdf311d79c6fc","appearance":{"default":"light","strict":false},"background":{"decoration":"gradient"},"navbar":{"links":[{"href":"https://github.com/WebMCP-org","label":"GitHub"},{"href":"https://github.com/WebMCP-org/npm-packages","label":"NPM Packages"},{"href":"https://chromewebstore.google.com/detail/opojeelojlkcinlhkbahpcekdolfjmhi","label":"Rook Extension"},{"href":"https://discord.gg/ZnHG4csJRB","label":"Discord"}],"primary":{"type":"button","label":"Live Demo","href":"https://webmcp.sh"}},"footer":{"socials":{"github":"https://github.com/WebMCP-org","discord":"https://discord.gg/ZnHG4csJRB","linkedin":"https://www.linkedin.com/company/mcp-b"}},"seo":{"metatags":{"description":"Package-first WebMCP documentation with package overviews, package references, tutorials, how-to guides, and explanations for the browser runtime and tooling ecosystem.","keywords":"MCP, Model Context Protocol, WebMCP, AI agents, web tools, browser extension, tab transport, JavaScript SDK","author":"WebMCP Team","robots":"index, follow","googlebot":"index, follow","og:type":"website","og:image":"https://docs.mcp-b.ai/logo/mcp-b-logo.png","og:site_name":"WebMCP Documentation","og:locale":"en_US","twitter:card":"summary_large_image","twitter:site":"@webmcp","twitter:creator":"@webmcp","twitter:image":"https://docs.mcp-b.ai/logo/mcp-b-logo.png"},"indexing":"all"},"banner":{"content":"**Hackathon:** [OpenAI WebMCP Challenge](https://webmcp.devpost.com/). Build an agent-native web app. Submissions close September 3 at 1 p.m. PT.","dismissible":true},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Live Demo","icon":"play","href":"https://webmcp.sh"},{"anchor":"Examples","icon":"code","href":"https://github.com/WebMCP-org/examples"},{"anchor":"Community Group Draft","icon":"book","href":"https://webmachinelearning.github.io/webmcp/"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"mcp-b","hasAudioNarration":false,"actualSubdomain":"mcp-b","customDomains":["docs.mcp-b.ai"],"gitSource":{"type":"github","owner":"webmcp-org","repo":"npm-packages","deployBranch":"main","contentDirectory":"apps/documentation-website","isPrivate":false,"mountPath":"","label":""},"feedback":{"thumbs":true,"edits":false,"issues":false},"entitlements":{},"buildId":"6af298167bebb2d3bd09ed5e","clientVersion":"0.0.4102","searchFilterCounts":[{"language":"default","tag":"Packages","count":26},{"language":"default","tag":"How-To Guides","count":11},{"language":"default","tag":"Explanation","count":10},{"language":"default","tag":"Core runtime","count":10},{"language":"default","tag":"Tutorials","count":8},{"language":"default","tag":"Tooling","count":6},{"language":"default","tag":"WebMCP platforms and agents","count":4},{"language":"default","tag":"Adoption","count":4},{"language":"default","tag":"Connectivity","count":4},{"language":"default","tag":"React","count":4}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","href":"/_mintlify/custom/mcp-b/4926869d30b9cd39/style.css"}],"page":{"pagePath":"tutorials/desktop-agent-relay","slug":"/tutorials/desktop-agent-relay","pageMetadata":{"title":"Connect a desktop agent with the relay","description":"Set up one web page, one local relay, and one MCP client so a desktop AI agent can call tools on your page.","keywords":["webmcp-local-relay","desktop agent","claude desktop","cursor","websocket","mcp client","stdio","bridge"],"icon":"plug","href":"/tutorials/desktop-agent-relay"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Set up one web page, one local relay, and one MCP client so a desktop AI agent can call tools on your page.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,blockquote:`blockquote`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Frame,Heading,OptimizedImage,Step,Steps,Tab,Tabs,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`In this tutorial, we will set up a web page with a WebMCP tool, run the local relay, and connect a desktop MCP client so the AI agent can discover and call the tool. By the end, you will have a working pipeline from a browser tab to Claude Desktop (or any MCP client).`}),`\n`,_jsx(CodeBlock,{filename:`Relay path`,numberOfLines:`17`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`17`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` Browser Tab Local Machine`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`+-----------------------+ +-----------------------+`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`| | WebSocket | |`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`| Page with |----------->| webmcp-local-relay |`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`| WebMCP tools | localhost | (MCP server) |`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`| | | |`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`+-----------------------+ +-----------+-----------+`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` |`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` stdio | JSON-RPC`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` |`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` +-----------v-----------+`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` | |`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` | Claude / Cursor / |`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` | any MCP client |`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` | |`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` +-----------------------+`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`prerequisites`,children:`Prerequisites`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Node.js 22.12 or later`}),`\n`,_jsx(_components.li,{children:`Chrome or Edge 126+, Firefox 126+, or Safari 18+`}),`\n`,_jsx(_components.li,{children:`An MCP client (Claude Desktop, Cursor, Claude Code, or Windsurf)`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`what-we-will-build`,children:`What we will build`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`An HTML page that registers a `,_jsx(_components.code,{children:`get_page_title`}),` tool and connects to the relay`]}),`\n`,_jsx(_components.li,{children:`A running relay process that bridges browser tools to MCP clients`}),`\n`,_jsx(_components.li,{children:`A desktop AI agent that can list and call the browser tool`}),`\n`]}),`\n`,_jsxs(Steps,{children:[_jsxs(Step,{title:`Create the web page`,children:[_jsxs(_components.p,{children:[`Create a file called `,_jsx(_components.code,{children:`relay-demo.html`}),`:`]}),_jsx(CodeBlock,{filename:`relay-demo.html`,numberOfLines:`34`,language:`html`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`html`,children:_jsxs(_components.code,{language:`html`,numberOfLines:`34`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c!`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`DOCTYPE`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` html`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`html`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` lang`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"en\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`head`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`meta`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` charset`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"UTF-8\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` />`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`title`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Relay Demo Page`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`title`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`script`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` src`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://cdn.jsdelivr.net/npm/@mcp-b/global@6/dist/index.iife.js\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>\u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`script`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`head`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`h1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Relay Demo`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`h1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`p`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Registering tool...`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`p`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`script`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`modelContext`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'WebMCP is unavailable'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` void`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`modelContext`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`registerTool`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` name:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'get_page_title'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` description:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Get the current page title'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` inputSchema:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'object'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`properties:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {} },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` execute`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` () `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` content:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [{ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'text'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`text:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`title`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`then`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(() `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getElementById`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'status'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`textContent`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Tool \"get_page_title\" registered. Waiting for relay connection...'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`getElementById`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'status'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`textContent`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `Registration failed: \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`script`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`script`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` src`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://cdn.jsdelivr.net/npm/@mcp-b/webmcp-local-relay@6/dist/browser/embed.js\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>\u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`script`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`body`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`\u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`html`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`]})})}),_jsxs(_components.p,{children:[`The first script tag loads `,_jsx(_components.code,{children:`@mcp-b/global`}),`, which sets up `,_jsx(_components.code,{children:`document.modelContext`}),`. The tool registration is the same pattern from the `,_jsx(_components.a,{href:`/tutorials/first-tool`,children:`first tool tutorial`}),`. The last script tag loads `,_jsx(_components.code,{children:`embed.js`}),`, which creates a hidden iframe that connects the page’s tools to the local relay via WebSocket. The embed also detects tools registered later, so the script order is not a discovery requirement.`]})]}),_jsxs(Step,{title:`Configure the relay in your MCP client`,children:[_jsx(_components.p,{children:`Add the relay to your MCP client’s configuration. The exact location depends on your client.`}),_jsxs(Tabs,{children:[_jsxs(Tab,{title:`Claude Desktop`,id:`claude-desktop`,children:[_jsx(_components.p,{children:`Open Claude Desktop settings, go to the MCP section, and add:`}),_jsx(CodeBlock,{filename:`claude_desktop_config.json`,numberOfLines:`8`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"mcpServers\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"webmcp-local-relay\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"command\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"npx\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"args\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"-y\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"@mcp-b/webmcp-local-relay@latest\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]}),_jsxs(Tab,{title:`Cursor`,id:`cursor`,children:[_jsx(_components.p,{children:`Open Cursor settings, go to the MCP section, and add the same configuration:`}),_jsx(CodeBlock,{filename:`mcp.json`,numberOfLines:`8`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"mcpServers\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"webmcp-local-relay\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"command\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"npx\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"args\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"-y\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"@mcp-b/webmcp-local-relay@latest\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]}),_jsxs(Tab,{title:`Claude Code`,id:`claude-code`,children:[_jsx(_components.p,{children:`Run the following command in your terminal:`}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`claude`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` mcp`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` add`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` webmcp-local-relay`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` npx`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -y`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` @mcp-b/webmcp-local-relay@latest`})]}),`\n`]})})})]})]}),_jsxs(_components.p,{children:[`When the MCP client starts, it launches the relay process. The relay prefers\n`,_jsx(_components.code,{children:`ws://127.0.0.1:9333`}),` and can discover another relay port automatically if that port is occupied.`]}),_jsx(Warning,{children:_jsxs(_components.p,{children:[`The no-argument setup allows tools from every page origin. To limit this tutorial to its local\npage, add `,_jsx(_components.code,{children:`--widget-origin http://localhost:3000`}),` to the relay command.`]})})]}),_jsxs(Step,{title:`Serve and open the page`,children:[_jsxs(_components.p,{children:[`From the directory containing `,_jsx(_components.code,{children:`relay-demo.html`}),`, start a local server:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`npx`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --yes`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` serve`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --listen`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 3000`})]}),`\n`]})})}),_jsxs(_components.p,{children:[`Open `,_jsx(_components.code,{children:`http://localhost:3000/relay-demo.html`}),` in your browser.\nServing the page over localhost gives it a non-opaque origin that the WebMCP execution path can use.`]}),_jsxs(_components.p,{children:[`The page registers the tool and the `,_jsx(_components.code,{children:`embed.js`}),` script connects to the relay via WebSocket (see `,_jsx(_components.a,{href:`/explanation/architecture/transports-and-bridges`,children:`Transports and Bridges`}),` for details). The relay now knows about the `,_jsx(_components.code,{children:`get_page_title`}),` tool on this tab.`]})]}),_jsxs(Step,{title:`Verify the connection from your MCP client`,children:[_jsx(_components.p,{children:`In your MCP client, the relay exposes management tools. Ask the agent:`}),_jsxs(_components.blockquote,{children:[`\n`,_jsx(_components.p,{children:`List the connected WebMCP sources.`}),`\n`]}),_jsxs(_components.p,{children:[`The agent calls `,_jsx(_components.code,{children:`webmcp_list_sources`}),`, which returns something like:`]}),_jsx(CodeBlock,{filename:`Source inventory`,numberOfLines:`15`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`15`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"count\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"sources\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"sourceId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"abc123\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"tabId\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"relay-demo\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"origin\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"http://localhost:3000\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"http://localhost:3000/relay-demo.html\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"title\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Relay Demo Page\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"connectedAt\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1785686400000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"lastSeenAt\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1785686401000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"toolCount\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(_components.p,{children:`Your browser tab is connected.`})]}),_jsxs(Step,{title:`Call the tool from the agent`,children:[_jsx(_components.p,{children:`Ask the agent:`}),_jsxs(_components.blockquote,{children:[`\n`,_jsx(_components.p,{children:`What is the title of the connected web page?`}),`\n`]}),_jsxs(_components.p,{children:[`The agent calls the `,_jsx(_components.code,{children:`get_page_title`}),` tool and returns:`]}),_jsx(CodeBlock,{filename:`Expected response`,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Relay Demo Page`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),_jsx(_components.p,{children:`You have called a browser-side tool from a desktop AI agent through the local relay.`})]}),_jsxs(Step,{title:`Try with a live website`,children:[_jsxs(_components.p,{children:[`Open `,_jsx(_components.a,{href:`https://webmcp.sh`,children:`webmcp.sh`}),` in a separate tab. It has WebMCP tools for navigation, SQL queries, entity management, and more. Ask the agent to list sources again. You will see tools from both tabs. The relay aggregates tools from all connected pages.`]}),_jsx(Frame,{caption:`webmcp.sh dashboard: a production app with WebMCP tools the relay can discover`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/mcp-b/TkOh_I05YhX4--64/images/webmcp-sh-dashboard.png?fit=max\u0026auto=format\u0026n=TkOh_I05YhX4--64\u0026q=85\u0026s=3a8c729f3776558179f8c9197528fa64`,alt:`webmcp.sh dashboard showing memory stats, charts, and audit log`,\"data-og-width\":`3024`,width:`3024`,\"data-og-height\":`1488`,height:`1488`,\"data-path\":`images/webmcp-sh-dashboard.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/mcp-b/TkOh_I05YhX4--64/images/webmcp-sh-dashboard.png?w=280\u0026fit=max\u0026auto=format\u0026n=TkOh_I05YhX4--64\u0026q=85\u0026s=34f8bc276e3579515aa0eff454a9ac4f 280w, https://mintcdn.com/mcp-b/TkOh_I05YhX4--64/images/webmcp-sh-dashboard.png?w=560\u0026fit=max\u0026auto=format\u0026n=TkOh_I05YhX4--64\u0026q=85\u0026s=1b7672f56f364d2a1bc1530374ee1c69 560w, https://mintcdn.com/mcp-b/TkOh_I05YhX4--64/images/webmcp-sh-dashboard.png?w=840\u0026fit=max\u0026auto=format\u0026n=TkOh_I05YhX4--64\u0026q=85\u0026s=9496ffc493c80cafa5763f101533e9f8 840w, https://mintcdn.com/mcp-b/TkOh_I05YhX4--64/images/webmcp-sh-dashboard.png?w=1100\u0026fit=max\u0026auto=format\u0026n=TkOh_I05YhX4--64\u0026q=85\u0026s=aafe563203ac5dd3c0dd9dc4f584a52c 1100w, https://mintcdn.com/mcp-b/TkOh_I05YhX4--64/images/webmcp-sh-dashboard.png?w=1650\u0026fit=max\u0026auto=format\u0026n=TkOh_I05YhX4--64\u0026q=85\u0026s=aee8098b95a2707a7b4eb105699ad758 1650w, https://mintcdn.com/mcp-b/TkOh_I05YhX4--64/images/webmcp-sh-dashboard.png?w=2500\u0026fit=max\u0026auto=format\u0026n=TkOh_I05YhX4--64\u0026q=85\u0026s=2f120047d40b82201e838e691bdaee7f 2500w`})})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`what-you-learned`,children:`What you learned`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`The local relay bridges browser WebMCP tools to desktop MCP clients over WebSocket and stdio`}),`\n`,_jsxs(_components.li,{children:[`Adding `,_jsx(_components.code,{children:`embed.js`}),` to a page connects that page’s tools to the relay`]}),`\n`,_jsxs(_components.li,{children:[`The relay exposes management tools (`,_jsx(_components.code,{children:`webmcp_list_sources`}),`, `,_jsx(_components.code,{children:`webmcp_list_tools`}),`) alongside the dynamic browser tools`]}),`\n`,_jsx(_components.li,{children:`Multiple browser tabs can connect simultaneously, and the relay aggregates their tools`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`next-steps`,children:`Next steps`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`See the `,_jsxs(_components.a,{href:`/packages/webmcp-local-relay/reference`,children:[_jsx(_components.code,{children:`webmcp-local-relay`}),` reference`]}),` for CLI options, security settings, and architecture details`]}),`\n`,_jsxs(_components.li,{children:[`Read `,_jsx(_components.a,{href:`/how-to/connect-desktop-agents-with-local-relay`,children:`Connect Desktop Agents with Local Relay`}),` for production configuration (origin restrictions, custom ports)`]}),`\n`,_jsxs(_components.li,{children:[`Try `,_jsx(_components.a,{href:`/tutorials/first-tool`,children:`Build Your First Tool`}),` or `,_jsx(_components.a,{href:`/tutorials/first-react-tool`,children:`Build Your First React Tool`}),` if you have not yet created your own tools`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Connect a desktop agent with the relay","description":"Set up one web page, one local relay, and one MCP client so a desktop AI agent can call tools on your page.","keywords":["webmcp-local-relay","desktop agent","claude desktop","cursor","websocket","mcp client","stdio","bridge"],"icon":"plug","href":"/tutorials/desktop-agent-relay"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Prerequisites","slug":"prerequisites","depth":2,"children":[]},{"title":"What we will build","slug":"what-we-will-build","depth":2,"children":[]},{"title":"What you learned","slug":"what-you-learned","depth":2,"children":[]},{"title":"Next steps","slug":"next-steps","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/mcp-b/24c5a0a208d74f30/inject-nav-logo-label.js","/_mintlify/custom/mcp-b/a6874b79f1fb0124/load-webmcp.js"],"subdomain":"mcp-b","siteName":"WebMCP Documentation","title":"Connect a desktop agent with the relay - WebMCP Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-01T01:03:28.604Z","originalFileLocation":"tutorials/desktop-agent-relay.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Set up one web page, one local relay, and one MCP client so a desktop AI agent can call tools on your page.\">\u003cmeta data-mint-head name=\"keywords\" content=\"MCP, Model Context Protocol, WebMCP, AI agents, web tools, browser extension, tab transport, JavaScript SDK\">\u003cmeta data-mint-head name=\"application-name\" content=\"WebMCP Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003cmeta data-mint-head name=\"robots\" content=\"index, follow\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/mcp-b/9efgeLqLgoVATM2T/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/mcp-b/9efgeLqLgoVATM2T/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/mcp-b/9efgeLqLgoVATM2T/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/mcp-b/9efgeLqLgoVATM2T/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/mcp-b/9efgeLqLgoVATM2T/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/mcp-b/9efgeLqLgoVATM2T/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/mcp-b/9efgeLqLgoVATM2T/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/mcp-b/9efgeLqLgoVATM2T/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/mcp-b/9efgeLqLgoVATM2T/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Connect a desktop agent with the relay - WebMCP Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Set up one web page, one local relay, and one MCP client so a desktop AI agent can call tools on your page.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"WebMCP Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.mcp-b.ai/tutorials/desktop-agent-relay\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://docs.mcp-b.ai/logo/mcp-b-logo.png\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Connect a desktop agent with the relay - WebMCP Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Set up one web page, one local relay, and one MCP client so a desktop AI agent can call tools on your page.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://docs.mcp-b.ai/logo/mcp-b-logo.png\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/mcp-b/9efgeLqLgoVATM2T/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"WebMCP Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#005F8F\">\u003cmeta data-mint-head name=\"og:locale\" content=\"en_US\">\u003cmeta data-mint-head name=\"author\" content=\"WebMCP Team\">\u003cmeta data-mint-head name=\"googlebot\" content=\"index, follow\">\u003cmeta data-mint-head name=\"twitter:creator\" content=\"@webmcp\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.mcp-b.ai/tutorials/desktop-agent-relay\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/tutorials/desktop-agent-relay.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.mcp-b.ai/#organization\",\"name\":\"WebMCP Documentation\",\"url\":\"https://docs.mcp-b.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/mcp-b/ubXGdMz3VU92HGBa/logo/mcp-b-logo.png?fit=max\u0026auto=format\u0026n=ubXGdMz3VU92HGBa\u0026q=85\u0026s=bfd4f881cd73802f2c5482dcfed9fd72\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.mcp-b.ai#website\",\"name\":\"WebMCP Documentation\",\"url\":\"https://docs.mcp-b.ai\",\"publisher\":{\"@id\":\"https://docs.mcp-b.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.mcp-b.ai/tutorials/desktop-agent-relay#webpage\",\"url\":\"https://docs.mcp-b.ai/tutorials/desktop-agent-relay\",\"name\":\"Connect a desktop agent with the relay\",\"description\":\"Set up one web page, one local relay, and one MCP client so a desktop AI agent can call tools on your page.\",\"dateModified\":\"2026-10-01T01:03:28.604Z\",\"isPartOf\":{\"@id\":\"https://docs.mcp-b.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.mcp-b.ai/tutorials/desktop-agent-relay#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.mcp-b.ai/tutorials/desktop-agent-relay#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Tutorials\",\"item\":\"https://docs.mcp-b.ai/tutorials\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Connect a desktop agent with the relay\",\"item\":\"https://docs.mcp-b.ai/tutorials/desktop-agent-relay\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.mcp-b.ai/tutorials/desktop-agent-relay#article\",\"headline\":\"Connect a desktop agent with the relay\",\"name\":\"Connect a desktop agent with the relay\",\"description\":\"Set up one web page, one local relay, and one MCP client so a desktop AI agent can call tools on your page.\",\"url\":\"https://docs.mcp-b.ai/tutorials/desktop-agent-relay\",\"mainEntityOfPage\":{\"@id\":\"https://docs.mcp-b.ai/tutorials/desktop-agent-relay#webpage\"},\"image\":\"https://docs.mcp-b.ai/logo/mcp-b-logo.png\",\"dateModified\":\"2026-10-01T01:03:28.604Z\",\"keywords\":\"webmcp-local-relay, desktop agent, claude desktop, cursor, websocket, mcp client, stdio, bridge\",\"publisher\":{\"@id\":\"https://docs.mcp-b.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.mcp-b.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"WebMCP Documentation\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"WebMCP Documentation\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/tutorials/desktop-agent-relay.md","siteName":"WebMCP Documentation","nav":{"global":{"anchors":[{"anchor":"Live Demo","icon":"play","href":"https://webmcp.sh"},{"anchor":"Examples","icon":"code","href":"https://github.com/WebMCP-org/examples"},{"anchor":"Community Group Draft","icon":"book","href":"https://webmachinelearning.github.io/webmcp/"}]},"tabs":[{"tab":"Home","icon":"house","pages":[{"title":"Home","href":""}]},{"tab":"Packages","icon":"boxes-stacked","pages":[{"title":"Packages","href":"/packages"}]},{"tab":"Tutorials","icon":"graduation-cap","groups":[{"group":"Tutorials","pages":[{"title":"Tutorials","icon":"graduation-cap","href":"/tutorials"},{"title":"Build your first tool","icon":"wrench","href":"/tutorials/first-tool"},{"title":"Build your first React tool","description":"Register a WebMCP tool from a React component using the useWebMCP hook, and verify it from the browser console.","icon":"react","href":"/tutorials/first-react-tool"},{"title":"Connect a desktop agent with the relay","icon":"plug","href":"/tutorials/desktop-agent-relay"}]}]},{"tab":"How-To Guides","icon":"compass-drafting","pages":[{"title":"How-To Guides","href":"/how-to"}]},{"tab":"Explanation","icon":"lightbulb","pages":[{"title":"Explanation","href":"/explanation"}]}]},"basePath":"","title":"Connect a desktop agent with the relay - WebMCP Documentation","buildId":"dpl_596ePT575z4qnAFksq1biRW97aLY","deploymentId":"dpl_596ePT575z4qnAFksq1biRW97aLY","dynamics":["10e4515597","07c022d89b","a74be98ba7"],"chunks":["BannerMarkdown-6DXXLlfN.js","dist-CmKHfscc.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-C3kuh_dz.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","Frame-BXrZabKK.js","DynamicMarkdown-CtasenyM.js","zoom-image-lightbox-C5F0mVLH.js","lightbox-handle-r17bVUz3.js"]}