
Research
/Security News
CanisterWorm: npm Publisher Compromise Deploys Backdoor Across 29+ Packages
The worm-enabled campaign hit @emilgroup and @teale.io, then used an ICP canister to deliver follow-on payloads.
@mcp-apps-kit/ui
Advanced tools
Client-side SDK for MCP applications (vanilla JavaScript).
Use this inside the HTML/JS UI returned by your tools. The SDK auto-detects the host (MCP Apps or ChatGPT Apps) and exposes a unified client for tool calls and host context.
Widget UIs run inside host environments with different APIs and capabilities. This package normalizes those differences so your UI code can call tools, read results, and respond to host context changes from a single API. For React apps, use @mcp-apps-kit/ui-react.
createClient() with host auto-detection>= 18 for tooling/builds (browser runtime)@modelcontextprotocol/ext-appsnpm install @mcp-apps-kit/ui
import { createClient } from "@mcp-apps-kit/ui";
const client = await createClient();
await client.callTool("greet", { name: "Alice" });
client.onHostContextChange((ctx) => {
document.documentElement.dataset.theme = ctx.theme;
});
import { createClient } from "@mcp-apps-kit/ui";
import type { AppClientTools } from "../server";
const client = await createClient<AppClientTools>();
// Option 1: Using callTool with tool name string
await client.callTool("search_restaurants", { location: "Paris" });
// Option 2: Using the typed tools proxy (recommended)
await client.tools.callSearchRestaurants({ location: "Paris" });
The tools property provides a typed proxy with methods like callGreet(), callSearchRestaurants(), etc. Method names are generated from tool names by prepending "call" and capitalizing the first letter.
import { createClient } from "@mcp-apps-kit/ui";
const client = await createClient({ forceAdapter: "mock" });
Send structured logs from the UI to the server via MCP:
import { clientDebugLogger } from "@mcp-apps-kit/ui";
clientDebugLogger.configure({
enabled: true,
level: "debug",
source: "my-widget",
});
clientDebugLogger.info("Component mounted", { props: "..." });
Server-side configuration:
const app = createApp({
config: {
debug: {
logTool: true,
level: "debug",
},
},
});
../../examples/minimalcreateClient(options?) - Create a connected client with auto-detectiondetectProtocol() - Detect the host platform ("mcp" | "openai" | "mock")The client.tools property provides typed method wrappers for tool calls:
import type { AppClientTools } from "../server";
const client = await createClient<AppClientTools>();
// Tool name "greet" becomes method "callGreet"
const result = await client.tools.callGreet({ name: "Alice" });
// Tool name "searchRestaurants" becomes "callSearchRestaurants"
const restaurants = await client.tools.callSearchRestaurants({ location: "Paris" });
This is equivalent to client.callTool("greet", { name: "Alice" }) but provides better IDE autocomplete and type checking.
const capabilities = client.getHostCapabilities();
// Common capabilities (both platforms)
capabilities?.theming?.themes; // ["light", "dark"]
capabilities?.displayModes?.modes; // ["inline", "fullscreen", "pip"]
capabilities?.statePersistence?.persistent; // boolean
capabilities?.openLinks; // {} if supported
capabilities?.logging; // {} if supported
// MCP Apps specific
capabilities?.serverTools?.listChanged; // boolean
capabilities?.serverResources?.listChanged; // boolean
capabilities?.sizeNotifications; // {} if supported
capabilities?.partialToolInput; // {} if supported
// ChatGPT specific
capabilities?.fileUpload; // {} if supported
capabilities?.safeAreaInsets; // {} if supported
capabilities?.views; // {} if supported
const version = client.getHostVersion();
// { name: "Claude Desktop", version: "1.0.0" } (MCP Apps only)
import {
applyDocumentTheme,
getDocumentTheme,
applyHostStyleVariables,
applyHostFonts,
removeHostFonts,
clearHostStyleVariables,
} from "@mcp-apps-kit/ui";
// Apply theme to document
applyDocumentTheme("dark"); // or "light" or "os"
// Apply host-provided CSS variables
applyHostStyleVariables({
"primary-color": "#007bff",
"--font-size": "16px",
});
// Apply host-provided font CSS
applyHostFonts("@font-face { ... }");
// Register a handler for host-initiated tool calls
client.setCallToolHandler(async (toolName, args) => {
if (toolName === "get_selection") {
return { selection: document.getSelection()?.toString() };
}
throw new Error(`Unknown tool: ${toolName}`);
});
// Register a handler for listing available tools
client.setListToolsHandler(async () => [
{ name: "get_selection", description: "Get current text selection" },
]);
// Send logs via the MCP protocol (appears in host logs)
await client.sendLog("info", { event: "user_action", details: "..." });
import { UIError, UIErrorCode } from "@mcp-apps-kit/ui";
try {
await client.callTool("unknown");
} catch (error) {
if (error instanceof UIError) {
console.error(error.code, error.message);
}
}
HostContext - Theme, viewport, locale, display mode, etc.HostCapabilities - Protocol-agnostic capability interfaceHostVersion - Host application name and versionAppsClient - Main client interfaceUIError, UIErrorCode - Client-side error typesSee ../../CONTRIBUTING.md for development setup and guidelines. Issues and pull requests are welcome.
MIT
FAQs
Client-side SDK for MCP applications (vanilla JavaScript)
The npm package @mcp-apps-kit/ui receives a total of 27 weekly downloads. As such, @mcp-apps-kit/ui popularity was classified as not popular.
We found that @mcp-apps-kit/ui demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
The worm-enabled campaign hit @emilgroup and @teale.io, then used an ICP canister to deliver follow-on payloads.

Research
/Security News
Attackers compromised Trivy GitHub Actions by force-updating tags to deliver malware, exposing CI/CD secrets across affected pipelines.

Security News
ENISA’s new package manager advisory outlines the dependency security practices companies will need to demonstrate as the EU’s Cyber Resilience Act begins enforcing software supply chain requirements.