Agent / foldkit-agent-webmcp

foldkit-agent-webmcp

Publishes a foldkit-agent runtime as browser-native WebMCP tools.

Use it when an agent runs inside the page and should operate the same live Foldkit application the person is using. This package does not define new agent capabilities and does not automate the DOM. It translates the capabilities your agent contract already exposes into document.modelContext tools.

Foldkit application
       |
       v
AssistantAgent              protocol-neutral contract
       |
       | AgentBuilder.bind(...)
       v
AgentRuntime                live Model + dispatch + policy
       |
       v
foldkit-agent-webmcp        adapter only
       |
       v
document.modelContext      browser tools
       |
       v
Message -> update -> Model + Commands

The authority boundary stays in foldkit-agent: the contract decides what the agent may observe and which Messages it may cause. WebMCP only makes those capabilities available to a browser-resident agent.

The adapter uses the WebMCP producer API when the host exposes it. Feature detect document.modelContext at runtime; tool registration is optional for browsers that do not provide it.

Install

bash
pnpm add foldkit-agent foldkit-agent-webmcp

foldkit, effect, and foldkit-agent are peer dependencies.