@univerjs-pro/mcp 0.10.10-experimental.20251010-3f807c5 → 0.10.10-experimental.20251016-33b0941

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 _0x192c(_0x45c74a,_0x9856a4){const _0x538cd3=_0x538c();return _0x192c=function(_0x192cbf,_0x16a408){_0x192cbf=_0x192cbf-0x15f;let _0x2ea084=_0x538cd3[_0x192cbf];return _0x2ea084;},_0x192c(_0x45c74a,_0x9856a4);}(function(_0x542474,_0x1c0c13){const _0x22e37d=_0x192c,_0x1a606a=_0x542474();while(!![]){try{const _0xbb0856=-parseInt(_0x22e37d(0x168))/0x1+parseInt(_0x22e37d(0x183))/0x2+parseInt(_0x22e37d(0x178))/0x3*(parseInt(_0x22e37d(0x160))/0x4)+-parseInt(_0x22e37d(0x181))/0x5+-parseInt(_0x22e37d(0x17e))/0x6*(-parseInt(_0x22e37d(0x172))/0x7)+parseInt(_0x22e37d(0x17f))/0x8+-parseInt(_0x22e37d(0x185))/0x9*(parseInt(_0x22e37d(0x16b))/0xa);if(_0xbb0856===_0x1c0c13)break;else _0x1a606a['push'](_0x1a606a['shift']());}catch(_0x579476){_0x1a606a['push'](_0x1a606a['shift']());}}}(_0x538c,0x66fa9),function(_0x80edec,_0x432864){const _0xbed0fe=_0x192c;typeof exports==_0xbed0fe(0x17a)&&typeof module<'u'?_0x432864(require('@univerjs-pro/mcp'),require('@univerjs/core/facade'),require('@univerjs/core')):typeof define==_0xbed0fe(0x167)&&define[_0xbed0fe(0x177)]?define([_0xbed0fe(0x15f),_0xbed0fe(0x163),_0xbed0fe(0x161)],_0x432864):(_0x80edec=typeof globalThis<'u'?globalThis:_0x80edec||self,_0x432864(_0x80edec[_0xbed0fe(0x17c)],_0x80edec['UniverCoreFacade'],_0x80edec[_0xbed0fe(0x18a)]));}(this,function(_0x515741,_0x485c58,_0x4de0f2){'use strict';const _0x24b061=_0x192c;class _0x171ed0{get['McpConnectionStatusChanged'](){const _0x281b65=_0x192c;return _0x515741['MCPEventId'][_0x281b65(0x16f)];}get[_0x24b061(0x184)](){const _0x5a3dc8=_0x24b061;return _0x515741[_0x5a3dc8(0x165)][_0x5a3dc8(0x184)];}get['McpToolCallExecuted'](){const _0x4df152=_0x24b061;return _0x515741[_0x4df152(0x165)][_0x4df152(0x173)];}get[_0x24b061(0x176)](){const _0x3aa08d=_0x24b061;return _0x515741[_0x3aa08d(0x165)][_0x3aa08d(0x176)];}}_0x485c58[_0x24b061(0x16c)][_0x24b061(0x189)](_0x171ed0);class _0x335304 extends _0x485c58[_0x24b061(0x16a)]{['_initialize'](_0x3b9f3e){const _0x1715a6=_0x24b061;this[_0x1715a6(0x171)](_0x3b9f3e);}[_0x24b061(0x171)](_0x54b8e7){const _0xc36550=_0x24b061,_0x56f5e8=_0x54b8e7['get'](_0x515741[_0xc36550(0x162)]);this[_0xc36550(0x174)](this[_0xc36550(0x17b)][_0xc36550(0x16f)],()=>_0x4de0f2[_0xc36550(0x188)](_0x56f5e8[_0xc36550(0x175)][_0xc36550(0x187)](_0x23fff9=>{const _0x20f144=_0xc36550;_0x23fff9['type']===_0x515741[_0x20f144(0x165)][_0x20f144(0x16f)]&&this[_0x20f144(0x18d)](this[_0x20f144(0x17b)][_0x20f144(0x16f)],_0x23fff9[_0x20f144(0x186)]);}))),this[_0xc36550(0x174)](this[_0xc36550(0x17b)][_0xc36550(0x184)],()=>_0x4de0f2[_0xc36550(0x188)](_0x56f5e8[_0xc36550(0x175)][_0xc36550(0x187)](_0x1a7062=>{const _0x113073=_0xc36550;_0x1a7062[_0x113073(0x166)]===_0x515741[_0x113073(0x165)][_0x113073(0x184)]&&this[_0x113073(0x18d)](this[_0x113073(0x17b)][_0x113073(0x184)],_0x1a7062[_0x113073(0x186)]);}))),this[_0xc36550(0x174)](this[_0xc36550(0x17b)][_0xc36550(0x173)],()=>_0x4de0f2[_0xc36550(0x188)](_0x56f5e8[_0xc36550(0x175)][_0xc36550(0x187)](_0x3b50e1=>{const _0x66ca2c=_0xc36550;_0x3b50e1['type']===_0x515741[_0x66ca2c(0x165)]['McpToolCallExecuted']&&this[_0x66ca2c(0x18d)](this[_0x66ca2c(0x17b)]['McpToolCallExecuted'],_0x3b50e1[_0x66ca2c(0x186)]);}))),this[_0xc36550(0x174)](this[_0xc36550(0x17b)][_0xc36550(0x176)],()=>_0x4de0f2[_0xc36550(0x188)](_0x56f5e8[_0xc36550(0x175)]['subscribe'](_0x42073f=>{const _0x4f1e37=_0xc36550;_0x42073f[_0x4f1e37(0x166)]===_0x515741[_0x4f1e37(0x165)][_0x4f1e37(0x176)]&&this[_0x4f1e37(0x18d)](this[_0x4f1e37(0x17b)][_0x4f1e37(0x176)],_0x42073f[_0x4f1e37(0x186)]);})));}[_0x24b061(0x179)](_0x2c1913,_0x4f7d8c){const _0x14a065=_0x24b061;return this[_0x14a065(0x170)][_0x14a065(0x18b)](_0x515741['IMCPToolRegistry'])[_0x14a065(0x169)](_0x2c1913,_0x4f7d8c);}['getAllMCPTools'](){const _0x24068e=_0x24b061;return this['_injector']['get'](_0x515741[_0x24068e(0x18c)])['getAllTools']();}[_0x24b061(0x164)](_0x36104d,_0x189774){const _0x1f6c21=_0x24b061;return this[_0x1f6c21(0x170)][_0x1f6c21(0x18b)](_0x515741[_0x1f6c21(0x18c)])['executeTool'](_0x36104d,_0x189774);}[_0x24b061(0x16e)](){const _0x4ce0f6=_0x24b061;return this['_injector'][_0x4ce0f6(0x18b)](_0x515741[_0x4ce0f6(0x17d)])['getConnectionStatus']();}[_0x24b061(0x16d)](){const _0x3e4949=_0x24b061;this[_0x3e4949(0x170)][_0x3e4949(0x18b)](_0x515741[_0x3e4949(0x17d)])[_0x3e4949(0x180)]();}[_0x24b061(0x182)](){const _0x19a626=_0x24b061;this[_0x19a626(0x170)][_0x19a626(0x18b)](_0x515741[_0x19a626(0x17d)])['disconnect']();}}_0x485c58[_0x24b061(0x16a)][_0x24b061(0x189)](_0x335304);}));function _0x538c(){const _0x134bf5=['validateMCPToolCall','object','Event','UniverProMcp','MCPConnectionController','6yftjHw','4399640qgWLQo','connect','1705115UDCCfA','disconnectMCP','1424076anQHTK','McpToolCallReceived','8841060SJrKdw','data','subscribe','toDisposable','extend','UniverCore','get','IMCPToolRegistry','fireEvent','@univerjs-pro/mcp','4ebrMEq','@univerjs/core','MCPEventService','@univerjs/core/facade','callMCPTool','MCPEventId','type','function','538005XpmEEb','validateToolCall','FUniver','10jSupHk','FEventName','connectMCP','getMCPConnectionStatus','McpConnectionStatusChanged','_injector','_registerMCPFacadeEvents','3483011LWlneg','McpToolCallExecuted','registerEventHandler','event$','McpToolCallFailed','amd','1570809QKXmbO'];_0x538c=function(){return _0x134bf5;};return _0x538c();}
1
+ function _0xf5b5(_0x201d75,_0x12d19d){const _0x16bee5=_0x16be();return _0xf5b5=function(_0xf5b5d,_0x514184){_0xf5b5d=_0xf5b5d-0x1f2;let _0x4095d3=_0x16bee5[_0xf5b5d];return _0x4095d3;},_0xf5b5(_0x201d75,_0x12d19d);}function _0x16be(){const _0x291642=['1597770VcCWjr','fireEvent','21TXrGfp','connectMCP','1534182cbZoTl','getAllTools','getAllMCPTools','UniverCoreFacade','2620315QJrftN','MCPConnectionController','23533ltBSji','MCPEventService','connect','_registerMCPFacadeEvents','10AotwRM','1257684HDfCNP','get','_injector','function','UniverProMcp','object','callMCPTool','3076513pkpJMI','FEventName','20TzWNzn','4SOVWka','@univerjs/core','FUniver','type','2181032fLheyE','subscribe','McpToolCallReceived','event$','disconnectMCP','McpConnectionStatusChanged','Event','validateToolCall','validateMCPToolCall','disconnect','amd','data','extend','registerEventHandler','toDisposable','IMCPToolRegistry','McpToolCallExecuted','MCPEventId','McpToolCallFailed','executeTool'];_0x16be=function(){return _0x291642;};return _0x16be();}(function(_0x59fe34,_0x5d0284){const _0x5853b5=_0xf5b5,_0x206c53=_0x59fe34();while(!![]){try{const _0x41dbd1=parseInt(_0x5853b5(0x207))/0x1*(-parseInt(_0x5853b5(0x215))/0x2)+parseInt(_0x5853b5(0x201))/0x3+-parseInt(_0x5853b5(0x216))/0x4*(-parseInt(_0x5853b5(0x205))/0x5)+parseInt(_0x5853b5(0x20c))/0x6*(-parseInt(_0x5853b5(0x1ff))/0x7)+parseInt(_0x5853b5(0x21a))/0x8+parseInt(_0x5853b5(0x1fd))/0x9+-parseInt(_0x5853b5(0x20b))/0xa*(parseInt(_0x5853b5(0x213))/0xb);if(_0x41dbd1===_0x5d0284)break;else _0x206c53['push'](_0x206c53['shift']());}catch(_0x1f02e2){_0x206c53['push'](_0x206c53['shift']());}}}(_0x16be,0x53701),function(_0x204d51,_0x43847e){const _0x4a5d1e=_0xf5b5;typeof exports==_0x4a5d1e(0x211)&&typeof module<'u'?_0x43847e(require('@univerjs-pro/mcp'),require('@univerjs/core/facade'),require('@univerjs/core')):typeof define==_0x4a5d1e(0x20f)&&define[_0x4a5d1e(0x1f3)]?define(['@univerjs-pro/mcp','@univerjs/core/facade',_0x4a5d1e(0x217)],_0x43847e):(_0x204d51=typeof globalThis<'u'?globalThis:_0x204d51||self,_0x43847e(_0x204d51[_0x4a5d1e(0x210)],_0x204d51[_0x4a5d1e(0x204)],_0x204d51['UniverCore']));}(this,function(_0x172aae,_0x28e7da,_0x3e67bf){'use strict';const _0x260133=_0xf5b5;class _0x135d10{get['McpConnectionStatusChanged'](){const _0x18892c=_0xf5b5;return _0x172aae['MCPEventId'][_0x18892c(0x21f)];}get['McpToolCallReceived'](){const _0x276f68=_0xf5b5;return _0x172aae[_0x276f68(0x1fa)][_0x276f68(0x21c)];}get[_0x260133(0x1f9)](){const _0x7c2e70=_0x260133;return _0x172aae[_0x7c2e70(0x1fa)]['McpToolCallExecuted'];}get[_0x260133(0x1fb)](){const _0x1a3b57=_0x260133;return _0x172aae[_0x1a3b57(0x1fa)]['McpToolCallFailed'];}}_0x28e7da[_0x260133(0x214)][_0x260133(0x1f5)](_0x135d10);class _0x2ca230 extends _0x28e7da[_0x260133(0x218)]{['_initialize'](_0x24bee6){const _0x4e13c1=_0x260133;this[_0x4e13c1(0x20a)](_0x24bee6);}[_0x260133(0x20a)](_0x27329e){const _0x2f65ef=_0x260133,_0x427430=_0x27329e[_0x2f65ef(0x20d)](_0x172aae[_0x2f65ef(0x208)]);this[_0x2f65ef(0x1f6)](this['Event'][_0x2f65ef(0x21f)],()=>_0x3e67bf[_0x2f65ef(0x1f7)](_0x427430[_0x2f65ef(0x21d)][_0x2f65ef(0x21b)](_0x518355=>{const _0x5798c5=_0x2f65ef;_0x518355['type']===_0x172aae['MCPEventId'][_0x5798c5(0x21f)]&&this[_0x5798c5(0x1fe)](this[_0x5798c5(0x220)]['McpConnectionStatusChanged'],_0x518355[_0x5798c5(0x1f4)]);}))),this['registerEventHandler'](this['Event']['McpToolCallReceived'],()=>_0x3e67bf[_0x2f65ef(0x1f7)](_0x427430['event$'][_0x2f65ef(0x21b)](_0x52ece9=>{const _0x33c7f0=_0x2f65ef;_0x52ece9[_0x33c7f0(0x219)]===_0x172aae[_0x33c7f0(0x1fa)][_0x33c7f0(0x21c)]&&this['fireEvent'](this[_0x33c7f0(0x220)][_0x33c7f0(0x21c)],_0x52ece9[_0x33c7f0(0x1f4)]);}))),this[_0x2f65ef(0x1f6)](this[_0x2f65ef(0x220)][_0x2f65ef(0x1f9)],()=>_0x3e67bf[_0x2f65ef(0x1f7)](_0x427430[_0x2f65ef(0x21d)][_0x2f65ef(0x21b)](_0x8b5824=>{const _0x3604d2=_0x2f65ef;_0x8b5824['type']===_0x172aae[_0x3604d2(0x1fa)][_0x3604d2(0x1f9)]&&this[_0x3604d2(0x1fe)](this['Event'][_0x3604d2(0x1f9)],_0x8b5824[_0x3604d2(0x1f4)]);}))),this[_0x2f65ef(0x1f6)](this[_0x2f65ef(0x220)]['McpToolCallFailed'],()=>_0x3e67bf[_0x2f65ef(0x1f7)](_0x427430['event$']['subscribe'](_0x450c37=>{const _0x3ed1e5=_0x2f65ef;_0x450c37['type']===_0x172aae[_0x3ed1e5(0x1fa)][_0x3ed1e5(0x1fb)]&&this[_0x3ed1e5(0x1fe)](this[_0x3ed1e5(0x220)][_0x3ed1e5(0x1fb)],_0x450c37[_0x3ed1e5(0x1f4)]);})));}[_0x260133(0x222)](_0x4a0bb4,_0x48d0fa){const _0xab1547=_0x260133;return this[_0xab1547(0x20e)][_0xab1547(0x20d)](_0x172aae[_0xab1547(0x1f8)])[_0xab1547(0x221)](_0x4a0bb4,_0x48d0fa);}[_0x260133(0x203)](){const _0x238eda=_0x260133;return this[_0x238eda(0x20e)][_0x238eda(0x20d)](_0x172aae['IMCPToolRegistry'])[_0x238eda(0x202)]();}[_0x260133(0x212)](_0x570a25,_0x44bb4b){const _0x56bc71=_0x260133;return this[_0x56bc71(0x20e)][_0x56bc71(0x20d)](_0x172aae[_0x56bc71(0x1f8)])[_0x56bc71(0x1fc)](_0x570a25,_0x44bb4b);}['getMCPConnectionStatus'](){const _0x17d77a=_0x260133;return this[_0x17d77a(0x20e)][_0x17d77a(0x20d)](_0x172aae[_0x17d77a(0x206)])['getConnectionStatus']();}[_0x260133(0x200)](){const _0x579ec8=_0x260133;this['_injector'][_0x579ec8(0x20d)](_0x172aae[_0x579ec8(0x206)])[_0x579ec8(0x209)]();}[_0x260133(0x21e)](){const _0x222b3a=_0x260133;this[_0x222b3a(0x20e)][_0x222b3a(0x20d)](_0x172aae[_0x222b3a(0x206)])[_0x222b3a(0x1f2)]();}}_0x28e7da[_0x260133(0x218)]['extend'](_0x2ca230);}));