@lanonasis/cli 3.0.7 → 3.0.8
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/dist/commands/mcp.js
CHANGED
|
@@ -2,6 +2,7 @@ import chalk from 'chalk';
|
|
|
2
2
|
import ora from 'ora';
|
|
3
3
|
import { table } from 'table';
|
|
4
4
|
import { getMCPClient } from '../utils/mcp-client.js';
|
|
5
|
+
import { EnhancedMCPClient } from '../mcp/client/enhanced-client.js';
|
|
5
6
|
import { CLIConfig } from '../utils/config.js';
|
|
6
7
|
export function mcpCommands(program) {
|
|
7
8
|
const mcp = program
|
|
@@ -92,12 +93,32 @@ export function mcpCommands(program) {
|
|
|
92
93
|
config.set('mcpServerUrl', options.url);
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
let connected = false;
|
|
97
|
+
// Use Enhanced MCP Client for better connection handling
|
|
98
|
+
const enhancedClient = new EnhancedMCPClient();
|
|
99
|
+
if (options.url) {
|
|
100
|
+
// Connect to specific URL (WebSocket or remote)
|
|
101
|
+
const serverConfig = {
|
|
102
|
+
name: 'user-specified',
|
|
103
|
+
type: (options.url.startsWith('wss://') ? 'websocket' : 'stdio'),
|
|
104
|
+
url: options.url,
|
|
105
|
+
priority: 1
|
|
106
|
+
};
|
|
107
|
+
connected = await enhancedClient.connectSingle(serverConfig);
|
|
108
|
+
if (connected) {
|
|
109
|
+
spinner.succeed(chalk.green(`Connected to MCP server at ${options.url}`));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// Fall back to old client for local connections
|
|
115
|
+
const client = getMCPClient();
|
|
116
|
+
connected = await client.connect({
|
|
117
|
+
connectionMode,
|
|
118
|
+
serverPath: options.server,
|
|
119
|
+
serverUrl: options.url
|
|
120
|
+
});
|
|
121
|
+
}
|
|
101
122
|
if (connected) {
|
|
102
123
|
spinner.succeed(chalk.green(`Connected to MCP server in ${connectionMode} mode`));
|
|
103
124
|
if (connectionMode === 'remote') {
|
package/dist/index.js
CHANGED
|
File without changes
|
|
@@ -217,13 +217,13 @@ export declare const BulkOperationSchema: z.ZodObject<{
|
|
|
217
217
|
transaction: z.ZodDefault<z.ZodBoolean>;
|
|
218
218
|
}, "strip", z.ZodTypeAny, {
|
|
219
219
|
operation?: "create" | "delete" | "update";
|
|
220
|
-
items?: Record<string, any>[];
|
|
221
220
|
entity_type?: "topic" | "memory" | "apikey";
|
|
221
|
+
items?: Record<string, any>[];
|
|
222
222
|
transaction?: boolean;
|
|
223
223
|
}, {
|
|
224
224
|
operation?: "create" | "delete" | "update";
|
|
225
|
-
items?: Record<string, any>[];
|
|
226
225
|
entity_type?: "topic" | "memory" | "apikey";
|
|
226
|
+
items?: Record<string, any>[];
|
|
227
227
|
transaction?: boolean;
|
|
228
228
|
}>;
|
|
229
229
|
export declare const ImportExportSchema: z.ZodObject<{
|
|
@@ -597,13 +597,13 @@ export declare const MCPSchemas: {
|
|
|
597
597
|
transaction: z.ZodDefault<z.ZodBoolean>;
|
|
598
598
|
}, "strip", z.ZodTypeAny, {
|
|
599
599
|
operation?: "create" | "delete" | "update";
|
|
600
|
-
items?: Record<string, any>[];
|
|
601
600
|
entity_type?: "topic" | "memory" | "apikey";
|
|
601
|
+
items?: Record<string, any>[];
|
|
602
602
|
transaction?: boolean;
|
|
603
603
|
}, {
|
|
604
604
|
operation?: "create" | "delete" | "update";
|
|
605
|
-
items?: Record<string, any>[];
|
|
606
605
|
entity_type?: "topic" | "memory" | "apikey";
|
|
606
|
+
items?: Record<string, any>[];
|
|
607
607
|
transaction?: boolean;
|
|
608
608
|
}>;
|
|
609
609
|
importExport: z.ZodObject<{
|
|
@@ -66,8 +66,10 @@ export class LanonasisMCPServer {
|
|
|
66
66
|
* Register MCP tools
|
|
67
67
|
*/
|
|
68
68
|
registerTools() {
|
|
69
|
-
//
|
|
70
|
-
|
|
69
|
+
// Import request schemas at the top of the method
|
|
70
|
+
const { ListToolsRequestSchema, CallToolRequestSchema } = require('@modelcontextprotocol/sdk/types.js');
|
|
71
|
+
// List available tools
|
|
72
|
+
this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
71
73
|
tools: [
|
|
72
74
|
// Memory tools
|
|
73
75
|
{
|
|
@@ -305,8 +307,8 @@ export class LanonasisMCPServer {
|
|
|
305
307
|
}
|
|
306
308
|
]
|
|
307
309
|
}));
|
|
308
|
-
// Tool call handler
|
|
309
|
-
this.server.setRequestHandler(
|
|
310
|
+
// Tool call handler (CallToolRequestSchema already imported above)
|
|
311
|
+
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
310
312
|
const { name, arguments: args } = request.params;
|
|
311
313
|
try {
|
|
312
314
|
const result = await this.handleToolCall(name, args);
|
package/package.json
CHANGED