@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.
- 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/mcp-tool-registry.controller.d.ts +4 -2
- package/lib/types/utils/json-utils.d.ts +13 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +4 -4
|
@@ -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
|
-
|
|
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();}
|