@univerjs-pro/mcp 0.10.11 → 0.10.12-nightly.202510251119

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.
@@ -1,4 +1,4 @@
1
- import { Disposable, ILogService } from '@univerjs/core';
1
+ import { Disposable, IConfigService, ILogService, Injector } from '@univerjs/core';
2
2
  import { z } from 'zod';
3
3
  import { MCPEventService } from '../services/mcp-event.service';
4
4
  /**
@@ -38,8 +38,10 @@ export declare const IMCPToolRegistry: import('@wendellhu/redi').IdentifierDecor
38
38
  export declare class MCPToolRegistryController extends Disposable implements IMCPToolRegistry {
39
39
  private readonly _logService;
40
40
  private readonly _mcpEventService;
41
+ readonly _injector: Injector;
42
+ private readonly _configService;
41
43
  private readonly _tools;
42
- constructor(_logService: ILogService, _mcpEventService: MCPEventService);
44
+ constructor(_logService: ILogService, _mcpEventService: MCPEventService, _injector: Injector, _configService: IConfigService);
43
45
  /**
44
46
  * Register a tool for MCP calls
45
47
  */
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Safe JSON stringification utilities for MCP protocol
3
+ * Handles circular references and complex objects with minimal overhead
4
+ */
5
+ /**
6
+ * Safely stringify JSON with strict filtering for complex objects
7
+ * Only allows basic types, plain Objects, and Arrays to be serialized
8
+ * All other types are converted to descriptive strings at the first level
9
+ * @param value - The value to stringify
10
+ * @param space - Optional spacing for formatting
11
+ * @returns JSON string with safe handling of complex objects
12
+ */
13
+ export declare function safeJsonStringify(value: any, space?: string | number): string;
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- function _0xd13d(_0x23afca,_0x5c2cdf){const _0x1d9436=_0x1d94();return _0xd13d=function(_0xd13de6,_0x18de42){_0xd13de6=_0xd13de6-0xc1;let _0x44d653=_0x1d9436[_0xd13de6];return _0x44d653;},_0xd13d(_0x23afca,_0x5c2cdf);}(function(_0x428bd5,_0x240ee6){const _0x139101=_0xd13d,_0x231965=_0x428bd5();while(!![]){try{const _0xab1213=parseInt(_0x139101(0xcb))/0x1*(parseInt(_0x139101(0xe9))/0x2)+-parseInt(_0x139101(0xc9))/0x3+parseInt(_0x139101(0xed))/0x4+-parseInt(_0x139101(0xeb))/0x5+parseInt(_0x139101(0xe1))/0x6*(-parseInt(_0x139101(0xd6))/0x7)+parseInt(_0x139101(0xc2))/0x8+-parseInt(_0x139101(0xc1))/0x9*(parseInt(_0x139101(0xd2))/0xa);if(_0xab1213===_0x240ee6)break;else _0x231965['push'](_0x231965['shift']());}catch(_0x1106e4){_0x231965['push'](_0x231965['shift']());}}}(_0x1d94,0x4419d),function(_0x1c9930,_0x5cb852){const _0x6ac8b7=_0xd13d;typeof exports==_0x6ac8b7(0xdb)&&typeof module<'u'?_0x5cb852(require('@univerjs-pro/mcp'),require('@univerjs/core/facade'),require('@univerjs/core')):typeof define=='function'&&define[_0x6ac8b7(0xce)]?define(['@univerjs-pro/mcp',_0x6ac8b7(0xe2),_0x6ac8b7(0xc7)],_0x5cb852):(_0x1c9930=typeof globalThis<'u'?globalThis:_0x1c9930||self,_0x5cb852(_0x1c9930[_0x6ac8b7(0xea)],_0x1c9930[_0x6ac8b7(0xdf)],_0x1c9930['UniverCore']));}(this,function(_0x5145d2,_0x2ab97c,_0x527db8){'use strict';const _0x219191=_0xd13d;class _0x1bb8bc{get[_0x219191(0xee)](){const _0x4a1c96=_0x219191;return _0x5145d2['MCPEventId'][_0x4a1c96(0xee)];}get[_0x219191(0xe3)](){return _0x5145d2['MCPEventId']['McpToolCallReceived'];}get[_0x219191(0xd8)](){const _0x3166db=_0x219191;return _0x5145d2[_0x3166db(0xe7)][_0x3166db(0xd8)];}get[_0x219191(0xe5)](){const _0x1af08b=_0x219191;return _0x5145d2[_0x1af08b(0xe7)][_0x1af08b(0xe5)];}}_0x2ab97c[_0x219191(0xc3)][_0x219191(0xd1)](_0x1bb8bc);class _0x3ff95 extends _0x2ab97c[_0x219191(0xd7)]{[_0x219191(0xde)](_0x45c02b){const _0x1422a3=_0x219191;this[_0x1422a3(0xd3)](_0x45c02b);}['_registerMCPFacadeEvents'](_0x229867){const _0x35637c=_0x219191,_0x3086c1=_0x229867[_0x35637c(0xd0)](_0x5145d2[_0x35637c(0xdd)]);this[_0x35637c(0xe8)](this[_0x35637c(0xdc)]['McpConnectionStatusChanged'],()=>_0x527db8[_0x35637c(0xe4)](_0x3086c1[_0x35637c(0xe0)][_0x35637c(0xc4)](_0x37ea26=>{const _0x197b4f=_0x35637c;_0x37ea26['type']===_0x5145d2[_0x197b4f(0xe7)]['McpConnectionStatusChanged']&&this['fireEvent'](this[_0x197b4f(0xdc)][_0x197b4f(0xee)],_0x37ea26[_0x197b4f(0xda)]);}))),this['registerEventHandler'](this[_0x35637c(0xdc)]['McpToolCallReceived'],()=>_0x527db8[_0x35637c(0xe4)](_0x3086c1[_0x35637c(0xe0)][_0x35637c(0xc4)](_0xc0f755=>{const _0x197da9=_0x35637c;_0xc0f755[_0x197da9(0xcc)]===_0x5145d2[_0x197da9(0xe7)][_0x197da9(0xe3)]&&this['fireEvent'](this['Event'][_0x197da9(0xe3)],_0xc0f755['data']);}))),this[_0x35637c(0xe8)](this[_0x35637c(0xdc)]['McpToolCallExecuted'],()=>_0x527db8['toDisposable'](_0x3086c1['event$'][_0x35637c(0xc4)](_0x399ca7=>{const _0x179bc1=_0x35637c;_0x399ca7[_0x179bc1(0xcc)]===_0x5145d2[_0x179bc1(0xe7)]['McpToolCallExecuted']&&this[_0x179bc1(0xc5)](this[_0x179bc1(0xdc)]['McpToolCallExecuted'],_0x399ca7[_0x179bc1(0xda)]);}))),this[_0x35637c(0xe8)](this['Event'][_0x35637c(0xe5)],()=>_0x527db8['toDisposable'](_0x3086c1[_0x35637c(0xe0)][_0x35637c(0xc4)](_0x4af759=>{const _0x523c49=_0x35637c;_0x4af759[_0x523c49(0xcc)]===_0x5145d2[_0x523c49(0xe7)][_0x523c49(0xe5)]&&this['fireEvent'](this[_0x523c49(0xdc)][_0x523c49(0xe5)],_0x4af759[_0x523c49(0xda)]);})));}[_0x219191(0xd4)](_0x4a3f01,_0x3a98b2){const _0x293bc8=_0x219191;return this[_0x293bc8(0xcd)][_0x293bc8(0xd0)](_0x5145d2[_0x293bc8(0xc8)])[_0x293bc8(0xe6)](_0x4a3f01,_0x3a98b2);}[_0x219191(0xca)](){const _0x43f072=_0x219191;return this[_0x43f072(0xcd)]['get'](_0x5145d2[_0x43f072(0xc8)])[_0x43f072(0xec)]();}[_0x219191(0xc6)](_0x2d9b00,_0x410f86){const _0x13d4c3=_0x219191;return this[_0x13d4c3(0xcd)][_0x13d4c3(0xd0)](_0x5145d2[_0x13d4c3(0xc8)])['executeTool'](_0x2d9b00,_0x410f86);}['getMCPConnectionStatus'](){const _0x1b7030=_0x219191;return this[_0x1b7030(0xcd)][_0x1b7030(0xd0)](_0x5145d2[_0x1b7030(0xd5)])['getConnectionStatus']();}['connectMCP'](){const _0x400b2e=_0x219191;this['_injector'][_0x400b2e(0xd0)](_0x5145d2[_0x400b2e(0xd5)])['connect']();}[_0x219191(0xd9)](){const _0x27e22e=_0x219191;this[_0x27e22e(0xcd)][_0x27e22e(0xd0)](_0x5145d2['MCPConnectionController'])[_0x27e22e(0xcf)]();}}_0x2ab97c[_0x219191(0xd7)][_0x219191(0xd1)](_0x3ff95);}));function _0x1d94(){const _0x170fb6=['UniverProMcp','1504100MUcpwc','getAllTools','1912164mbQhCX','McpConnectionStatusChanged','4149KPDOOU','3136344EujVjX','FEventName','subscribe','fireEvent','callMCPTool','@univerjs/core','IMCPToolRegistry','1168884czgtGt','getAllMCPTools','27sGIHdu','type','_injector','amd','disconnect','get','extend','2260WfZqYq','_registerMCPFacadeEvents','validateMCPToolCall','MCPConnectionController','286573MvpHzH','FUniver','McpToolCallExecuted','disconnectMCP','data','object','Event','MCPEventService','_initialize','UniverCoreFacade','event$','30ozITTv','@univerjs/core/facade','McpToolCallReceived','toDisposable','McpToolCallFailed','validateToolCall','MCPEventId','registerEventHandler','30236URMQyV'];_0x1d94=function(){return _0x170fb6;};return _0x1d94();}
1
+ (function(_0x43113b,_0x767c44){const _0x1564e1=_0x1b5c,_0x473bed=_0x43113b();while(!![]){try{const _0x522ae0=parseInt(_0x1564e1(0x19b))/0x1+-parseInt(_0x1564e1(0x186))/0x2+-parseInt(_0x1564e1(0x1a6))/0x3+-parseInt(_0x1564e1(0x188))/0x4+parseInt(_0x1564e1(0x187))/0x5+-parseInt(_0x1564e1(0x1a9))/0x6*(parseInt(_0x1564e1(0x184))/0x7)+-parseInt(_0x1564e1(0x1a3))/0x8*(-parseInt(_0x1564e1(0x19c))/0x9);if(_0x522ae0===_0x767c44)break;else _0x473bed['push'](_0x473bed['shift']());}catch(_0x22e0c9){_0x473bed['push'](_0x473bed['shift']());}}}(_0x25db,0x89308),function(_0x53b16b,_0x5578b0){const _0x2dffc5=_0x1b5c;typeof exports==_0x2dffc5(0x17b)&&typeof module<'u'?_0x5578b0(require('@univerjs-pro/mcp'),require('@univerjs/core/facade'),require('@univerjs/core')):typeof define=='function'&&define[_0x2dffc5(0x17d)]?define([_0x2dffc5(0x196),_0x2dffc5(0x192),_0x2dffc5(0x198)],_0x5578b0):(_0x53b16b=typeof globalThis<'u'?globalThis:_0x53b16b||self,_0x5578b0(_0x53b16b[_0x2dffc5(0x199)],_0x53b16b[_0x2dffc5(0x1a5)],_0x53b16b[_0x2dffc5(0x18f)]));}(this,function(_0x26c751,_0x2ffe21,_0x488f44){'use strict';const _0x39bae5=_0x1b5c;class _0x291322{get[_0x39bae5(0x18d)](){const _0x3d7d3e=_0x39bae5;return _0x26c751[_0x3d7d3e(0x19d)][_0x3d7d3e(0x18d)];}get[_0x39bae5(0x185)](){const _0x2f1287=_0x39bae5;return _0x26c751[_0x2f1287(0x19d)][_0x2f1287(0x185)];}get[_0x39bae5(0x17e)](){const _0x42d7d2=_0x39bae5;return _0x26c751[_0x42d7d2(0x19d)][_0x42d7d2(0x17e)];}get[_0x39bae5(0x18e)](){const _0x5b6019=_0x39bae5;return _0x26c751[_0x5b6019(0x19d)][_0x5b6019(0x18e)];}}_0x2ffe21[_0x39bae5(0x17a)][_0x39bae5(0x1a2)](_0x291322);class _0x1ece07 extends _0x2ffe21['FUniver']{[_0x39bae5(0x19f)](_0x887c74){const _0x24dbe5=_0x39bae5;this[_0x24dbe5(0x180)](_0x887c74);}[_0x39bae5(0x180)](_0x4ab87f){const _0x221e90=_0x39bae5,_0x4d5306=_0x4ab87f[_0x221e90(0x18a)](_0x26c751['MCPEventService']);this[_0x221e90(0x17c)](this['Event'][_0x221e90(0x18d)],()=>_0x488f44['toDisposable'](_0x4d5306[_0x221e90(0x181)][_0x221e90(0x1a1)](_0x270d08=>{const _0x14723c=_0x221e90;_0x270d08[_0x14723c(0x190)]===_0x26c751[_0x14723c(0x19d)][_0x14723c(0x18d)]&&this['fireEvent'](this[_0x14723c(0x1a4)][_0x14723c(0x18d)],_0x270d08[_0x14723c(0x19e)]);}))),this['registerEventHandler'](this[_0x221e90(0x1a4)][_0x221e90(0x185)],()=>_0x488f44[_0x221e90(0x19a)](_0x4d5306[_0x221e90(0x181)]['subscribe'](_0x24018c=>{const _0x65ced=_0x221e90;_0x24018c['type']===_0x26c751[_0x65ced(0x19d)][_0x65ced(0x185)]&&this[_0x65ced(0x197)](this[_0x65ced(0x1a4)][_0x65ced(0x185)],_0x24018c[_0x65ced(0x19e)]);}))),this[_0x221e90(0x17c)](this[_0x221e90(0x1a4)][_0x221e90(0x17e)],()=>_0x488f44['toDisposable'](_0x4d5306['event$'][_0x221e90(0x1a1)](_0x5b4c71=>{const _0x4ab57a=_0x221e90;_0x5b4c71[_0x4ab57a(0x190)]===_0x26c751[_0x4ab57a(0x19d)]['McpToolCallExecuted']&&this[_0x4ab57a(0x197)](this[_0x4ab57a(0x1a4)][_0x4ab57a(0x17e)],_0x5b4c71[_0x4ab57a(0x19e)]);}))),this[_0x221e90(0x17c)](this[_0x221e90(0x1a4)][_0x221e90(0x18e)],()=>_0x488f44[_0x221e90(0x19a)](_0x4d5306['event$'][_0x221e90(0x1a1)](_0x1a9cdd=>{const _0x43bffc=_0x221e90;_0x1a9cdd[_0x43bffc(0x190)]===_0x26c751[_0x43bffc(0x19d)][_0x43bffc(0x18e)]&&this[_0x43bffc(0x197)](this[_0x43bffc(0x1a4)][_0x43bffc(0x18e)],_0x1a9cdd['data']);})));}[_0x39bae5(0x18b)](_0xbe3af4,_0x303d77){const _0x13e133=_0x39bae5;return this[_0x13e133(0x18c)][_0x13e133(0x18a)](_0x26c751['IMCPToolRegistry'])['validateToolCall'](_0xbe3af4,_0x303d77);}[_0x39bae5(0x182)](){const _0x3dbe3a=_0x39bae5;return this['_injector'][_0x3dbe3a(0x18a)](_0x26c751[_0x3dbe3a(0x189)])[_0x3dbe3a(0x183)]();}[_0x39bae5(0x17f)](_0x50b1a2,_0x2489b7){const _0x33b882=_0x39bae5;return this['_injector'][_0x33b882(0x18a)](_0x26c751[_0x33b882(0x189)])[_0x33b882(0x193)](_0x50b1a2,_0x2489b7);}[_0x39bae5(0x1a0)](){const _0x6083e0=_0x39bae5;return this[_0x6083e0(0x18c)][_0x6083e0(0x18a)](_0x26c751[_0x6083e0(0x1a8)])[_0x6083e0(0x194)]();}[_0x39bae5(0x191)](){const _0xb73a22=_0x39bae5;this[_0xb73a22(0x18c)][_0xb73a22(0x18a)](_0x26c751[_0xb73a22(0x1a8)])['connect']();}[_0x39bae5(0x195)](){const _0x2e057a=_0x39bae5;this[_0x2e057a(0x18c)]['get'](_0x26c751[_0x2e057a(0x1a8)])['disconnect']();}}_0x2ffe21[_0x39bae5(0x1a7)][_0x39bae5(0x1a2)](_0x1ece07);}));function _0x1b5c(_0x4da5c1,_0x3c9062){const _0x25dbda=_0x25db();return _0x1b5c=function(_0x1b5cb8,_0x4ee4a9){_0x1b5cb8=_0x1b5cb8-0x17a;let _0x3f2bd7=_0x25dbda[_0x1b5cb8];return _0x3f2bd7;},_0x1b5c(_0x4da5c1,_0x3c9062);}function _0x25db(){const _0x4a893a=['@univerjs/core','UniverProMcp','toDisposable','1222BfNtDa','99tVLOXw','MCPEventId','data','_initialize','getMCPConnectionStatus','subscribe','extend','797072HELhok','Event','UniverCoreFacade','968334BtRAxy','FUniver','MCPConnectionController','746454EPJWTD','FEventName','object','registerEventHandler','amd','McpToolCallExecuted','callMCPTool','_registerMCPFacadeEvents','event$','getAllMCPTools','getAllTools','14XCPEQy','McpToolCallReceived','398666mYOKcI','3298505lddbZv','1696160OeXMVS','IMCPToolRegistry','get','validateMCPToolCall','_injector','McpConnectionStatusChanged','McpToolCallFailed','UniverCore','type','connectMCP','@univerjs/core/facade','executeTool','getConnectionStatus','disconnectMCP','@univerjs-pro/mcp','fireEvent'];_0x25db=function(){return _0x4a893a;};return _0x25db();}