@mxf-dev/core 1.0.1 → 2.0.0
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/README.md +18 -0
- package/dist/adapters/FrameworkAdapter.js +1 -1
- package/dist/adapters/FrameworkAdapter.js.map +1 -1
- package/dist/config/ConfigManager.d.ts +9 -8
- package/dist/config/ConfigManager.d.ts.map +1 -1
- package/dist/config/ConfigManager.js +47 -17
- package/dist/config/ConfigManager.js.map +1 -1
- package/dist/config/memory-strata.config.d.ts +25 -0
- package/dist/config/memory-strata.config.d.ts.map +1 -0
- package/dist/config/memory-strata.config.js +107 -0
- package/dist/config/memory-strata.config.js.map +1 -0
- package/dist/constants/ToolNames.d.ts +1 -29
- package/dist/constants/ToolNames.d.ts.map +1 -1
- package/dist/constants/ToolNames.js +4 -17
- package/dist/constants/ToolNames.js.map +1 -1
- package/dist/database/DatabaseAdapterFactory.d.ts +14 -2
- package/dist/database/DatabaseAdapterFactory.d.ts.map +1 -1
- package/dist/database/DatabaseAdapterFactory.js +21 -6
- package/dist/database/DatabaseAdapterFactory.js.map +1 -1
- package/dist/database/adapters/mongodb/MongoBaseRepository.d.ts +7 -1
- package/dist/database/adapters/mongodb/MongoBaseRepository.d.ts.map +1 -1
- package/dist/database/adapters/mongodb/MongoBaseRepository.js +12 -2
- package/dist/database/adapters/mongodb/MongoBaseRepository.js.map +1 -1
- package/dist/events/ClientEventBus.d.ts +16 -77
- package/dist/events/ClientEventBus.d.ts.map +1 -1
- package/dist/events/ClientEventBus.js +38 -311
- package/dist/events/ClientEventBus.js.map +1 -1
- package/dist/events/EventBus.d.ts +1 -1
- package/dist/events/EventBus.d.ts.map +1 -1
- package/dist/events/EventBus.js +5 -4
- package/dist/events/EventBus.js.map +1 -1
- package/dist/events/EventBusBase.d.ts +139 -34
- package/dist/events/EventBusBase.d.ts.map +1 -1
- package/dist/events/EventBusBase.js +366 -88
- package/dist/events/EventBusBase.js.map +1 -1
- package/dist/events/EventNames.d.ts +10 -1
- package/dist/events/EventNames.d.ts.map +1 -1
- package/dist/events/EventNames.js +3 -0
- package/dist/events/EventNames.js.map +1 -1
- package/dist/events/PublicEvents.d.ts +6 -2
- package/dist/events/PublicEvents.d.ts.map +1 -1
- package/dist/events/PublicEvents.js +7 -4
- package/dist/events/PublicEvents.js.map +1 -1
- package/dist/events/ServerEventBus.d.ts +23 -112
- package/dist/events/ServerEventBus.d.ts.map +1 -1
- package/dist/events/ServerEventBus.js +58 -323
- package/dist/events/ServerEventBus.js.map +1 -1
- package/dist/events/event-definitions/LlmBudgetEvents.d.ts +68 -0
- package/dist/events/event-definitions/LlmBudgetEvents.d.ts.map +1 -0
- package/dist/events/event-definitions/LlmBudgetEvents.js +35 -0
- package/dist/events/event-definitions/LlmBudgetEvents.js.map +1 -0
- package/dist/interfaces/IMemoryPersistence.d.ts +41 -0
- package/dist/interfaces/IMemoryPersistence.d.ts.map +1 -0
- package/dist/interfaces/IMemoryPersistence.js +15 -0
- package/dist/interfaces/IMemoryPersistence.js.map +1 -0
- package/dist/middleware/MxpMiddleware.d.ts +8 -1
- package/dist/middleware/MxpMiddleware.d.ts.map +1 -1
- package/dist/middleware/MxpMiddleware.js +42 -20
- package/dist/middleware/MxpMiddleware.js.map +1 -1
- package/dist/models/channelKey.d.ts +1 -0
- package/dist/models/channelKey.d.ts.map +1 -1
- package/dist/models/channelKey.js +5 -0
- package/dist/models/channelKey.js.map +1 -1
- package/dist/models/memoryUtility.d.ts +39 -0
- package/dist/models/memoryUtility.d.ts.map +1 -0
- package/dist/models/memoryUtility.js +39 -0
- package/dist/models/memoryUtility.js.map +1 -0
- package/dist/models/user.d.ts.map +1 -1
- package/dist/models/user.js +23 -1
- package/dist/models/user.js.map +1 -1
- package/dist/mxp/BinaryProtocolLayer.d.ts +24 -8
- package/dist/mxp/BinaryProtocolLayer.d.ts.map +1 -1
- package/dist/mxp/BinaryProtocolLayer.js +90 -103
- package/dist/mxp/BinaryProtocolLayer.js.map +1 -1
- package/dist/mxp/ContextCompressionEngine.d.ts +57 -10
- package/dist/mxp/ContextCompressionEngine.d.ts.map +1 -1
- package/dist/mxp/ContextCompressionEngine.js +170 -128
- package/dist/mxp/ContextCompressionEngine.js.map +1 -1
- package/dist/mxp/MxpTokenOptimizer.d.ts +7 -3
- package/dist/mxp/MxpTokenOptimizer.d.ts.map +1 -1
- package/dist/mxp/MxpTokenOptimizer.js +8 -5
- package/dist/mxp/MxpTokenOptimizer.js.map +1 -1
- package/dist/prompts/MxfAgentSystemPrompt.d.ts +1 -1
- package/dist/prompts/MxfAgentSystemPrompt.d.ts.map +1 -1
- package/dist/prompts/MxfAgentSystemPrompt.js +47 -57
- package/dist/prompts/MxfAgentSystemPrompt.js.map +1 -1
- package/dist/protocols/mcp/ToolError.d.ts +123 -0
- package/dist/protocols/mcp/ToolError.d.ts.map +1 -0
- package/dist/protocols/mcp/ToolError.js +108 -0
- package/dist/protocols/mcp/ToolError.js.map +1 -0
- package/dist/protocols/mcp/defineTool.d.ts +133 -0
- package/dist/protocols/mcp/defineTool.d.ts.map +1 -0
- package/dist/protocols/mcp/defineTool.js +236 -0
- package/dist/protocols/mcp/defineTool.js.map +1 -0
- package/dist/protocols/mcp/security/HttpTargetGuard.d.ts +38 -0
- package/dist/protocols/mcp/security/HttpTargetGuard.d.ts.map +1 -0
- package/dist/protocols/mcp/security/HttpTargetGuard.js +227 -0
- package/dist/protocols/mcp/security/HttpTargetGuard.js.map +1 -0
- package/dist/protocols/mcp/security/McpSecurityGuard.d.ts +9 -1
- package/dist/protocols/mcp/security/McpSecurityGuard.d.ts.map +1 -1
- package/dist/protocols/mcp/security/McpSecurityGuard.js +10 -2
- package/dist/protocols/mcp/security/McpSecurityGuard.js.map +1 -1
- package/dist/protocols/mcp/security/McpToolPolicy.d.ts +81 -0
- package/dist/protocols/mcp/security/McpToolPolicy.d.ts.map +1 -0
- package/dist/protocols/mcp/security/McpToolPolicy.js +202 -0
- package/dist/protocols/mcp/security/McpToolPolicy.js.map +1 -0
- package/dist/protocols/mcp/services/ExternalMcpServerManager.d.ts +51 -18
- package/dist/protocols/mcp/services/ExternalMcpServerManager.d.ts.map +1 -1
- package/dist/protocols/mcp/services/ExternalMcpServerManager.js +256 -283
- package/dist/protocols/mcp/services/ExternalMcpServerManager.js.map +1 -1
- package/dist/protocols/mcp/services/ExternalServerConfigs.d.ts +39 -6
- package/dist/protocols/mcp/services/ExternalServerConfigs.d.ts.map +1 -1
- package/dist/protocols/mcp/services/ExternalServerConfigs.js +76 -18
- package/dist/protocols/mcp/services/ExternalServerConfigs.js.map +1 -1
- package/dist/protocols/mcp/tools/AnalyticsTools.js +1 -1
- package/dist/protocols/mcp/tools/AnalyticsTools.js.map +1 -1
- package/dist/protocols/mcp/tools/CodeAnalysisTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/CodeAnalysisTools.js +15 -0
- package/dist/protocols/mcp/tools/CodeAnalysisTools.js.map +1 -1
- package/dist/protocols/mcp/tools/EffectivenessTools.js +3 -3
- package/dist/protocols/mcp/tools/EffectivenessTools.js.map +1 -1
- package/dist/protocols/mcp/tools/GitTools.d.ts +9 -369
- package/dist/protocols/mcp/tools/GitTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/GitTools.js +222 -517
- package/dist/protocols/mcp/tools/GitTools.js.map +1 -1
- package/dist/protocols/mcp/tools/InfrastructureTools.d.ts +56 -24
- package/dist/protocols/mcp/tools/InfrastructureTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/InfrastructureTools.js +117 -26
- package/dist/protocols/mcp/tools/InfrastructureTools.js.map +1 -1
- package/dist/protocols/mcp/tools/MemorySearchTools.d.ts +0 -3
- package/dist/protocols/mcp/tools/MemorySearchTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/MemorySearchTools.js +58 -1
- package/dist/protocols/mcp/tools/MemorySearchTools.js.map +1 -1
- package/dist/protocols/mcp/tools/OrparTools.d.ts +8 -0
- package/dist/protocols/mcp/tools/OrparTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/OrparTools.js +66 -0
- package/dist/protocols/mcp/tools/OrparTools.js.map +1 -1
- package/dist/protocols/mcp/tools/SafetyTools.d.ts +7 -525
- package/dist/protocols/mcp/tools/SafetyTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/SafetyTools.js +349 -514
- package/dist/protocols/mcp/tools/SafetyTools.js.map +1 -1
- package/dist/protocols/mcp/tools/TaskPlanningTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/TaskPlanningTools.js +56 -26
- package/dist/protocols/mcp/tools/TaskPlanningTools.js.map +1 -1
- package/dist/protocols/mcp/tools/TestTools.d.ts +15 -376
- package/dist/protocols/mcp/tools/TestTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/TestTools.js +241 -363
- package/dist/protocols/mcp/tools/TestTools.js.map +1 -1
- package/dist/protocols/mcp/tools/TypeScriptTools.d.ts +6 -276
- package/dist/protocols/mcp/tools/TypeScriptTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/TypeScriptTools.js +223 -337
- package/dist/protocols/mcp/tools/TypeScriptTools.js.map +1 -1
- package/dist/protocols/mcp/tools/WebTools.d.ts +15 -728
- package/dist/protocols/mcp/tools/WebTools.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/WebTools.js +151 -257
- package/dist/protocols/mcp/tools/WebTools.js.map +1 -1
- package/dist/protocols/mcp/tools/shell/ShellExecuteHandler.d.ts +5 -3
- package/dist/protocols/mcp/tools/shell/ShellExecuteHandler.d.ts.map +1 -1
- package/dist/protocols/mcp/tools/shell/ShellExecuteHandler.js +31 -6
- package/dist/protocols/mcp/tools/shell/ShellExecuteHandler.js.map +1 -1
- package/dist/schemas/EventPayloadSchema.d.ts +21 -0
- package/dist/schemas/EventPayloadSchema.d.ts.map +1 -1
- package/dist/schemas/EventPayloadSchema.js +14 -0
- package/dist/schemas/EventPayloadSchema.js.map +1 -1
- package/dist/services/BackgroundTaskManager.d.ts.map +1 -1
- package/dist/services/BackgroundTaskManager.js +12 -4
- package/dist/services/BackgroundTaskManager.js.map +1 -1
- package/dist/services/BrowserManager.d.ts +1 -1
- package/dist/services/BrowserManager.d.ts.map +1 -1
- package/dist/services/BrowserManager.js +26 -3
- package/dist/services/BrowserManager.js.map +1 -1
- package/dist/services/MemoryCompressor.d.ts +11 -2
- package/dist/services/MemoryCompressor.d.ts.map +1 -1
- package/dist/services/MemoryCompressor.js +8 -26
- package/dist/services/MemoryCompressor.js.map +1 -1
- package/dist/services/MemoryService.d.ts +16 -3
- package/dist/services/MemoryService.d.ts.map +1 -1
- package/dist/services/MemoryService.js +79 -55
- package/dist/services/MemoryService.js.map +1 -1
- package/dist/services/PredictiveAnalyticsService.d.ts +34 -4
- package/dist/services/PredictiveAnalyticsService.d.ts.map +1 -1
- package/dist/services/PredictiveAnalyticsService.js +41 -25
- package/dist/services/PredictiveAnalyticsService.js.map +1 -1
- package/dist/services/QValueManager.d.ts +7 -0
- package/dist/services/QValueManager.d.ts.map +1 -1
- package/dist/services/QValueManager.js +9 -0
- package/dist/services/QValueManager.js.map +1 -1
- package/dist/services/RewardSignalProcessor.d.ts +38 -1
- package/dist/services/RewardSignalProcessor.d.ts.map +1 -1
- package/dist/services/RewardSignalProcessor.js +109 -7
- package/dist/services/RewardSignalProcessor.js.map +1 -1
- package/dist/services/SharedStateService.d.ts +16 -2
- package/dist/services/SharedStateService.d.ts.map +1 -1
- package/dist/services/SharedStateService.js +44 -3
- package/dist/services/SharedStateService.js.map +1 -1
- package/dist/services/TaskEffectivenessService.d.ts +34 -18
- package/dist/services/TaskEffectivenessService.d.ts.map +1 -1
- package/dist/services/TaskEffectivenessService.js +91 -155
- package/dist/services/TaskEffectivenessService.js.map +1 -1
- package/dist/services/WebSearchService.d.ts.map +1 -1
- package/dist/services/WebSearchService.js.map +1 -1
- package/dist/services/dag/TaskDagService.d.ts.map +1 -1
- package/dist/services/dag/TaskDagService.js +2 -0
- package/dist/services/dag/TaskDagService.js.map +1 -1
- package/dist/services/orpar-memory/OrparMemoryCoordinator.d.ts +7 -0
- package/dist/services/orpar-memory/OrparMemoryCoordinator.d.ts.map +1 -1
- package/dist/services/orpar-memory/OrparMemoryCoordinator.js +71 -10
- package/dist/services/orpar-memory/OrparMemoryCoordinator.js.map +1 -1
- package/dist/types/MemoryUtilityTypes.d.ts +2 -0
- package/dist/types/MemoryUtilityTypes.d.ts.map +1 -1
- package/dist/types/MemoryUtilityTypes.js.map +1 -1
- package/dist/utils/Logger.d.ts +43 -3
- package/dist/utils/Logger.d.ts.map +1 -1
- package/dist/utils/Logger.js +78 -36
- package/dist/utils/Logger.js.map +1 -1
- package/dist/utils/MxpEncryption.d.ts +19 -6
- package/dist/utils/MxpEncryption.d.ts.map +1 -1
- package/dist/utils/MxpEncryption.js +48 -16
- package/dist/utils/MxpEncryption.js.map +1 -1
- package/package.json +19 -4
- package/src/adapters/FrameworkAdapter.ts +1 -1
- package/src/config/ConfigManager.ts +52 -19
- package/src/config/memory-strata.config.ts +136 -0
- package/src/constants/ToolNames.ts +4 -18
- package/src/database/DatabaseAdapterFactory.ts +23 -6
- package/src/database/adapters/mongodb/MongoBaseRepository.ts +16 -2
- package/src/events/ClientEventBus.ts +68 -403
- package/src/events/EventBus.ts +7 -8
- package/src/events/EventBusBase.ts +479 -116
- package/src/events/EventNames.ts +6 -0
- package/src/events/PublicEvents.ts +7 -4
- package/src/events/ServerEventBus.ts +78 -473
- package/src/events/event-definitions/LlmBudgetEvents.ts +74 -0
- package/src/interfaces/IMemoryPersistence.ts +51 -0
- package/src/middleware/MxpMiddleware.ts +51 -24
- package/src/models/channelKey.ts +18 -4
- package/src/models/memoryUtility.ts +64 -0
- package/src/models/user.ts +36 -4
- package/src/mxp/BinaryProtocolLayer.ts +108 -124
- package/src/mxp/ContextCompressionEngine.ts +219 -161
- package/src/mxp/MxpTokenOptimizer.ts +10 -10
- package/src/prompts/MxfAgentSystemPrompt.ts +45 -55
- package/src/protocols/mcp/ToolError.ts +201 -0
- package/src/protocols/mcp/defineTool.ts +379 -0
- package/src/protocols/mcp/security/HttpTargetGuard.ts +267 -0
- package/src/protocols/mcp/security/McpSecurityGuard.ts +10 -3
- package/src/protocols/mcp/security/McpToolPolicy.ts +221 -0
- package/src/protocols/mcp/services/ExternalMcpServerManager.ts +340 -322
- package/src/protocols/mcp/services/ExternalServerConfigs.ts +82 -19
- package/src/protocols/mcp/tools/AnalyticsTools.ts +1 -1
- package/src/protocols/mcp/tools/CodeAnalysisTools.ts +15 -0
- package/src/protocols/mcp/tools/EffectivenessTools.ts +3 -3
- package/src/protocols/mcp/tools/GitTools.ts +290 -569
- package/src/protocols/mcp/tools/InfrastructureTools.ts +189 -43
- package/src/protocols/mcp/tools/MemorySearchTools.ts +77 -1
- package/src/protocols/mcp/tools/OrparTools.ts +87 -0
- package/src/protocols/mcp/tools/SafetyTools.ts +501 -579
- package/src/protocols/mcp/tools/TaskPlanningTools.ts +81 -39
- package/src/protocols/mcp/tools/TestTools.ts +339 -419
- package/src/protocols/mcp/tools/TypeScriptTools.ts +316 -376
- package/src/protocols/mcp/tools/WebTools.ts +209 -307
- package/src/protocols/mcp/tools/shell/ShellExecuteHandler.ts +53 -14
- package/src/schemas/EventPayloadSchema.ts +37 -0
- package/src/services/BackgroundTaskManager.ts +12 -4
- package/src/services/BrowserManager.ts +41 -1
- package/src/services/MemoryCompressor.ts +20 -32
- package/src/services/MemoryService.ts +96 -58
- package/src/services/PredictiveAnalyticsService.ts +55 -32
- package/src/services/QValueManager.ts +10 -0
- package/src/services/RewardSignalProcessor.ts +138 -9
- package/src/services/SharedStateService.ts +56 -8
- package/src/services/TaskEffectivenessService.ts +114 -187
- package/src/services/WebSearchService.ts +2 -1
- package/src/services/dag/TaskDagService.ts +2 -0
- package/src/services/orpar-memory/OrparMemoryCoordinator.ts +86 -10
- package/src/types/MemoryUtilityTypes.ts +2 -0
- package/src/utils/Logger.ts +116 -40
- package/src/utils/MxpEncryption.ts +69 -34
- package/dist/mxp/MxpEventForwardingEnhancer.d.ts +0 -134
- package/dist/mxp/MxpEventForwardingEnhancer.d.ts.map +0 -1
- package/dist/mxp/MxpEventForwardingEnhancer.js +0 -361
- package/dist/mxp/MxpEventForwardingEnhancer.js.map +0 -1
- package/dist/protocols/mcp/services/ToolSchemaEnhancements.d.ts +0 -56
- package/dist/protocols/mcp/services/ToolSchemaEnhancements.d.ts.map +0 -1
- package/dist/protocols/mcp/services/ToolSchemaEnhancements.js +0 -57
- package/dist/protocols/mcp/services/ToolSchemaEnhancements.js.map +0 -1
- package/dist/protocols/mcp/tools/ControlLoopLifecycle.d.ts +0 -270
- package/dist/protocols/mcp/tools/ControlLoopLifecycle.d.ts.map +0 -1
- package/dist/protocols/mcp/tools/ControlLoopLifecycle.js +0 -256
- package/dist/protocols/mcp/tools/ControlLoopLifecycle.js.map +0 -1
- package/dist/protocols/mcp/tools/LspTools.d.ts +0 -495
- package/dist/protocols/mcp/tools/LspTools.d.ts.map +0 -1
- package/dist/protocols/mcp/tools/LspTools.js +0 -469
- package/dist/protocols/mcp/tools/LspTools.js.map +0 -1
- package/src/mxp/MxpEventForwardingEnhancer.ts +0 -471
- package/src/protocols/mcp/services/ToolSchemaEnhancements.ts +0 -92
- package/src/protocols/mcp/tools/ControlLoopLifecycle.ts +0 -302
- package/src/protocols/mcp/tools/LspTools.ts +0 -476
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
import * as path from 'path';
|
|
29
|
-
import * as os from 'os';
|
|
30
29
|
import { ExternalServerConfig } from './ExternalMcpServerManager.js';
|
|
30
|
+
import { getWorkspaceRoot } from '../security/McpToolPolicy.js';
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Configuration for the Calculator MCP Server
|
|
@@ -72,28 +72,34 @@ export const SEQUENTIAL_THINKING_SERVER_CONFIG: ExternalServerConfig = {
|
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
* Configuration for the Filesystem MCP Server
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
75
|
+
* Configuration for the Filesystem MCP Server.
|
|
76
|
+
*
|
|
77
|
+
* The allowed roots are the configured workspace directory plus a scratch
|
|
78
|
+
* directory. This used to pass `os.homedir()`, which handed every agent read
|
|
79
|
+
* access to the entire home directory — including ~/.ssh, ~/.aws, and
|
|
80
|
+
* ~/.mxf/config.json, which is where the MXF CLI stores its own credentials.
|
|
81
|
+
*
|
|
82
|
+
* The server only auto-starts when MXF_WORKSPACE_ROOT is set. There is no default:
|
|
83
|
+
* a filesystem server needs an operator to say which directory agents may touch,
|
|
84
|
+
* and the previous default answered that question with "all of them".
|
|
80
85
|
*/
|
|
81
86
|
export const FILESYSTEM_SERVER_CONFIG: ExternalServerConfig = {
|
|
82
87
|
id: 'filesystem',
|
|
83
88
|
name: 'Filesystem Server',
|
|
84
89
|
version: '0.6.0',
|
|
85
|
-
description: '
|
|
90
|
+
description: 'File operations scoped to the configured workspace directory',
|
|
86
91
|
command: 'npx',
|
|
87
|
-
// MCP filesystem server
|
|
88
|
-
// Include the user's home directory so agents can access any folder the
|
|
89
|
-
// user selects as their working directory (e.g., via the desktop folder picker).
|
|
92
|
+
// The MCP filesystem server takes its allowed directories as positional args.
|
|
90
93
|
args: [
|
|
91
94
|
'-y',
|
|
92
95
|
'@modelcontextprotocol/server-filesystem',
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
// Empty when unset. getFilesystemServerConfig() below is what callers
|
|
97
|
+
// should use — it fails fast rather than spawning a server with no root.
|
|
98
|
+
getWorkspaceRoot() ?? '',
|
|
99
|
+
'/tmp/mcp-workspace'
|
|
100
|
+
].filter(arg => arg.length > 0),
|
|
101
|
+
// Only auto-start when a workspace is configured.
|
|
102
|
+
autoStart: getWorkspaceRoot() !== undefined,
|
|
97
103
|
restartOnCrash: true,
|
|
98
104
|
healthCheckInterval: 30000,
|
|
99
105
|
maxRestartAttempts: 3,
|
|
@@ -169,24 +175,45 @@ export const MEMORY_SERVER_CONFIG: ExternalServerConfig = {
|
|
|
169
175
|
};
|
|
170
176
|
|
|
171
177
|
/**
|
|
172
|
-
* Configuration for the MongoDB Lens MCP Server
|
|
173
|
-
*
|
|
178
|
+
* Configuration for the MongoDB Lens MCP Server.
|
|
179
|
+
*
|
|
180
|
+
* OFF by default, and it must stay that way unless you have pointed it somewhere
|
|
181
|
+
* safe.
|
|
182
|
+
*
|
|
183
|
+
* This server hands agents a query interface to whatever MONGODB_URI names. In a
|
|
184
|
+
* default MXF deployment that is the framework's own database — the one holding
|
|
185
|
+
* the users collection, personal access tokens, and agent API keys. It used to
|
|
186
|
+
* auto-start against exactly that.
|
|
187
|
+
*
|
|
188
|
+
* To enable it:
|
|
189
|
+
* 1. Create a MongoDB user with read-only access to a SEPARATE database — not
|
|
190
|
+
* the one MXF stores its credentials in.
|
|
191
|
+
* 2. Set MONGODB_LENS_URI to that user's connection string.
|
|
192
|
+
* 3. Set autoStart, or start the server explicitly through the hybrid MCP API.
|
|
193
|
+
*
|
|
194
|
+
* MONGODB_LENS_URI is deliberately a different variable from MONGODB_URI, so that
|
|
195
|
+
* enabling this server cannot silently reuse the framework's own credentials.
|
|
174
196
|
*/
|
|
175
197
|
export const MONGODB_LENS_SERVER_CONFIG: ExternalServerConfig = {
|
|
176
198
|
id: 'mongodb-lens',
|
|
177
199
|
name: 'MongoDB Lens Server',
|
|
178
200
|
version: '1.0.0',
|
|
179
|
-
description: '
|
|
201
|
+
description: 'Schema analysis, query optimization and aggregation building against a configured MongoDB database',
|
|
180
202
|
command: 'npx',
|
|
181
203
|
args: ['-y', 'mongodb-lens'],
|
|
182
|
-
|
|
204
|
+
// Opt-in only. Never point this at the database that holds MXF's users, PATs
|
|
205
|
+
// and API keys.
|
|
206
|
+
autoStart: false,
|
|
183
207
|
restartOnCrash: true,
|
|
184
208
|
healthCheckInterval: 30000,
|
|
185
209
|
maxRestartAttempts: 3,
|
|
186
210
|
startupTimeout: 15000, // MongoDB connection may take longer
|
|
187
211
|
environmentVariables: {
|
|
188
212
|
NODE_ENV: 'production',
|
|
189
|
-
|
|
213
|
+
// Validated non-empty at spawn time by ExternalMcpServerManager, so starting
|
|
214
|
+
// this server without MONGODB_LENS_URI set fails with a clear error instead
|
|
215
|
+
// of falling back to the framework's own database.
|
|
216
|
+
MONGODB_URI: process.env.MONGODB_LENS_URI ?? ''
|
|
190
217
|
}
|
|
191
218
|
};
|
|
192
219
|
|
|
@@ -285,6 +312,42 @@ export const EXTERNAL_SERVER_CONFIGS: ExternalServerConfig[] = [
|
|
|
285
312
|
// FETCH_SERVER_CONFIG, // DISABLED: MCP protocol integration issues (replaced by internal web tools)
|
|
286
313
|
];
|
|
287
314
|
|
|
315
|
+
/**
|
|
316
|
+
* The filesystem server's configuration, or a thrown error explaining why it
|
|
317
|
+
* cannot be started.
|
|
318
|
+
*
|
|
319
|
+
* Use this instead of FILESYSTEM_SERVER_CONFIG when starting the server on
|
|
320
|
+
* purpose: it refuses to hand out a filesystem server with no configured root,
|
|
321
|
+
* rather than spawning one whose allowed directories are whatever happens to be
|
|
322
|
+
* left in the args array.
|
|
323
|
+
*
|
|
324
|
+
* @throws Error when MXF_WORKSPACE_ROOT is not set
|
|
325
|
+
*/
|
|
326
|
+
export const getFilesystemServerConfig = (): ExternalServerConfig => {
|
|
327
|
+
const workspaceRoot = getWorkspaceRoot();
|
|
328
|
+
|
|
329
|
+
if (!workspaceRoot) {
|
|
330
|
+
throw new Error(
|
|
331
|
+
'The filesystem MCP server needs a workspace directory, but MXF_WORKSPACE_ROOT is not set. ' +
|
|
332
|
+
'Set it to the directory agents may read and write ' +
|
|
333
|
+
'(for example: MXF_WORKSPACE_ROOT=/Users/you/projects/my-app). ' +
|
|
334
|
+
'It has no default — the previous default was your home directory, which exposed ' +
|
|
335
|
+
'~/.ssh, ~/.aws and ~/.mxf/config.json to every agent.'
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return {
|
|
340
|
+
...FILESYSTEM_SERVER_CONFIG,
|
|
341
|
+
args: [
|
|
342
|
+
'-y',
|
|
343
|
+
'@modelcontextprotocol/server-filesystem',
|
|
344
|
+
workspaceRoot,
|
|
345
|
+
'/tmp/mcp-workspace'
|
|
346
|
+
],
|
|
347
|
+
autoStart: true
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
|
|
288
351
|
/**
|
|
289
352
|
* Get configurations for auto-start servers only
|
|
290
353
|
*/
|
|
@@ -347,7 +347,7 @@ export const analytics_task_completion: McpToolDefinition = {
|
|
|
347
347
|
timeRange === '7d' ? 7 * 24 * 60 * 60 * 1000 :
|
|
348
348
|
30 * 24 * 60 * 60 * 1000;
|
|
349
349
|
const startTime = now - timeRangeMs;
|
|
350
|
-
const taskAnalytics = effectivenessService.getAnalytics(startTime, now, channelId);
|
|
350
|
+
const taskAnalytics = await effectivenessService.getAnalytics(startTime, now, channelId);
|
|
351
351
|
|
|
352
352
|
return createToolResult(true, {
|
|
353
353
|
timeRange,
|
|
@@ -258,6 +258,11 @@ export const analyzeCodebaseTool = {
|
|
|
258
258
|
'-o', '-name', '*.js',
|
|
259
259
|
'-o', '-name', '*.jsx'
|
|
260
260
|
], {
|
|
261
|
+
context: {
|
|
262
|
+
agentId: context.agentId,
|
|
263
|
+
channelId: context.channelId,
|
|
264
|
+
requestId: context.requestId
|
|
265
|
+
},
|
|
261
266
|
workingDirectory: workingDir,
|
|
262
267
|
captureOutput: true
|
|
263
268
|
});
|
|
@@ -371,6 +376,11 @@ export const findFunctionsTool = {
|
|
|
371
376
|
'--no-heading',
|
|
372
377
|
`(function\\s+${args.functionName}|const\\s+${args.functionName}\\s*=|${args.functionName}\\s*:\\s*function|${args.functionName}\\s*:\\s*\\()`
|
|
373
378
|
], {
|
|
379
|
+
context: {
|
|
380
|
+
agentId: context.agentId,
|
|
381
|
+
channelId: context.channelId,
|
|
382
|
+
requestId: context.requestId
|
|
383
|
+
},
|
|
374
384
|
workingDirectory: workingDir,
|
|
375
385
|
captureOutput: true
|
|
376
386
|
});
|
|
@@ -494,6 +504,11 @@ export const traceDependenciesTool = {
|
|
|
494
504
|
'--no-heading',
|
|
495
505
|
`from\\s+['"].*${importPattern}['"]`
|
|
496
506
|
], {
|
|
507
|
+
context: {
|
|
508
|
+
agentId: context.agentId,
|
|
509
|
+
channelId: context.channelId,
|
|
510
|
+
requestId: context.requestId
|
|
511
|
+
},
|
|
497
512
|
workingDirectory: workingDir,
|
|
498
513
|
captureOutput: true
|
|
499
514
|
});
|
|
@@ -279,7 +279,7 @@ export const task_effectiveness_complete: McpToolDefinition = {
|
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
const comparison = effectivenessService.compareWithBaseline(taskId);
|
|
282
|
+
const comparison = await effectivenessService.compareWithBaseline(taskId);
|
|
283
283
|
|
|
284
284
|
return createToolResult(true, {
|
|
285
285
|
message: 'Task completed and effectiveness measured',
|
|
@@ -338,7 +338,7 @@ export const task_effectiveness_analytics: McpToolDefinition = {
|
|
|
338
338
|
};
|
|
339
339
|
|
|
340
340
|
const startTime = now - ranges[timeRange as keyof typeof ranges];
|
|
341
|
-
const analytics = await effectivenessService.
|
|
341
|
+
const analytics = await effectivenessService.getAnalytics(
|
|
342
342
|
startTime,
|
|
343
343
|
now,
|
|
344
344
|
channelId as ChannelId,
|
|
@@ -395,7 +395,7 @@ export const task_effectiveness_compare: McpToolDefinition = {
|
|
|
395
395
|
handler: async ({ taskId }: any) => {
|
|
396
396
|
const effectivenessService = TaskEffectivenessService.getInstance();
|
|
397
397
|
try {
|
|
398
|
-
const comparison = effectivenessService.compareWithBaseline(taskId);
|
|
398
|
+
const comparison = await effectivenessService.compareWithBaseline(taskId);
|
|
399
399
|
if (!comparison) {
|
|
400
400
|
return createToolResult(false, {
|
|
401
401
|
error: 'Task not found or no comparison available'
|