Skip to content

Commit c800b34

Browse files
committed
format
1 parent fb6e772 commit c800b34

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This repo provides:
3030

3131
What this repo does NOT provide:
3232

33-
- There's no *supported* host implementation in this repo (beyond the [examples/simple-host](./examples/simple-host) example)
33+
- There's no _supported_ host implementation in this repo (beyond the [examples/simple-host](./examples/simple-host) example)
3434
- 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.
3535

3636
## Using the SDK
@@ -70,8 +70,7 @@ Your `package.json` will then look like:
7070
}
7171
```
7272

73-
### Build tools in dependencies
74-
75-
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.
76-
77-
Once the package is published to npm with pre-built `dist/`, these can be moved back to `devDependencies`.
73+
> [!NOTE]
74+
> 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.
75+
>
76+
> Once the package is published to npm with pre-built `dist/`, these can be moved back to `devDependencies`.

examples/simple-host/src/AppRenderer.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,7 @@ export interface AppRendererProps {
9595
* @param props - Component props
9696
* @returns React element containing the sandboxed tool UI iframe
9797
*/
98-
export const AppRenderer = (
99-
props: AppRendererProps,
100-
) => {
98+
export const AppRenderer = (props: AppRendererProps) => {
10199
const {
102100
client,
103101
sandboxProxyUrl,

examples/simple-host/src/example-host-react.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
55
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
66
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
77
import { Tool } from "@modelcontextprotocol/sdk/types.js";
8-
import { AppRenderer,AppRendererProps } from "../src/AppRenderer";
8+
import { AppRenderer, AppRendererProps } from "../src/AppRenderer";
99
import { AppBridge } from "../../../dist/src/app-bridge";
1010

1111
const SANDBOX_PROXY_URL = URL.parse("/sandbox.html", location.href)!;
@@ -94,16 +94,24 @@ function ExampleApp() {
9494
setActiveTools((prev) => prev.filter((t) => t.id !== id));
9595
};
9696

97-
const handleMessage: AppRendererProps["onmessage"] = async (params, _extra) => {
97+
const handleMessage: AppRendererProps["onmessage"] = async (
98+
params,
99+
_extra,
100+
) => {
98101
console.log("[React Host] Message:", params);
99102
return {};
100103
};
101104

102-
const handleLoggingMessage: AppRendererProps["onloggingmessage"] = (params) => {
105+
const handleLoggingMessage: AppRendererProps["onloggingmessage"] = (
106+
params,
107+
) => {
103108
console.log("[React Host] Logging message:", params);
104109
};
105110

106-
const handleOpenLink: AppRendererProps["onopenlink"] = async (params, _extra) => {
111+
const handleOpenLink: AppRendererProps["onopenlink"] = async (
112+
params,
113+
_extra,
114+
) => {
107115
console.log("[React Host] Open link request:", params);
108116
window.open(params.url, "_blank", "noopener,noreferrer");
109117
return { isError: false };

examples/simple-host/src/example-host-vanilla.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ window.addEventListener("load", async () => {
8787
appBridge.sendToolInput({ arguments: toolInput });
8888
};
8989

90-
appBridge.onopenlink = async ({url}) => {
90+
appBridge.onopenlink = async ({ url }) => {
9191
console.log("[Example] Open link requested:", url);
9292
window.open(url, "_blank", "noopener,noreferrer");
93-
return {isError: false};
93+
return { isError: false };
9494
};
9595

9696
appBridge.onmessage = async (params) => {
9797
console.log("[Example] Message requested:", params);
98-
return {isError: false};
98+
return { isError: false };
9999
};
100100

101101
// Handle size changes by resizing the iframe
@@ -108,7 +108,7 @@ window.addEventListener("load", async () => {
108108
}
109109
};
110110

111-
appBridge.onloggingmessage = async params => {
111+
appBridge.onloggingmessage = async (params) => {
112112
console.log("[Tool UI Log]", params);
113113
};
114114

0 commit comments

Comments
 (0)