From c800b34635241af22254c533248b307100b3d078 Mon Sep 17 00:00:00 2001 From: Olivier Chafik Date: Mon, 24 Nov 2025 17:27:06 +0000 Subject: [PATCH] format --- README.md | 11 +++++------ examples/simple-host/src/AppRenderer.tsx | 4 +--- examples/simple-host/src/example-host-react.tsx | 16 ++++++++++++---- examples/simple-host/src/example-host-vanilla.ts | 8 ++++---- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 880a623..a72babe 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ This repo provides: What this repo does NOT provide: -- There's no *supported* host implementation in this repo (beyond the [examples/simple-host](./examples/simple-host) example) +- There's no _supported_ host implementation in this repo (beyond the [examples/simple-host](./examples/simple-host) example) - We have [contributed a tentative implementation](https://github.com/MCP-UI-Org/mcp-ui/pull/147) of hosting / iframing / sandboxing logic to the [MCP-UI](https://github.com/idosal/mcp-ui) repository, and expect OSS clients may use it, while other clients might roll their own hosting logic. ## Using the SDK @@ -70,8 +70,7 @@ Your `package.json` will then look like: } ``` -### Build tools in dependencies - -The build tools (`esbuild`, `tsx`, `typescript`) are in `dependencies` rather than `devDependencies`. This is intentional: it allows the `prepare` script to run when the package is installed from git, since npm doesn't install devDependencies for git dependencies. - -Once the package is published to npm with pre-built `dist/`, these can be moved back to `devDependencies`. +> [!NOTE] +> The build tools (`esbuild`, `tsx`, `typescript`) are in `dependencies` rather than `devDependencies`. This is intentional: it allows the `prepare` script to run when the package is installed from git, since npm doesn't install devDependencies for git dependencies. +> +> Once the package is published to npm with pre-built `dist/`, these can be moved back to `devDependencies`. diff --git a/examples/simple-host/src/AppRenderer.tsx b/examples/simple-host/src/AppRenderer.tsx index 6b3a67b..6853977 100644 --- a/examples/simple-host/src/AppRenderer.tsx +++ b/examples/simple-host/src/AppRenderer.tsx @@ -95,9 +95,7 @@ export interface AppRendererProps { * @param props - Component props * @returns React element containing the sandboxed tool UI iframe */ -export const AppRenderer = ( - props: AppRendererProps, -) => { +export const AppRenderer = (props: AppRendererProps) => { const { client, sandboxProxyUrl, diff --git a/examples/simple-host/src/example-host-react.tsx b/examples/simple-host/src/example-host-react.tsx index 8ab0d18..8bc7318 100644 --- a/examples/simple-host/src/example-host-react.tsx +++ b/examples/simple-host/src/example-host-react.tsx @@ -5,7 +5,7 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"; import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; import { Tool } from "@modelcontextprotocol/sdk/types.js"; -import { AppRenderer,AppRendererProps } from "../src/AppRenderer"; +import { AppRenderer, AppRendererProps } from "../src/AppRenderer"; import { AppBridge } from "../../../dist/src/app-bridge"; const SANDBOX_PROXY_URL = URL.parse("/sandbox.html", location.href)!; @@ -94,16 +94,24 @@ function ExampleApp() { setActiveTools((prev) => prev.filter((t) => t.id !== id)); }; - const handleMessage: AppRendererProps["onmessage"] = async (params, _extra) => { + const handleMessage: AppRendererProps["onmessage"] = async ( + params, + _extra, + ) => { console.log("[React Host] Message:", params); return {}; }; - const handleLoggingMessage: AppRendererProps["onloggingmessage"] = (params) => { + const handleLoggingMessage: AppRendererProps["onloggingmessage"] = ( + params, + ) => { console.log("[React Host] Logging message:", params); }; - const handleOpenLink: AppRendererProps["onopenlink"] = async (params, _extra) => { + const handleOpenLink: AppRendererProps["onopenlink"] = async ( + params, + _extra, + ) => { console.log("[React Host] Open link request:", params); window.open(params.url, "_blank", "noopener,noreferrer"); return { isError: false }; diff --git a/examples/simple-host/src/example-host-vanilla.ts b/examples/simple-host/src/example-host-vanilla.ts index ac427a2..9a304d2 100644 --- a/examples/simple-host/src/example-host-vanilla.ts +++ b/examples/simple-host/src/example-host-vanilla.ts @@ -87,15 +87,15 @@ window.addEventListener("load", async () => { appBridge.sendToolInput({ arguments: toolInput }); }; - appBridge.onopenlink = async ({url}) => { + appBridge.onopenlink = async ({ url }) => { console.log("[Example] Open link requested:", url); window.open(url, "_blank", "noopener,noreferrer"); - return {isError: false}; + return { isError: false }; }; appBridge.onmessage = async (params) => { console.log("[Example] Message requested:", params); - return {isError: false}; + return { isError: false }; }; // Handle size changes by resizing the iframe @@ -108,7 +108,7 @@ window.addEventListener("load", async () => { } }; - appBridge.onloggingmessage = async params => { + appBridge.onloggingmessage = async (params) => { console.log("[Tool UI Log]", params); };