tabby-mcp-server 1.0.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 ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "tabby-mcp-server",
3
+ "version": "1.0.2",
4
+ "description": "MCP (Model Context Protocol) server plugin for Tabby terminal - Complete terminal control with 18 MCP tools",
5
+ "homepage": "https://github.com/GentlemanHu/Tabby-MCP",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/GentlemanHu/Tabby-MCP.git"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/GentlemanHu/Tabby-MCP/issues"
12
+ },
13
+ "keywords": [
14
+ "tabby-plugin",
15
+ "mcp",
16
+ "model-context-protocol",
17
+ "terminal",
18
+ "ai",
19
+ "cursor",
20
+ "windsurf",
21
+ "ssh",
22
+ "sse"
23
+ ],
24
+ "main": "dist/index.js",
25
+ "typings": "typings/index.d.ts",
26
+ "scripts": {
27
+ "build": "webpack --progress --color",
28
+ "watch": "webpack --progress --color --watch",
29
+ "install-plugin": "bash scripts/install.sh",
30
+ "uninstall-plugin": "bash scripts/uninstall.sh"
31
+ },
32
+ "files": [
33
+ "dist",
34
+ "typings"
35
+ ],
36
+ "author": "GentlemanHu <gentlemanhu@github.com>",
37
+ "contributors": [
38
+ "AI Assistant (Claude/Gemini)"
39
+ ],
40
+ "license": "MIT",
41
+ "dependencies": {
42
+ "@modelcontextprotocol/sdk": "^1.8.0",
43
+ "@xterm/addon-serialize": "^0.12.0",
44
+ "cors": "^2.8.5",
45
+ "express": "^4.18.2",
46
+ "zod": "^3.22.4"
47
+ },
48
+ "peerDependencies": {
49
+ "@angular/animations": "*",
50
+ "@angular/common": "*",
51
+ "@angular/core": "*",
52
+ "@angular/forms": "*",
53
+ "@ng-bootstrap/ng-bootstrap": "*",
54
+ "rxjs": "*",
55
+ "tabby-core": "*",
56
+ "tabby-settings": "*",
57
+ "tabby-terminal": "*"
58
+ },
59
+ "devDependencies": {
60
+ "@angular/common": "^17.3.0",
61
+ "@angular/core": "^17.3.0",
62
+ "@angular/forms": "^17.3.0",
63
+ "@angular/animations": "^17.3.0",
64
+ "@angular/platform-browser": "^17.3.0",
65
+ "@ng-bootstrap/ng-bootstrap": "^16.0.0",
66
+ "rxjs": "^7.8.0",
67
+ "tabby-core": "^1.0.163",
68
+ "tabby-settings": "^1.0.163",
69
+ "tabby-terminal": "^1.0.163",
70
+ "@types/cors": "^2.8.17",
71
+ "@types/express": "^4.17.21",
72
+ "@types/node": "^20.10.0",
73
+ "apply-loader": "^2.0.0",
74
+ "css-loader": "^6.8.1",
75
+ "sass": "^1.69.0",
76
+ "sass-loader": "^13.3.2",
77
+ "strip-ansi": "^7.1.0",
78
+ "style-loader": "^3.3.3",
79
+ "ts-loader": "^9.5.0",
80
+ "typescript": "^5.3.0",
81
+ "webpack": "^5.89.0",
82
+ "webpack-cli": "^5.1.4"
83
+ }
84
+ }
@@ -0,0 +1,20 @@
1
+ import { ConfigService } from 'tabby-core';
2
+ import { McpService } from '../services/mcpService';
3
+ import { McpLoggerService } from '../services/mcpLogger.service';
4
+ /**
5
+ * MCP Settings Tab Component
6
+ */
7
+ export declare class McpSettingsTabComponent {
8
+ config: ConfigService;
9
+ private mcpService;
10
+ private logger;
11
+ constructor(config: ConfigService, mcpService: McpService, logger: McpLoggerService);
12
+ get isRunning(): boolean;
13
+ get activeConnections(): number;
14
+ toggleServer(): Promise<void>;
15
+ restartServer(): Promise<void>;
16
+ viewLogs(): void;
17
+ clearLogs(): void;
18
+ getConfigExample(): string;
19
+ copyConfig(): void;
20
+ }
@@ -0,0 +1,37 @@
1
+ import { AppService, ConfigService } from 'tabby-core';
2
+ import { McpService } from './services/mcpService';
3
+ import { McpLoggerService } from './services/mcpLogger.service';
4
+ import { TerminalToolCategory } from './tools/terminal';
5
+ import { TabManagementToolCategory } from './tools/tabManagement';
6
+ import './styles.scss';
7
+ /**
8
+ * MCP Module - Main Angular module for the Tabby MCP plugin
9
+ *
10
+ * Features:
11
+ * - Complete terminal control (exec, buffer, abort)
12
+ * - Tab management (create, close, duplicate, move, select)
13
+ * - Profile management (list, open, quick connect SSH)
14
+ * - Pair programming mode with command confirmation
15
+ * - Comprehensive logging
16
+ */
17
+ export default class McpModule {
18
+ private app;
19
+ private config;
20
+ private mcpService;
21
+ private logger;
22
+ private terminalTools;
23
+ private tabManagementTools;
24
+ private initialized;
25
+ constructor(app: AppService, config: ConfigService, mcpService: McpService, logger: McpLoggerService, terminalTools: TerminalToolCategory, tabManagementTools: TabManagementToolCategory);
26
+ /**
27
+ * Initialize MCP server on application boot
28
+ */
29
+ private initializeOnBoot;
30
+ }
31
+ export * from './services/mcpService';
32
+ export * from './services/mcpLogger.service';
33
+ export * from './services/mcpConfigProvider';
34
+ export * from './services/dialog.service';
35
+ export * from './tools/terminal';
36
+ export * from './tools/tabManagement';
37
+ export * from './types/types';
@@ -0,0 +1,18 @@
1
+ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
2
+ import { McpLoggerService } from './mcpLogger.service';
3
+ /**
4
+ * Dialog Service - Handles command confirmation dialogs
5
+ */
6
+ export declare class DialogService {
7
+ private modal;
8
+ private logger;
9
+ constructor(modal: NgbModal, logger: McpLoggerService);
10
+ /**
11
+ * Show command confirmation dialog
12
+ */
13
+ showCommandConfirmation(command: string, tabId: number): Promise<boolean>;
14
+ /**
15
+ * Show command result dialog
16
+ */
17
+ showCommandResult(command: string, output: string, success: boolean): void;
18
+ }
@@ -0,0 +1,20 @@
1
+ import { ConfigProvider } from 'tabby-core';
2
+ /**
3
+ * MCP Configuration Provider - Default settings for the plugin
4
+ */
5
+ export declare class McpConfigProvider extends ConfigProvider {
6
+ defaults: {
7
+ mcp: {
8
+ port: number;
9
+ host: string;
10
+ enableLogging: boolean;
11
+ startOnBoot: boolean;
12
+ logLevel: string;
13
+ pairProgrammingMode: {
14
+ enabled: boolean;
15
+ showConfirmationDialog: boolean;
16
+ autoFocusTerminal: boolean;
17
+ };
18
+ };
19
+ };
20
+ }
@@ -0,0 +1,37 @@
1
+ import { ConfigService } from 'tabby-core';
2
+ import { LogEntry } from '../types/types';
3
+ /**
4
+ * MCP Logger Service - Centralized logging with file persistence
5
+ */
6
+ export declare class McpLoggerService {
7
+ private config;
8
+ private logs;
9
+ private maxLogs;
10
+ private prefix;
11
+ constructor(config: ConfigService);
12
+ private get isLoggingEnabled();
13
+ private get logLevel();
14
+ private shouldLog;
15
+ private formatMessage;
16
+ private addLog;
17
+ debug(message: string, ...args: any[]): void;
18
+ info(message: string, ...args: any[]): void;
19
+ warn(message: string, ...args: any[]): void;
20
+ error(message: string, ...args: any[]): void;
21
+ /**
22
+ * Get all logs
23
+ */
24
+ getLogs(): LogEntry[];
25
+ /**
26
+ * Get logs filtered by level
27
+ */
28
+ getLogsByLevel(level: 'debug' | 'info' | 'warn' | 'error'): LogEntry[];
29
+ /**
30
+ * Clear all logs
31
+ */
32
+ clearLogs(): void;
33
+ /**
34
+ * Export logs as JSON string
35
+ */
36
+ exportLogs(): string;
37
+ }
@@ -0,0 +1,58 @@
1
+ import { ConfigService } from 'tabby-core';
2
+ import { McpLoggerService } from './mcpLogger.service';
3
+ import { ToolCategory, McpTool } from '../types/types';
4
+ /**
5
+ * MCP Server Service - Core MCP server with SSE transport
6
+ */
7
+ export declare class McpService {
8
+ config: ConfigService;
9
+ private logger;
10
+ private server;
11
+ private transports;
12
+ private app;
13
+ private httpServer?;
14
+ private isRunning;
15
+ private toolCategories;
16
+ constructor(config: ConfigService, logger: McpLoggerService);
17
+ /**
18
+ * Initialize the MCP server
19
+ */
20
+ private initializeServer;
21
+ /**
22
+ * Register a tool category with the MCP server
23
+ */
24
+ registerToolCategory(category: ToolCategory): void;
25
+ /**
26
+ * Register a single tool
27
+ */
28
+ registerTool(tool: McpTool): void;
29
+ /**
30
+ * Configure Express server with SSE endpoints
31
+ */
32
+ private configureExpress;
33
+ /**
34
+ * Configure HTTP API endpoints for direct tool access
35
+ */
36
+ private configureToolEndpoints;
37
+ /**
38
+ * Start the MCP server
39
+ */
40
+ startServer(port?: number): Promise<void>;
41
+ /**
42
+ * Stop the MCP server
43
+ */
44
+ stopServer(): Promise<void>;
45
+ /**
46
+ * Restart the MCP server
47
+ */
48
+ restartServer(): Promise<void>;
49
+ /**
50
+ * Check if server is running
51
+ */
52
+ isServerRunning(): boolean;
53
+ /**
54
+ * Get active connections count
55
+ */
56
+ getActiveConnections(): number;
57
+ }
58
+ export * from '../types/types';
@@ -0,0 +1,10 @@
1
+ import { SettingsTabProvider } from 'tabby-settings';
2
+ /**
3
+ * MCP Settings Tab Provider
4
+ */
5
+ export declare class McpSettingsTabProvider extends SettingsTabProvider {
6
+ id: string;
7
+ icon: string;
8
+ title: string;
9
+ getComponentType(): any;
10
+ }
@@ -0,0 +1,15 @@
1
+ import { McpTool, ToolCategory } from '../types/types';
2
+ import { McpLoggerService } from '../services/mcpLogger.service';
3
+ /**
4
+ * Base class for tool categories
5
+ */
6
+ export declare abstract class BaseToolCategory implements ToolCategory {
7
+ protected logger: McpLoggerService;
8
+ abstract name: string;
9
+ mcpTools: McpTool[];
10
+ constructor(logger: McpLoggerService);
11
+ /**
12
+ * Register a tool with this category
13
+ */
14
+ protected registerTool(tool: McpTool): void;
15
+ }
@@ -0,0 +1,29 @@
1
+ import { AppService, ConfigService, ProfilesService } from 'tabby-core';
2
+ import { BaseToolCategory } from './base-tool-category';
3
+ import { McpLoggerService } from '../services/mcpLogger.service';
4
+ /**
5
+ * Tab Management Tools Category - Comprehensive tab and profile management
6
+ */
7
+ export declare class TabManagementToolCategory extends BaseToolCategory {
8
+ private app;
9
+ private config;
10
+ private profilesService;
11
+ name: string;
12
+ constructor(app: AppService, logger: McpLoggerService, config: ConfigService, profilesService: ProfilesService);
13
+ private initializeTools;
14
+ private createListTabsTool;
15
+ private createSelectTabTool;
16
+ private createCloseTabTool;
17
+ private createCloseAllTabsTool;
18
+ private createDuplicateTabTool;
19
+ private createNextTabTool;
20
+ private createPreviousTabTool;
21
+ private createMoveTabLeftTool;
22
+ private createMoveTabRightTool;
23
+ private createReopenLastTabTool;
24
+ private createListProfilesTool;
25
+ private createOpenProfileTool;
26
+ private createShowProfileSelectorTool;
27
+ private createQuickConnectTool;
28
+ private createSplitTabTool;
29
+ }
@@ -0,0 +1,68 @@
1
+ import { AppService, BaseTabComponent, ConfigService } from 'tabby-core';
2
+ import { BaseTerminalTabComponent } from 'tabby-terminal';
3
+ import { BaseToolCategory } from './base-tool-category';
4
+ import { McpLoggerService } from '../services/mcpLogger.service';
5
+ import { DialogService } from '../services/dialog.service';
6
+ import { ActiveCommand } from '../types/types';
7
+ /**
8
+ * Terminal session with ID for tracking
9
+ */
10
+ export interface TerminalSessionWithTab {
11
+ id: number;
12
+ tabParent: BaseTabComponent;
13
+ tab: BaseTerminalTabComponent;
14
+ }
15
+ /**
16
+ * Terminal Tools Category - Commands for terminal control
17
+ */
18
+ export declare class TerminalToolCategory extends BaseToolCategory {
19
+ private app;
20
+ private config;
21
+ private dialogService;
22
+ name: string;
23
+ private _activeCommands;
24
+ private _activeCommandsSubject;
25
+ readonly activeCommands$: import("rxjs").Observable<Map<number, ActiveCommand>>;
26
+ constructor(app: AppService, logger: McpLoggerService, config: ConfigService, dialogService: DialogService);
27
+ /**
28
+ * Initialize all terminal tools
29
+ */
30
+ private initializeTools;
31
+ /**
32
+ * Tool: Get list of terminal sessions
33
+ */
34
+ private createGetSessionListTool;
35
+ /**
36
+ * Tool: Execute command in terminal
37
+ * Enhanced with better timeout handling and interactive command detection
38
+ */
39
+ private createExecCommandTool;
40
+ /**
41
+ * Tool: Send raw input to terminal (for interactive commands)
42
+ */
43
+ private createSendInputTool;
44
+ /**
45
+ * Tool: Get terminal buffer content
46
+ */
47
+ private createGetTerminalBufferTool;
48
+ /**
49
+ * Tool: Abort running command
50
+ */
51
+ private createAbortCommandTool;
52
+ /**
53
+ * Tool: Get status of active commands
54
+ */
55
+ private createGetCommandStatusTool;
56
+ /**
57
+ * Find all terminal sessions
58
+ */
59
+ findTerminalSessions(): TerminalSessionWithTab[];
60
+ /**
61
+ * Get terminal buffer as text
62
+ */
63
+ private getTerminalBufferText;
64
+ /**
65
+ * Wait for command output between markers
66
+ */
67
+ private waitForCommandOutput;
68
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * MCP Tool definition interface
3
+ */
4
+ export interface McpTool {
5
+ name: string;
6
+ description: string;
7
+ schema: Record<string, any>;
8
+ handler: (params: any, context: any) => Promise<any>;
9
+ }
10
+ /**
11
+ * Tool category interface for grouping related tools
12
+ */
13
+ export interface ToolCategory {
14
+ name: string;
15
+ mcpTools: McpTool[];
16
+ }
17
+ /**
18
+ * Terminal session information
19
+ */
20
+ export interface TerminalSession {
21
+ id: number;
22
+ title: string;
23
+ type: string;
24
+ isActive: boolean;
25
+ }
26
+ /**
27
+ * Command execution result
28
+ */
29
+ export interface CommandResult {
30
+ success: boolean;
31
+ output: string;
32
+ exitCode?: number;
33
+ error?: string;
34
+ outputId?: string;
35
+ totalLines?: number;
36
+ }
37
+ /**
38
+ * Active command tracking
39
+ */
40
+ export interface ActiveCommand {
41
+ tabId: number;
42
+ command: string;
43
+ timestamp: number;
44
+ startMarker: string;
45
+ endMarker: string;
46
+ abort: () => void;
47
+ }
48
+ /**
49
+ * MCP Configuration
50
+ */
51
+ export interface McpConfig {
52
+ port: number;
53
+ host: string;
54
+ enableLogging: boolean;
55
+ startOnBoot: boolean;
56
+ logLevel: 'debug' | 'info' | 'warn' | 'error';
57
+ pairProgrammingMode: {
58
+ enabled: boolean;
59
+ showConfirmationDialog: boolean;
60
+ autoFocusTerminal: boolean;
61
+ };
62
+ }
63
+ /**
64
+ * Command history entry
65
+ */
66
+ export interface CommandHistoryEntry {
67
+ id: string;
68
+ tabId: number;
69
+ command: string;
70
+ timestamp: number;
71
+ status: 'running' | 'completed' | 'aborted' | 'error';
72
+ output?: string;
73
+ exitCode?: number;
74
+ }
75
+ /**
76
+ * Log entry
77
+ */
78
+ export interface LogEntry {
79
+ timestamp: Date;
80
+ level: 'debug' | 'info' | 'warn' | 'error';
81
+ message: string;
82
+ context?: any;
83
+ }