mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-02-10 23:33:08 +00:00
* feat: add MCP Apps with rich HTML UIs for tool results Add MCP Apps infrastructure that allows MCP hosts like Claude Desktop to render rich HTML UIs alongside tool results via `_meta.ui` and the MCP resources protocol. - Server-side UI module (src/mcp/ui/) with UIAppRegistry, tool-to-UI mapping, and _meta.ui injection into tool responses - React + Vite build pipeline (ui-apps/) producing self-contained HTML per app using vite-plugin-singlefile - Operation Result UI for workflow CRUD tools (create, update, delete, test, autofix, deploy) - Validation Summary UI for validation tools (validate_node, validate_workflow, n8n_validate_workflow) - Shared component library (Card, Badge, Expandable) with n8n dark theme - MCP resources protocol support (ListResources, ReadResource handlers) - Graceful degradation when ui-apps/dist/ is not built - 22 unit tests across 3 test files Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: improve MCP Apps test coverage and add security hardening - Expand test suite from 22 to 57 tests across 3 test files - Add UIAppRegistry.reset() for proper test isolation between tests - Replace some fs mocks with real temp directory tests in registry - Add edge case coverage: empty strings, pre-load state, double load, malformed URIs, duplicate tool patterns, empty HTML files - Add regression tests for specific tool-to-UI mappings - Add URI format consistency validation across all configs - Improve _meta.ui injection tests with structuredContent coexistence - Coverage: statements 79.4% -> 80%, lines 79.4% -> 80% Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: align MCP Apps with official ext-apps spec Update URI scheme from n8n-mcp://ui/ to ui://n8n-mcp/ per MCP spec. Move _meta.ui.resourceUri to tool definitions (tools/list) instead of tool call responses. Rewrite UI apps hook to use @modelcontextprotocol/ext-apps App class instead of window.__MCP_DATA__. Conceived by Romuald Czlonkowski - https://www.aiadvisors.pl/en Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
69 lines
1.8 KiB
TypeScript
69 lines
1.8 KiB
TypeScript
// Export n8n node type definitions and utilities
|
|
export * from './node-types';
|
|
export * from './type-structures';
|
|
export * from './instance-context';
|
|
export * from './session-state';
|
|
|
|
export interface MCPServerConfig {
|
|
port: number;
|
|
host: string;
|
|
authToken?: string;
|
|
}
|
|
|
|
/**
|
|
* MCP Tool annotations to help AI assistants understand tool behavior.
|
|
* Per MCP spec: https://spec.modelcontextprotocol.io/specification/2025-03-26/server/tools/#annotations
|
|
*/
|
|
export interface ToolAnnotations {
|
|
/** Human-readable title for the tool */
|
|
title?: string;
|
|
/** If true, the tool does not modify its environment */
|
|
readOnlyHint?: boolean;
|
|
/** If true, the tool may perform destructive updates to its environment */
|
|
destructiveHint?: boolean;
|
|
/** If true, calling the tool repeatedly with the same arguments has no additional effect */
|
|
idempotentHint?: boolean;
|
|
/** If true, the tool may interact with external entities (APIs, services) */
|
|
openWorldHint?: boolean;
|
|
}
|
|
|
|
export interface ToolDefinition {
|
|
name: string;
|
|
description: string;
|
|
inputSchema: {
|
|
type: string;
|
|
properties: Record<string, any>;
|
|
required?: string[];
|
|
additionalProperties?: boolean | Record<string, any>;
|
|
};
|
|
outputSchema?: {
|
|
type: string;
|
|
properties: Record<string, any>;
|
|
required?: string[];
|
|
additionalProperties?: boolean | Record<string, any>;
|
|
};
|
|
/** Tool behavior hints for AI assistants */
|
|
annotations?: ToolAnnotations;
|
|
_meta?: {
|
|
ui?: {
|
|
resourceUri?: string;
|
|
};
|
|
};
|
|
}
|
|
|
|
export interface ResourceDefinition {
|
|
uri: string;
|
|
name: string;
|
|
description?: string;
|
|
mimeType?: string;
|
|
}
|
|
|
|
export interface PromptDefinition {
|
|
name: string;
|
|
description?: string;
|
|
arguments?: Array<{
|
|
name: string;
|
|
description?: string;
|
|
required?: boolean;
|
|
}>;
|
|
} |