Releases: apollographql/mcp-impostor-host
Release list
v0.3.0
Minor Changes
-
#34
d7e0286Thanks @jerelmiller! - Add support for configuring and dynamically updating host context.<Sandbox />manageshostContextProvide host context to the
hostContextprop. The initial host context is sent to the view as a response to itsui/initializenotification. Subsequent updates are sent to the view via aui/notifications/host-context-changednotification.useHostContexthookA new
useHostContexthook is available from@apollo/mcp-impostor-host/react. It provides sensible browser defaults forplatform,theme,locale, andtimeZone, and returns a shallow-merge setter for updates.import { Sandbox, useHostContext } from "@apollo/mcp-impostor-host/react"; function MyTestPage({ connection, execution }) { const [hostContext, setHostContext] = useHostContext({ theme: "dark" }); return ( <> <button onClick={() => setHostContext({ theme: "light" })}> Switch to light mode </button> <Sandbox connection={connection} execution={execution} hostContext={hostContext} url="http://localhost:8080/sandbox.html" /> </> ); }
Playwright fixture
Use
mcpHost.setHostContextto configure host context in your Playwright tests. Call it beforeconnection.callToolto set the initial host context, which is sent to the view as a response to itsui/initializenotification. CallmcpHost.setHostContextafterconnection.callToolto notify the view of updates to the host context via aui/notifications/host-context-changednotification.import { test } from "@apollo/mcp-impostor-host/playwright"; import { expect } from "@playwright/test"; test("app responds to theme changes", async ({ mcpHost }) => { // Set initial host context before connecting await mcpHost.setHostContext({ theme: "dark" }); const connection = await mcpHost.connect({ url: "http://localhost:3000/mcp", }); const { appFrame } = await connection.callTool("my-tool", {}); await expect(appFrame.locator("#theme")).toHaveText("dark"); // Dynamically update host context. Sends a ui/notifications/host-context-changed notification await mcpHost.setHostContext({ theme: "light" }); await expect(appFrame.locator("#theme")).toHaveText("light"); });
Potentially breaking change
The
<Sandbox />component'sconnectionandexecutionprops are now non-nullable. If you were passingnullfor either of these, conditionally render<Sandbox />instead:// Before <Sandbox connection={connection} execution={execution} url={url} />; // After connection && execution && ( <Sandbox connection={connection} execution={execution} url={url} /> );
Patch Changes
- #37
a58ccd0Thanks @jerelmiller! - Remove@mcp-ui/clientas a dependency as it is no longer required.
v0.2.1
Patch Changes
- #30
eef87a3Thanks @jerelmiller! - Add a README with installation and usage instructions.
v0.2.0
Minor Changes
-
#27
ca10cd4Thanks @jerelmiller! - Add support for message requests and open link requests. Adds the ability to assert on these in playwright.import { test } from "@apollo/mcp-impostor-host/playwright"; test("gets a message request", async ({ mcpHost }) => { // ... const message = await connection.waitForMessageRequest(); expect(message).toEqual({ role: "user", content: [{ type: "text", text: "Hello, world" }], }); }); test("gets a link request", async ({ mcpHost }) => { // ... const link = await connection.waitForOpenLinkRequest(); expect(link).toEqual({ url: "https://example.com" }); });
v0.1.0
Minor Changes
- #22
57e56a4Thanks @jerelmiller! - Initial release