@mcp-ui/server Overview
The @mcp-ui/server
package provides server-side utilities to help construct UIResource
objects, which can then be sent to a client as part of an MCP response.
Key Exports
createUIResource(options: CreateUIResourceOptions): UIResource
: The primary function for creating UI snippets. It takes an options object to define the URI, content (direct HTML or external URL), and delivery method (text or blob).
Purpose
- Ease of Use: Simplifies the creation of valid
UIResource
objects. - Validation: Includes basic validation (e.g., URI prefixes matching content type).
- Encoding: Handles Base64 encoding when
delivery: 'blob'
is specified.
Building
This package is built using Vite in library mode, targeting Node.js environments. It outputs ESM (.mjs
) and CJS (.js
) formats, along with TypeScript declaration files (.d.ts
).
To build specifically this package from the monorepo root:
bash
pnpm build --filter @mcp-ui/server
1
See the Server SDK Usage & Examples page for practical examples.