@univerjs-pro/mcp 0.10.11-nightly.202510220308 → 0.10.12-nightly.202510221114

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 _0x1129(_0x3bd429,_0x3fea30){const _0x2f6010=_0x2f60();return _0x1129=function(_0x1129cd,_0x561780){_0x1129cd=_0x1129cd-0x1e3;let _0x5dffd9=_0x2f6010[_0x1129cd];return _0x5dffd9;},_0x1129(_0x3bd429,_0x3fea30);}function _0x2f60(){const _0x5286a3=['McpConnectionStatusChanged','type','4AeGmbm','extend','842988gywppA','function','Event','FEventName','@univerjs/core','executeTool','_injector','McpToolCallExecuted','get','_registerMCPFacadeEvents','fireEvent','2020375LnNFyu','5866030jOzjqR','event$','validateToolCall','4204071uTqLup','202974dvqoBC','callMCPTool','FUniver','UniverCore','280104cEtNJI','getAllTools','MCPEventId','11hwViZY','McpToolCallReceived','4HpiZVu','UniverProMcp','IMCPToolRegistry','connect','getAllMCPTools','registerEventHandler','UniverCoreFacade','getMCPConnectionStatus','MCPConnectionController','McpToolCallFailed','MCPEventService','data','45868zHOSvN','35hZVFwG','connectMCP','toDisposable','subscribe','amd'];_0x2f60=function(){return _0x5286a3;};return _0x2f60();}(function(_0x45c79d,_0x17e18b){const _0x13f825=_0x1129,_0x365e33=_0x45c79d();while(!![]){try{const _0x4dfa07=parseInt(_0x13f825(0x20d))/0x1*(-parseInt(_0x13f825(0x1e6))/0x2)+parseInt(_0x13f825(0x1e8))/0x3*(-parseInt(_0x13f825(0x201))/0x4)+-parseInt(_0x13f825(0x20e))/0x5*(-parseInt(_0x13f825(0x1f8))/0x6)+parseInt(_0x13f825(0x1f3))/0x7+-parseInt(_0x13f825(0x1fc))/0x8+-parseInt(_0x13f825(0x1f7))/0x9+-parseInt(_0x13f825(0x1f4))/0xa*(-parseInt(_0x13f825(0x1ff))/0xb);if(_0x4dfa07===_0x17e18b)break;else _0x365e33['push'](_0x365e33['shift']());}catch(_0x20fe44){_0x365e33['push'](_0x365e33['shift']());}}}(_0x2f60,0x39e6f),function(_0xed46f4,_0x2f610b){const _0x4c9a82=_0x1129;typeof exports=='object'&&typeof module<'u'?_0x2f610b(require('@univerjs-pro/mcp'),require('@univerjs/core/facade'),require('@univerjs/core')):typeof define==_0x4c9a82(0x1e9)&&define[_0x4c9a82(0x1e3)]?define(['@univerjs-pro/mcp','@univerjs/core/facade',_0x4c9a82(0x1ec)],_0x2f610b):(_0xed46f4=typeof globalThis<'u'?globalThis:_0xed46f4||self,_0x2f610b(_0xed46f4[_0x4c9a82(0x202)],_0xed46f4[_0x4c9a82(0x207)],_0xed46f4[_0x4c9a82(0x1fb)]));}(this,function(_0x1e257a,_0xf38066,_0x22b949){'use strict';const _0x47ae49=_0x1129;class _0x4daf5d{get[_0x47ae49(0x1e4)](){const _0x30f19b=_0x47ae49;return _0x1e257a[_0x30f19b(0x1fe)][_0x30f19b(0x1e4)];}get[_0x47ae49(0x200)](){const _0x5a885b=_0x47ae49;return _0x1e257a[_0x5a885b(0x1fe)][_0x5a885b(0x200)];}get['McpToolCallExecuted'](){const _0x2b2ac0=_0x47ae49;return _0x1e257a[_0x2b2ac0(0x1fe)][_0x2b2ac0(0x1ef)];}get[_0x47ae49(0x20a)](){const _0xb4f71e=_0x47ae49;return _0x1e257a[_0xb4f71e(0x1fe)][_0xb4f71e(0x20a)];}}_0xf38066[_0x47ae49(0x1eb)][_0x47ae49(0x1e7)](_0x4daf5d);class _0x35d427 extends _0xf38066[_0x47ae49(0x1fa)]{['_initialize'](_0x926ad){const _0x3213a5=_0x47ae49;this[_0x3213a5(0x1f1)](_0x926ad);}[_0x47ae49(0x1f1)](_0x36dd7f){const _0x4e3b5b=_0x47ae49,_0xfd8c86=_0x36dd7f[_0x4e3b5b(0x1f0)](_0x1e257a[_0x4e3b5b(0x20b)]);this[_0x4e3b5b(0x206)](this['Event'][_0x4e3b5b(0x1e4)],()=>_0x22b949[_0x4e3b5b(0x210)](_0xfd8c86[_0x4e3b5b(0x1f5)][_0x4e3b5b(0x211)](_0x2bbd92=>{const _0x4ed3b9=_0x4e3b5b;_0x2bbd92[_0x4ed3b9(0x1e5)]===_0x1e257a[_0x4ed3b9(0x1fe)][_0x4ed3b9(0x1e4)]&&this[_0x4ed3b9(0x1f2)](this['Event'][_0x4ed3b9(0x1e4)],_0x2bbd92[_0x4ed3b9(0x20c)]);}))),this[_0x4e3b5b(0x206)](this['Event'][_0x4e3b5b(0x200)],()=>_0x22b949[_0x4e3b5b(0x210)](_0xfd8c86['event$'][_0x4e3b5b(0x211)](_0xa6d6c0=>{const _0x94dd99=_0x4e3b5b;_0xa6d6c0[_0x94dd99(0x1e5)]===_0x1e257a[_0x94dd99(0x1fe)][_0x94dd99(0x200)]&&this[_0x94dd99(0x1f2)](this[_0x94dd99(0x1ea)][_0x94dd99(0x200)],_0xa6d6c0[_0x94dd99(0x20c)]);}))),this[_0x4e3b5b(0x206)](this[_0x4e3b5b(0x1ea)]['McpToolCallExecuted'],()=>_0x22b949[_0x4e3b5b(0x210)](_0xfd8c86['event$']['subscribe'](_0x2b2f9d=>{const _0x3569b4=_0x4e3b5b;_0x2b2f9d[_0x3569b4(0x1e5)]===_0x1e257a[_0x3569b4(0x1fe)][_0x3569b4(0x1ef)]&&this[_0x3569b4(0x1f2)](this['Event']['McpToolCallExecuted'],_0x2b2f9d[_0x3569b4(0x20c)]);}))),this[_0x4e3b5b(0x206)](this[_0x4e3b5b(0x1ea)][_0x4e3b5b(0x20a)],()=>_0x22b949[_0x4e3b5b(0x210)](_0xfd8c86[_0x4e3b5b(0x1f5)][_0x4e3b5b(0x211)](_0x5da29d=>{const _0xd64a21=_0x4e3b5b;_0x5da29d['type']===_0x1e257a[_0xd64a21(0x1fe)][_0xd64a21(0x20a)]&&this[_0xd64a21(0x1f2)](this['Event'][_0xd64a21(0x20a)],_0x5da29d['data']);})));}['validateMCPToolCall'](_0x1be6a,_0x4826d1){const _0x588bc7=_0x47ae49;return this[_0x588bc7(0x1ee)][_0x588bc7(0x1f0)](_0x1e257a[_0x588bc7(0x203)])[_0x588bc7(0x1f6)](_0x1be6a,_0x4826d1);}[_0x47ae49(0x205)](){const _0x151338=_0x47ae49;return this[_0x151338(0x1ee)][_0x151338(0x1f0)](_0x1e257a[_0x151338(0x203)])[_0x151338(0x1fd)]();}[_0x47ae49(0x1f9)](_0x1f04d7,_0x1749d4){const _0x542afb=_0x47ae49;return this[_0x542afb(0x1ee)][_0x542afb(0x1f0)](_0x1e257a[_0x542afb(0x203)])[_0x542afb(0x1ed)](_0x1f04d7,_0x1749d4);}[_0x47ae49(0x208)](){const _0x5654b4=_0x47ae49;return this[_0x5654b4(0x1ee)][_0x5654b4(0x1f0)](_0x1e257a[_0x5654b4(0x209)])['getConnectionStatus']();}[_0x47ae49(0x20f)](){const _0x60d79b=_0x47ae49;this[_0x60d79b(0x1ee)]['get'](_0x1e257a[_0x60d79b(0x209)])[_0x60d79b(0x204)]();}['disconnectMCP'](){const _0x566e72=_0x47ae49;this[_0x566e72(0x1ee)]['get'](_0x1e257a[_0x566e72(0x209)])['disconnect']();}}_0xf38066[_0x47ae49(0x1fa)][_0x47ae49(0x1e7)](_0x35d427);}));
1
+ (function(_0x2637b3,_0x2db8b3){const _0x473287=_0x3f14,_0x17e467=_0x2637b3();while(!![]){try{const _0x49c320=-parseInt(_0x473287(0xe1))/0x1*(parseInt(_0x473287(0xc6))/0x2)+parseInt(_0x473287(0xde))/0x3*(parseInt(_0x473287(0xd9))/0x4)+-parseInt(_0x473287(0xe4))/0x5+-parseInt(_0x473287(0xe7))/0x6*(parseInt(_0x473287(0xd3))/0x7)+parseInt(_0x473287(0xc7))/0x8*(-parseInt(_0x473287(0xda))/0x9)+parseInt(_0x473287(0xdc))/0xa*(-parseInt(_0x473287(0xe3))/0xb)+parseInt(_0x473287(0xce))/0xc*(parseInt(_0x473287(0xe8))/0xd);if(_0x49c320===_0x2db8b3)break;else _0x17e467['push'](_0x17e467['shift']());}catch(_0x384aa2){_0x17e467['push'](_0x17e467['shift']());}}}(_0x54b2,0x6dcdc),function(_0x53a2e3,_0x5594bf){const _0x4290f9=_0x3f14;typeof exports==_0x4290f9(0xd5)&&typeof module<'u'?_0x5594bf(require('@univerjs-pro/mcp'),require('@univerjs/core/facade'),require('@univerjs/core')):typeof define==_0x4290f9(0xee)&&define[_0x4290f9(0xd2)]?define(['@univerjs-pro/mcp','@univerjs/core/facade',_0x4290f9(0xcf)],_0x5594bf):(_0x53a2e3=typeof globalThis<'u'?globalThis:_0x53a2e3||self,_0x5594bf(_0x53a2e3[_0x4290f9(0xcd)],_0x53a2e3['UniverCoreFacade'],_0x53a2e3[_0x4290f9(0xe2)]));}(this,function(_0x3a479a,_0x374edb,_0x122320){'use strict';const _0x462dd9=_0x3f14;class _0x3538bf{get[_0x462dd9(0xc1)](){return _0x3a479a['MCPEventId']['McpConnectionStatusChanged'];}get[_0x462dd9(0xe9)](){const _0x31a880=_0x462dd9;return _0x3a479a['MCPEventId'][_0x31a880(0xe9)];}get['McpToolCallExecuted'](){const _0x1739c0=_0x462dd9;return _0x3a479a['MCPEventId'][_0x1739c0(0xd4)];}get[_0x462dd9(0xc0)](){const _0x501960=_0x462dd9;return _0x3a479a[_0x501960(0xec)][_0x501960(0xc0)];}}_0x374edb[_0x462dd9(0xd6)][_0x462dd9(0xe0)](_0x3538bf);class _0x25025c extends _0x374edb[_0x462dd9(0xef)]{['_initialize'](_0xd80e3){const _0xa48d6d=_0x462dd9;this[_0xa48d6d(0xea)](_0xd80e3);}[_0x462dd9(0xea)](_0x5ba00d){const _0x24039c=_0x462dd9,_0x598bac=_0x5ba00d[_0x24039c(0xcb)](_0x3a479a[_0x24039c(0xc4)]);this[_0x24039c(0xbf)](this[_0x24039c(0xca)]['McpConnectionStatusChanged'],()=>_0x122320[_0x24039c(0xdd)](_0x598bac[_0x24039c(0xc3)][_0x24039c(0xeb)](_0x2786f1=>{const _0x34189e=_0x24039c;_0x2786f1[_0x34189e(0xd8)]===_0x3a479a[_0x34189e(0xec)][_0x34189e(0xc1)]&&this[_0x34189e(0xe5)](this['Event'][_0x34189e(0xc1)],_0x2786f1[_0x34189e(0xc5)]);}))),this['registerEventHandler'](this[_0x24039c(0xca)][_0x24039c(0xe9)],()=>_0x122320[_0x24039c(0xdd)](_0x598bac[_0x24039c(0xc3)][_0x24039c(0xeb)](_0x21bbdf=>{const _0x57e05f=_0x24039c;_0x21bbdf['type']===_0x3a479a['MCPEventId'][_0x57e05f(0xe9)]&&this[_0x57e05f(0xe5)](this[_0x57e05f(0xca)]['McpToolCallReceived'],_0x21bbdf['data']);}))),this['registerEventHandler'](this['Event'][_0x24039c(0xd4)],()=>_0x122320[_0x24039c(0xdd)](_0x598bac[_0x24039c(0xc3)][_0x24039c(0xeb)](_0x4bf773=>{const _0x24a895=_0x24039c;_0x4bf773['type']===_0x3a479a[_0x24a895(0xec)][_0x24a895(0xd4)]&&this[_0x24a895(0xe5)](this['Event'][_0x24a895(0xd4)],_0x4bf773['data']);}))),this['registerEventHandler'](this['Event'][_0x24039c(0xc0)],()=>_0x122320[_0x24039c(0xdd)](_0x598bac[_0x24039c(0xc3)][_0x24039c(0xeb)](_0x53ae66=>{const _0x25cc4f=_0x24039c;_0x53ae66[_0x25cc4f(0xd8)]===_0x3a479a['MCPEventId'][_0x25cc4f(0xc0)]&&this[_0x25cc4f(0xe5)](this[_0x25cc4f(0xca)][_0x25cc4f(0xc0)],_0x53ae66[_0x25cc4f(0xc5)]);})));}['validateMCPToolCall'](_0x2b5cf1,_0x22de15){const _0x436be1=_0x462dd9;return this['_injector'][_0x436be1(0xcb)](_0x3a479a[_0x436be1(0xed)])[_0x436be1(0xc8)](_0x2b5cf1,_0x22de15);}[_0x462dd9(0xdf)](){const _0x3a406f=_0x462dd9;return this[_0x3a406f(0xd1)][_0x3a406f(0xcb)](_0x3a479a[_0x3a406f(0xed)])[_0x3a406f(0xcc)]();}[_0x462dd9(0xd0)](_0x4605bf,_0x47decb){const _0x1222ec=_0x462dd9;return this[_0x1222ec(0xd1)][_0x1222ec(0xcb)](_0x3a479a[_0x1222ec(0xed)])[_0x1222ec(0xdb)](_0x4605bf,_0x47decb);}[_0x462dd9(0xd7)](){const _0x1e328f=_0x462dd9;return this[_0x1e328f(0xd1)][_0x1e328f(0xcb)](_0x3a479a[_0x1e328f(0xc9)])[_0x1e328f(0xe6)]();}['connectMCP'](){const _0x34a7ec=_0x462dd9;this[_0x34a7ec(0xd1)]['get'](_0x3a479a['MCPConnectionController'])['connect']();}['disconnectMCP'](){const _0x492107=_0x462dd9;this['_injector']['get'](_0x3a479a[_0x492107(0xc9)])[_0x492107(0xc2)]();}}_0x374edb[_0x462dd9(0xef)][_0x462dd9(0xe0)](_0x25025c);}));function _0x3f14(_0x396096,_0x773999){const _0x54b2af=_0x54b2();return _0x3f14=function(_0x3f14d0,_0x536a33){_0x3f14d0=_0x3f14d0-0xbf;let _0x47da1a=_0x54b2af[_0x3f14d0];return _0x47da1a;},_0x3f14(_0x396096,_0x773999);}function _0x54b2(){const _0x527bb3=['FUniver','registerEventHandler','McpToolCallFailed','McpConnectionStatusChanged','disconnect','event$','MCPEventService','data','654794JySiQp','83936OkJLYI','validateToolCall','MCPConnectionController','Event','get','getAllTools','UniverProMcp','23956092BRRpbp','@univerjs/core','callMCPTool','_injector','amd','327299ARWWAy','McpToolCallExecuted','object','FEventName','getMCPConnectionStatus','type','880868oeodoj','549zWFAod','executeTool','20KYFFVC','toDisposable','9mhCGvG','getAllMCPTools','extend','1wPVeyJ','UniverCore','4246748FQLUEs','935745UEKLat','fireEvent','getConnectionStatus','36PIOMuv','13RzgWiX','McpToolCallReceived','_registerMCPFacadeEvents','subscribe','MCPEventId','IMCPToolRegistry','function'];_0x54b2=function(){return _0x527bb3;};return _0x54b2();}