Skip to content
webtypPublic

About

Registers in the browser's WebMCP (document.modelContext) the AI-agent tools of the screen the person has open, and lets an in-page agent read and run them

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

Repository files navigation

webmcp

While a screen is open, offers an AI agent the tools of the entities that screen shows and the app opened (appkit.App.OpenToAgents): it registers them in the browser's WebMCP (document.modelContext) and withdraws them when the person leaves. A browser agent finds them there; an agent inside the page reads them with Available ([]llm.ToolDef, what agent.ToolSource asks for) and runs them with Run. Every call goes through the session's caller, so it carries the person's own permissions. A tool answers in MCP's result shape, {content: [{type: "text", text}], isError}: a refusal («which one?», «no permission») resolves with isError: true and its reason, so the agent reads why. Browser only.

// web/browser/main.go
agentTools, err := webmcp.New(screens.Browser.Caller, config.App) // fails at startup if the app opens something it cannot
tools := devtools.Menu()
tools.ScreenWatchers = []view.ScreenWatcher{agentTools}        // layout/app tells it each screen shown
browser.Run(config.App, screens.Browser, layoutapp.New(tools))

Removing those lines leaves nothing of it in the bundle.

Tool WebMCP
name, description, input schema from webtyp.com/agenttools (flat arguments, names not ids)
annotations.readOnlyHint the action is Read
annotations.consequentialHint the action is in the entity's AgentAsksFirst

When the browser has no WebMCP, the page loads the pinned @w3c/webmcp-polyfill 0.2.1 (assets/webmcp-polyfill.js, Apache-2.0, emitted by sitec as /webmcp-polyfill.js). Outside https or localhost nothing is offered and the console says so; the screens work as usual.

Tests

About

Registers in the browser's WebMCP (document.modelContext) the AI-agent tools of the screen the person has open, and lets an in-page agent read and run them

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages