aui-mcp-server
v0.0.6
Published
AUI-X: generate MCP assets from aui-x-catalog.json
Maintainers
Readme
aui-mcp-server
Automatically generates the AUI-X Catalog and MCP server assets during an MF Remote build.
- Input:
dist/mf-stats.json+dist/@mf-types/compiled-types/*.d.ts - Default output:
dist/aui-x-catalog.jsondist/mcp/manifest.jsondist/mcp/server.mjs
Note: the generated MCP server only exposes component metadata (including
x-loader). Actual MF import/rendering should be done by the AUI-X runtime on the client side.
CLI
Install in an MF Remote project:
pnpm add -D aui-mcp-serverGenerate aui-x-catalog.json (from mf-stats.json):
pnpm exec aui-mcp catalog ./dist/mf-stats.json -o ./aui-x-catalog.jsonGenerate MCP assets (from aui-x-catalog.json):
pnpm exec aui-mcp generate --catalog ./aui-x-catalog.json --outDir distServe locally (SSE example):
pnpm exec aui-mcp serve \
--manifest ./dist/mcp/manifest.json \
--transport sse \
--port 8001 \
--watchBuild Plugin (recommended)
Rspack / Webpack
Place this plugin after the MF plugin (so mf-stats.json already exists in compilation assets).
import { AuiMcpRspackPlugin } from 'aui-mcp-server/rspack';
export default {
plugins: [
// ModuleFederationPlugin / pluginModuleFederation(...) etc.
new AuiMcpRspackPlugin({
transport: 'sse',
port: 8001,
}),
],
};In dev mode (watch or mode=development), it automatically starts the MCP server. Generation failures are reported as warnings and will not fail the build.
Rsbuild
import { defineConfig } from '@rsbuild/core';
import { auiMcpRsbuildPlugin } from 'aui-mcp-server/rsbuild';
export default defineConfig({
plugins: [
auiMcpRsbuildPlugin({
transport: 'sse',
port: 8001,
}),
],
});Verify
npx @modelcontextprotocol/inspector node dist/mcp/server.mjsReact SDK Entry: aui-mcp-server/react
Install dependencies (example):
pnpm add aui-mcp-server @a2ui/react react react-dom @module-federation/enhancedIn a React host app:
import {
performHandshake,
createMFRegistry,
syncRegistryFromCatalog,
registerMFComponent,
useA2UIStream,
createLogger,
useLogger,
type XLoaderConfig,
type ChatMessage,
type A2UIStreamOptions,
type CreateLoggerOptions,
} from 'aui-mcp-server/react';Core capabilities:
performHandshake(agentUrl): fetches A2A AgentCard, parsesinlineCatalogs, and callssyncRegistryFromCatalogto registerx-loadercomponents as Module Federation remotes.createMFRegistry(options?): creates/returns aComponentRegistryinstance. Sharesreact/react-dom/@a2ui/reactas singletons by default; supportsoptions.sharedfor extra shared deps andoptions.exposeGlobalto exposewindow.__AUI_REGISTRY__.syncRegistryFromCatalog(registry, catalog): registers allx-loaderentries from a Catalog into a registry.registerMFComponent(registry, componentType, xLoader): registers a single MF component on demand, falling back to an inlineErrorPlaceholderon failure.useA2UIStream(options?): wraps A2A JSON-RPC 2.0 + SSE streaming. Returns{ messages, isLoading, sendMessage, processLocalMessages }.options.agentUrldefaults to/apiand supportsdefaultIsActionPayloadmode.createLogger(options?)/useLogger(options?): unified frontend logging + remote reporting.options.endpointdefaults to/api/log;options.hijackConsolecontrols whetherconsole.*is hijacked.
All SDK types (e.g. XLoaderConfig, ChatMessage, A2UIStreamOptions, CreateLoggerOptions) are also exported from aui-mcp-server/react to keep host apps fully type-safe.
