@univerjs-pro/mcp 0.10.7-nightly.202509090319 → 0.10.7-nightly.202509130618
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/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/facade.js +1 -1
- package/lib/index.js +1 -1
- package/lib/types/controllers/config.schema.d.ts +16 -9
- package/lib/types/controllers/mcp-connection.controller.d.ts +15 -4
- package/lib/types/plugin.d.ts +1 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +3 -3
|
@@ -15,7 +15,6 @@ export declare enum MCPConnectionStatus {
|
|
|
15
15
|
*/
|
|
16
16
|
export declare enum MCPConnectionError {
|
|
17
17
|
NONE = "NONE",
|
|
18
|
-
MISSING_API_KEY = "MISSING_API_KEY",
|
|
19
18
|
INVALID_API_KEY = "INVALID_API_KEY",
|
|
20
19
|
SESSION_ID_OCCUPIED = "SESSION_ID_OCCUPIED",
|
|
21
20
|
NETWORK_ERROR = "NETWORK_ERROR",
|
|
@@ -36,14 +35,11 @@ export interface IUniverMCPConfig {
|
|
|
36
35
|
*/
|
|
37
36
|
mcpServerUrl?: string;
|
|
38
37
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
38
|
+
* Session ID for the connection. Can be a string or a function that returns a string or a Promise that resolves to a string.
|
|
39
|
+
* Default is 'default', if sessionId is occupied, client will try to reconnect with a random sessionId.
|
|
40
|
+
* Note: Each session ID can only be used by one client at a time. If a session ID is already in use, the server will reject the connection.
|
|
41
41
|
*/
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Univer session ID. Default is 'default'. Currently not configurable.
|
|
45
|
-
*/
|
|
46
|
-
sessionId?: string;
|
|
42
|
+
sessionId?: string | (() => string) | (() => Promise<string>);
|
|
47
43
|
/**
|
|
48
44
|
* Maximum number of reconnection attempts. Default is 10.
|
|
49
45
|
*/
|
|
@@ -52,5 +48,16 @@ export interface IUniverMCPConfig {
|
|
|
52
48
|
* Reconnection interval in milliseconds. Default is 6000.
|
|
53
49
|
*/
|
|
54
50
|
retryInterval?: number;
|
|
51
|
+
/**
|
|
52
|
+
* @experimental
|
|
53
|
+
* Enable dynamic tool execution feature. Default is false.
|
|
54
|
+
* Warning: Enabling this feature may have security implications. Ensure that the MCP server is trusted before enabling this feature.
|
|
55
|
+
*/
|
|
56
|
+
enableDynamicToolExecution?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export declare const defaultPluginConfig: Required<Omit<IUniverMCPConfig, 'sessionId'>>;
|
|
59
|
+
export interface IUniverMCPConfigInternal extends IUniverMCPConfig {
|
|
60
|
+
customHeaders?: {
|
|
61
|
+
[key: string]: string;
|
|
62
|
+
};
|
|
55
63
|
}
|
|
56
|
-
export declare const defaultPluginConfig: Required<IUniverMCPConfig>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Disposable, IConfigService, ILogService } from '@univerjs/core';
|
|
2
|
-
import { HTTPService
|
|
1
|
+
import { Disposable, IConfigService, ILogService, Injector } from '@univerjs/core';
|
|
2
|
+
import { HTTPService } from '@univerjs/network';
|
|
3
3
|
import { MCPUIEventService } from '../services/mcp-ui-event.service';
|
|
4
4
|
import { MCPConnectionError, MCPConnectionStatus } from './config.schema';
|
|
5
5
|
/**
|
|
@@ -27,22 +27,26 @@ export interface IMCPMessage {
|
|
|
27
27
|
* - Error handling and reporting
|
|
28
28
|
*/
|
|
29
29
|
export declare class MCPConnectionController extends Disposable {
|
|
30
|
+
readonly _injector: Injector;
|
|
30
31
|
private readonly _configService;
|
|
31
32
|
private readonly _logService;
|
|
32
33
|
private readonly _httpService;
|
|
33
|
-
private readonly _socketService;
|
|
34
34
|
private readonly _mcpUIEventService;
|
|
35
35
|
private _socket;
|
|
36
36
|
private _retryCount;
|
|
37
37
|
private _connectionStatus;
|
|
38
38
|
private _connectionError;
|
|
39
|
+
private _sessionId;
|
|
39
40
|
private _retryTimer;
|
|
40
41
|
private _destroy$;
|
|
42
|
+
enableAutoConnect: boolean;
|
|
43
|
+
private _isUserConfiguredSessionId;
|
|
41
44
|
readonly connectionStatus$: import('rxjs').Observable<MCPConnectionStatus>;
|
|
42
45
|
readonly connectionError$: import('rxjs').Observable<MCPConnectionError>;
|
|
46
|
+
readonly sessionId$: import('rxjs').Observable<string>;
|
|
43
47
|
private readonly _message$;
|
|
44
48
|
readonly message$: import('rxjs').Observable<IMCPMessage>;
|
|
45
|
-
constructor(_configService: IConfigService, _logService: ILogService, _httpService: HTTPService,
|
|
49
|
+
constructor(_injector: Injector, _configService: IConfigService, _logService: ILogService, _httpService: HTTPService, _mcpUIEventService: MCPUIEventService);
|
|
46
50
|
/**
|
|
47
51
|
* Get current connection status
|
|
48
52
|
*/
|
|
@@ -79,6 +83,13 @@ export declare class MCPConnectionController extends Disposable {
|
|
|
79
83
|
* Perform connection to MCP server
|
|
80
84
|
*/
|
|
81
85
|
private _connect;
|
|
86
|
+
/**
|
|
87
|
+
* Resolve sessionId from configuration, supporting string, function, and async function
|
|
88
|
+
*/
|
|
89
|
+
private _resolveSessionId;
|
|
90
|
+
__setCustomHeaders(headers: {
|
|
91
|
+
[key: string]: string;
|
|
92
|
+
}): void;
|
|
82
93
|
/**
|
|
83
94
|
* Get session ticket from authentication API
|
|
84
95
|
*/
|
package/lib/types/plugin.d.ts
CHANGED
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _0x5b90(_0x208ed9,_0x523715){var _0x1564a0=_0x1564();return _0x5b90=function(_0x5b909d,_0x1fe7e2){_0x5b909d=_0x5b909d-0x1a4;var _0x32a4df=_0x1564a0[_0x5b909d];return _0x32a4df;},_0x5b90(_0x208ed9,_0x523715);}function _0x1564(){var _0x2b3913=['FUniver','@univerjs-pro/mcp','executeTool','3352500hsnbxf','object','692sQAipJ','13793337cjYqWf','424zQBtqs','1263597gepsiE','11uCNxxX','getAllTools','get','1629030QuBGri','IMCPToolRegistry','19308ZtEwMR','validateMCPToolCall','18pAgzdD','function','getAllMCPTools','extend','_injector','@univerjs/core/facade','amd','UniverProMcp','156093oedxCt','68372110llXtyR'];_0x1564=function(){return _0x2b3913;};return _0x1564();}(function(_0x3efc81,_0x3cb948){var _0x98cd76=_0x5b90,_0x11c396=_0x3efc81();while(!![]){try{var _0x1d7949=parseInt(_0x98cd76(0x1ba))/0x1+parseInt(_0x98cd76(0x1b5))/0x2+-parseInt(_0x98cd76(0x1a6))/0x3*(-parseInt(_0x98cd76(0x1b7))/0x4)+-parseInt(_0x98cd76(0x1a4))/0x5*(-parseInt(_0x98cd76(0x1a8))/0x6)+-parseInt(_0x98cd76(0x1b0))/0x7*(-parseInt(_0x98cd76(0x1b9))/0x8)+parseInt(_0x98cd76(0x1b8))/0x9+-parseInt(_0x98cd76(0x1b1))/0xa*(parseInt(_0x98cd76(0x1bb))/0xb);if(_0x1d7949===_0x3cb948)break;else _0x11c396['push'](_0x11c396['shift']());}catch(_0x5b6d94){_0x11c396['push'](_0x11c396['shift']());}}}(_0x1564,0xdda92),function(_0x4f7bbf,_0xa34d21){var _0x54a142=_0x5b90;typeof exports==_0x54a142(0x1b6)&&typeof module<'u'?_0xa34d21(require('@univerjs-pro/mcp'),require('@univerjs/core/facade')):typeof define==_0x54a142(0x1a9)&&define[_0x54a142(0x1ae)]?define([_0x54a142(0x1b3),_0x54a142(0x1ad)],_0xa34d21):(_0x4f7bbf=typeof globalThis<'u'?globalThis:_0x4f7bbf||self,_0xa34d21(_0x4f7bbf[_0x54a142(0x1af)],_0x4f7bbf['UniverCoreFacade']));}(this,function(_0x491e47,_0x5970dc){'use strict';var _0x4bd6c6=_0x5b90;class _0x3436bc extends _0x5970dc[_0x4bd6c6(0x1b2)]{[_0x4bd6c6(0x1a7)](_0x381f19,_0x28e41e){var _0x4703fa=_0x4bd6c6;return this[_0x4703fa(0x1ac)]['get'](_0x491e47[_0x4703fa(0x1a5)])['validateToolCall'](_0x381f19,_0x28e41e);}[_0x4bd6c6(0x1aa)](){var _0x38b00a=_0x4bd6c6;return this[_0x38b00a(0x1ac)]['get'](_0x491e47[_0x38b00a(0x1a5)])[_0x38b00a(0x1bc)]();}['callMCPTool'](_0x9eca5a,_0x564d7e){var _0x22afcd=_0x4bd6c6;return this[_0x22afcd(0x1ac)][_0x22afcd(0x1bd)](_0x491e47[_0x22afcd(0x1a5)])[_0x22afcd(0x1b4)](_0x9eca5a,_0x564d7e);}}_0x5970dc[_0x4bd6c6(0x1b2)][_0x4bd6c6(0x1ab)](_0x3436bc);}));
|