@elementor/editor-mcp 4.1.0-789 → 4.1.0-790
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +55 -10
- package/dist/index.d.ts +55 -10
- package/dist/index.js +301 -90
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +295 -88
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/adapters/angie-adapter.ts +60 -0
- package/src/adapters/types.ts +48 -0
- package/src/adapters/web-mcp-adapter.ts +143 -0
- package/src/index.ts +2 -1
- package/src/init.ts +18 -22
- package/src/mcp-registry.ts +92 -57
- package/src/test-utils/mock-mcp-registry.ts +0 -3
- package/src/utils/get-active-chat-info.ts +19 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as _elementor_external_angie_sdk from '@elementor-external/angie-sdk';
|
|
2
|
-
import { AngieMcpSdk } from '@elementor-external/angie-sdk';
|
|
3
2
|
export { MessageEventType as AngieMessageEvenetType, getAngieIframe } from '@elementor-external/angie-sdk';
|
|
4
3
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
4
|
export { McpServer, RegisteredResource, ResourceTemplate, ToolCallback } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
@@ -8,12 +7,52 @@ export { SamplingMessageSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
|
8
7
|
import { z } from '@elementor/schema';
|
|
9
8
|
import { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
10
9
|
|
|
11
|
-
declare function init(): Promise<void>;
|
|
12
|
-
|
|
13
10
|
declare const isAngieAvailable: () => boolean;
|
|
14
11
|
|
|
15
12
|
declare const isAngieSidebarOpen: () => boolean;
|
|
16
13
|
|
|
14
|
+
type UriTemplate = {
|
|
15
|
+
toString: () => string;
|
|
16
|
+
match: (uri: string) => Record<string, string | string[]> | null;
|
|
17
|
+
};
|
|
18
|
+
type McpToolDescriptor = {
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
inputSchema: object;
|
|
22
|
+
execute: (params: Record<string, unknown>) => Promise<unknown>;
|
|
23
|
+
};
|
|
24
|
+
type McpResourceUriOrTemplate = string | {
|
|
25
|
+
uriTemplate: UriTemplate;
|
|
26
|
+
};
|
|
27
|
+
type McpResourceHandler = (uri: URL, variables: Record<string, string | string[]>) => Promise<{
|
|
28
|
+
contents: Array<{
|
|
29
|
+
text?: string;
|
|
30
|
+
}>;
|
|
31
|
+
}>;
|
|
32
|
+
interface IMcpRegistrationAdapter {
|
|
33
|
+
/**
|
|
34
|
+
* Called once at startup to activate the adapter's server registrations.
|
|
35
|
+
*/
|
|
36
|
+
activate: () => void | Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Called once per tool when addTool() is invoked.
|
|
39
|
+
*/
|
|
40
|
+
onToolRegistered: (tool: McpToolDescriptor, extraData?: {
|
|
41
|
+
resources: string[];
|
|
42
|
+
requiredResources: string[];
|
|
43
|
+
}) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Called once per resource when resource() is invoked.
|
|
46
|
+
*/
|
|
47
|
+
onResourceRegistered: (name: string, uriOrTemplate: McpResourceUriOrTemplate, handler: McpResourceHandler) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Called when a resource update notification should be sent.
|
|
50
|
+
*/
|
|
51
|
+
sendResourceUpdated: (params: {
|
|
52
|
+
uri: string;
|
|
53
|
+
}) => void | Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
|
|
17
56
|
declare const ANGIE_MODEL_PREFERENCES: "angie/modelPreferences";
|
|
18
57
|
interface AngieModelPreferences {
|
|
19
58
|
hints?: Array<{
|
|
@@ -24,8 +63,11 @@ interface AngieModelPreferences {
|
|
|
24
63
|
intelligencePriority?: number;
|
|
25
64
|
}
|
|
26
65
|
|
|
66
|
+
declare const registerMcpAdapter: (adapter: IMcpRegistrationAdapter) => void;
|
|
67
|
+
declare const signalMcpReady: () => void;
|
|
68
|
+
declare const activateAdapters: () => void;
|
|
27
69
|
declare const registerMcp: (mcp: McpServer, name: string) => void;
|
|
28
|
-
declare
|
|
70
|
+
declare const getRegisteredMcpServers: () => Array<[string, McpServer, string]>;
|
|
29
71
|
declare const toMCPTitle: (namespace: string) => string;
|
|
30
72
|
/**
|
|
31
73
|
*
|
|
@@ -39,13 +81,8 @@ declare const getMCPByDomain: (namespace: string, options?: {
|
|
|
39
81
|
interface MCPRegistryEntry {
|
|
40
82
|
addTool: <T extends undefined | z.ZodRawShape = undefined, O extends undefined | z.ZodRawShape = undefined>(opts: ToolRegistrationOptions<T, O>) => void;
|
|
41
83
|
setMCPDescription: (description: string) => void;
|
|
42
|
-
getActiveChatInfo: () => {
|
|
43
|
-
sessionId: string;
|
|
44
|
-
expiresAt: number;
|
|
45
|
-
};
|
|
46
84
|
sendResourceUpdated: McpServer['server']['sendResourceUpdated'];
|
|
47
85
|
resource: McpServer['registerResource'];
|
|
48
|
-
mcpServer: McpServer;
|
|
49
86
|
waitForReady: () => Promise<void>;
|
|
50
87
|
}
|
|
51
88
|
type ResourceList = {
|
|
@@ -333,6 +370,12 @@ declare class ToolPrompts {
|
|
|
333
370
|
}
|
|
334
371
|
declare const toolPrompts: (name: string) => ToolPrompts;
|
|
335
372
|
|
|
373
|
+
type ActiveChatInfo = {
|
|
374
|
+
sessionId: string;
|
|
375
|
+
expiresAt: number;
|
|
376
|
+
};
|
|
377
|
+
declare const getActiveChatInfo: () => ActiveChatInfo;
|
|
378
|
+
|
|
336
379
|
declare const sendPromptToAngie: (prompt?: string) => void;
|
|
337
380
|
|
|
338
381
|
declare const redirectToInstallation: (prompt: string) => void;
|
|
@@ -348,6 +391,8 @@ type InstallAngieResult = {
|
|
|
348
391
|
};
|
|
349
392
|
declare const installAngiePlugin: () => Promise<InstallAngieResult>;
|
|
350
393
|
|
|
394
|
+
declare function startMCPServer(): void;
|
|
395
|
+
|
|
351
396
|
declare const getAngieSdk: () => _elementor_external_angie_sdk.AngieMcpSdk;
|
|
352
397
|
|
|
353
|
-
export { ANGIE_MODEL_PREFERENCES, type AngieModelPreferences, type InstallAngieResult, type MCPRegistryEntry,
|
|
398
|
+
export { ANGIE_MODEL_PREFERENCES, type ActiveChatInfo, type AngieModelPreferences, type InstallAngieResult, type MCPRegistryEntry, activateAdapters, createSampler, getActiveChatInfo, getAngieSdk, getMCPByDomain, getRegisteredMcpServers, installAngiePlugin, isAngieAvailable, isAngieSidebarOpen, redirectToAppAdmin, redirectToInstallation, registerMcp, registerMcpAdapter, sendPromptToAngie, signalMcpReady, startMCPServer, toMCPTitle, toolPrompts };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as _elementor_external_angie_sdk from '@elementor-external/angie-sdk';
|
|
2
|
-
import { AngieMcpSdk } from '@elementor-external/angie-sdk';
|
|
3
2
|
export { MessageEventType as AngieMessageEvenetType, getAngieIframe } from '@elementor-external/angie-sdk';
|
|
4
3
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
4
|
export { McpServer, RegisteredResource, ResourceTemplate, ToolCallback } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
@@ -8,12 +7,52 @@ export { SamplingMessageSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
|
8
7
|
import { z } from '@elementor/schema';
|
|
9
8
|
import { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
10
9
|
|
|
11
|
-
declare function init(): Promise<void>;
|
|
12
|
-
|
|
13
10
|
declare const isAngieAvailable: () => boolean;
|
|
14
11
|
|
|
15
12
|
declare const isAngieSidebarOpen: () => boolean;
|
|
16
13
|
|
|
14
|
+
type UriTemplate = {
|
|
15
|
+
toString: () => string;
|
|
16
|
+
match: (uri: string) => Record<string, string | string[]> | null;
|
|
17
|
+
};
|
|
18
|
+
type McpToolDescriptor = {
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
inputSchema: object;
|
|
22
|
+
execute: (params: Record<string, unknown>) => Promise<unknown>;
|
|
23
|
+
};
|
|
24
|
+
type McpResourceUriOrTemplate = string | {
|
|
25
|
+
uriTemplate: UriTemplate;
|
|
26
|
+
};
|
|
27
|
+
type McpResourceHandler = (uri: URL, variables: Record<string, string | string[]>) => Promise<{
|
|
28
|
+
contents: Array<{
|
|
29
|
+
text?: string;
|
|
30
|
+
}>;
|
|
31
|
+
}>;
|
|
32
|
+
interface IMcpRegistrationAdapter {
|
|
33
|
+
/**
|
|
34
|
+
* Called once at startup to activate the adapter's server registrations.
|
|
35
|
+
*/
|
|
36
|
+
activate: () => void | Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Called once per tool when addTool() is invoked.
|
|
39
|
+
*/
|
|
40
|
+
onToolRegistered: (tool: McpToolDescriptor, extraData?: {
|
|
41
|
+
resources: string[];
|
|
42
|
+
requiredResources: string[];
|
|
43
|
+
}) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Called once per resource when resource() is invoked.
|
|
46
|
+
*/
|
|
47
|
+
onResourceRegistered: (name: string, uriOrTemplate: McpResourceUriOrTemplate, handler: McpResourceHandler) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Called when a resource update notification should be sent.
|
|
50
|
+
*/
|
|
51
|
+
sendResourceUpdated: (params: {
|
|
52
|
+
uri: string;
|
|
53
|
+
}) => void | Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
|
|
17
56
|
declare const ANGIE_MODEL_PREFERENCES: "angie/modelPreferences";
|
|
18
57
|
interface AngieModelPreferences {
|
|
19
58
|
hints?: Array<{
|
|
@@ -24,8 +63,11 @@ interface AngieModelPreferences {
|
|
|
24
63
|
intelligencePriority?: number;
|
|
25
64
|
}
|
|
26
65
|
|
|
66
|
+
declare const registerMcpAdapter: (adapter: IMcpRegistrationAdapter) => void;
|
|
67
|
+
declare const signalMcpReady: () => void;
|
|
68
|
+
declare const activateAdapters: () => void;
|
|
27
69
|
declare const registerMcp: (mcp: McpServer, name: string) => void;
|
|
28
|
-
declare
|
|
70
|
+
declare const getRegisteredMcpServers: () => Array<[string, McpServer, string]>;
|
|
29
71
|
declare const toMCPTitle: (namespace: string) => string;
|
|
30
72
|
/**
|
|
31
73
|
*
|
|
@@ -39,13 +81,8 @@ declare const getMCPByDomain: (namespace: string, options?: {
|
|
|
39
81
|
interface MCPRegistryEntry {
|
|
40
82
|
addTool: <T extends undefined | z.ZodRawShape = undefined, O extends undefined | z.ZodRawShape = undefined>(opts: ToolRegistrationOptions<T, O>) => void;
|
|
41
83
|
setMCPDescription: (description: string) => void;
|
|
42
|
-
getActiveChatInfo: () => {
|
|
43
|
-
sessionId: string;
|
|
44
|
-
expiresAt: number;
|
|
45
|
-
};
|
|
46
84
|
sendResourceUpdated: McpServer['server']['sendResourceUpdated'];
|
|
47
85
|
resource: McpServer['registerResource'];
|
|
48
|
-
mcpServer: McpServer;
|
|
49
86
|
waitForReady: () => Promise<void>;
|
|
50
87
|
}
|
|
51
88
|
type ResourceList = {
|
|
@@ -333,6 +370,12 @@ declare class ToolPrompts {
|
|
|
333
370
|
}
|
|
334
371
|
declare const toolPrompts: (name: string) => ToolPrompts;
|
|
335
372
|
|
|
373
|
+
type ActiveChatInfo = {
|
|
374
|
+
sessionId: string;
|
|
375
|
+
expiresAt: number;
|
|
376
|
+
};
|
|
377
|
+
declare const getActiveChatInfo: () => ActiveChatInfo;
|
|
378
|
+
|
|
336
379
|
declare const sendPromptToAngie: (prompt?: string) => void;
|
|
337
380
|
|
|
338
381
|
declare const redirectToInstallation: (prompt: string) => void;
|
|
@@ -348,6 +391,8 @@ type InstallAngieResult = {
|
|
|
348
391
|
};
|
|
349
392
|
declare const installAngiePlugin: () => Promise<InstallAngieResult>;
|
|
350
393
|
|
|
394
|
+
declare function startMCPServer(): void;
|
|
395
|
+
|
|
351
396
|
declare const getAngieSdk: () => _elementor_external_angie_sdk.AngieMcpSdk;
|
|
352
397
|
|
|
353
|
-
export { ANGIE_MODEL_PREFERENCES, type AngieModelPreferences, type InstallAngieResult, type MCPRegistryEntry,
|
|
398
|
+
export { ANGIE_MODEL_PREFERENCES, type ActiveChatInfo, type AngieModelPreferences, type InstallAngieResult, type MCPRegistryEntry, activateAdapters, createSampler, getActiveChatInfo, getAngieSdk, getMCPByDomain, getRegisteredMcpServers, installAngiePlugin, isAngieAvailable, isAngieSidebarOpen, redirectToAppAdmin, redirectToInstallation, registerMcp, registerMcpAdapter, sendPromptToAngie, signalMcpReady, startMCPServer, toMCPTitle, toolPrompts };
|