tabby-mcp-server 1.3.0 → 1.4.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tabby-mcp-server",
3
- "version": "1.3.0",
3
+ "version": "1.4.2",
4
4
  "description": "MCP (Model Context Protocol) server plugin for Tabby terminal - Complete terminal control with 34 MCP tools including SFTP file transfer",
5
5
  "homepage": "https://github.com/GentlemanHu/Tabby-MCP",
6
6
  "repository": {
@@ -11,7 +11,7 @@ import { ToolCategory, McpTool } from '../types/types';
11
11
  export declare class McpService {
12
12
  config: ConfigService;
13
13
  private logger;
14
- private server;
14
+ private sessionServers;
15
15
  private legacyTransports;
16
16
  private streamableTransports;
17
17
  private app;
@@ -19,17 +19,27 @@ export declare class McpService {
19
19
  private sockets;
20
20
  private isRunning;
21
21
  private toolCategories;
22
+ private registeredTools;
22
23
  constructor(config: ConfigService, logger: McpLoggerService);
23
24
  /**
24
- * Initialize the MCP server
25
+ * Initialize the MCP service (no longer creates a single server)
25
26
  */
26
27
  private initializeServer;
27
28
  /**
28
- * Register a tool category with the MCP server
29
+ * Create a new McpServer instance for a specific session
30
+ * Each client gets its own server to avoid SDK Bug #1459
31
+ */
32
+ private createServerForSession;
33
+ /**
34
+ * Clean up server for a specific session
35
+ */
36
+ private cleanupServerForSession;
37
+ /**
38
+ * Register a tool category - stores definitions for per-session server creation
29
39
  */
30
40
  registerToolCategory(category: ToolCategory): void;
31
41
  /**
32
- * Register a single tool
42
+ * Register a single tool - stores definition for per-session server creation
33
43
  */
34
44
  registerTool(tool: McpTool): void;
35
45
  /**
@@ -42,6 +42,7 @@ export declare class SFTPToolCategory extends BaseToolCategory {
42
42
  private terminalTools;
43
43
  name: string;
44
44
  private sftpSessionCache;
45
+ private readonly SFTP_SESSION_TTL_MS;
45
46
  private transferTasks;
46
47
  private _transferTasksSubject;
47
48
  readonly transferTasks$: import("rxjs").Observable<TransferTask[]>;
@@ -53,6 +54,22 @@ export declare class SFTPToolCategory extends BaseToolCategory {
53
54
  /** Emit current transfer state to UI subscribers */
54
55
  private emitTransferUpdate;
55
56
  private cleanupOldTransfers;
57
+ /**
58
+ * Wait for transfer to complete with a polling fallback.
59
+ *
60
+ * Tabby's SFTP API (based on russh) may not always resolve the Promise
61
+ * even when the transfer is complete. This method uses Promise.race to
62
+ * detect completion via polling the isComplete() method.
63
+ *
64
+ * Also checks for SSH session disconnection to prevent infinite waits.
65
+ *
66
+ * @param sftpPromise - The original sftpSession.upload/download promise
67
+ * @param transferObj - StreamFileUpload or StreamFileDownload with isComplete()
68
+ * @param sshSession - Optional SSH session to check for disconnection
69
+ * @param pollIntervalMs - How often to check isComplete()
70
+ * @param maxWaitMs - Maximum time to wait before timing out (0 = no timeout)
71
+ */
72
+ private waitForTransferComplete;
56
73
  /** Get current snapshot of all transfers */
57
74
  getTransfers(): TransferTask[];
58
75
  /** Cancel a transfer by ID (for UI button) */
@@ -67,6 +84,11 @@ export declare class SFTPToolCategory extends BaseToolCategory {
67
84
  private findAllSSHTabs;
68
85
  private findSSHSession;
69
86
  private getSFTPSession;
87
+ /**
88
+ * Cleanup stale SFTP sessions from closed SSH connections
89
+ * Called periodically when creating new sessions
90
+ */
91
+ private cleanupStaleSFTPSessions;
70
92
  private readonly sessionSchema;
71
93
  private createListFilesTool;
72
94
  private createReadFileTool;