@1mcp/agent 0.15.0 โ†’ 0.17.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.
Files changed (160) hide show
  1. package/README.md +115 -14
  2. package/build/commands/app/backups.d.ts +17 -0
  3. package/build/commands/app/backups.d.ts.map +1 -0
  4. package/build/commands/app/backups.js +162 -0
  5. package/build/commands/app/backups.js.map +1 -0
  6. package/build/commands/app/consolidate.d.ts +21 -0
  7. package/build/commands/app/consolidate.d.ts.map +1 -0
  8. package/build/commands/app/consolidate.js +383 -0
  9. package/build/commands/app/consolidate.js.map +1 -0
  10. package/build/commands/app/discover.d.ts +16 -0
  11. package/build/commands/app/discover.d.ts.map +1 -0
  12. package/build/commands/app/discover.js +79 -0
  13. package/build/commands/app/discover.js.map +1 -0
  14. package/build/commands/app/index.d.ts +12 -0
  15. package/build/commands/app/index.d.ts.map +1 -0
  16. package/build/commands/app/index.js +274 -0
  17. package/build/commands/app/index.js.map +1 -0
  18. package/build/commands/app/list.d.ts +16 -0
  19. package/build/commands/app/list.d.ts.map +1 -0
  20. package/build/commands/app/list.js +95 -0
  21. package/build/commands/app/list.js.map +1 -0
  22. package/build/commands/app/restore.d.ts +21 -0
  23. package/build/commands/app/restore.d.ts.map +1 -0
  24. package/build/commands/app/restore.js +265 -0
  25. package/build/commands/app/restore.js.map +1 -0
  26. package/build/commands/app/status.d.ts +16 -0
  27. package/build/commands/app/status.d.ts.map +1 -0
  28. package/build/commands/app/status.js +224 -0
  29. package/build/commands/app/status.js.map +1 -0
  30. package/build/commands/mcp/add.d.ts +19 -0
  31. package/build/commands/mcp/add.d.ts.map +1 -0
  32. package/build/commands/mcp/add.js +135 -0
  33. package/build/commands/mcp/add.js.map +1 -0
  34. package/build/commands/mcp/enable.d.ts +13 -0
  35. package/build/commands/mcp/enable.d.ts.map +1 -0
  36. package/build/commands/mcp/enable.js +100 -0
  37. package/build/commands/mcp/enable.js.map +1 -0
  38. package/build/commands/mcp/index.d.ts +12 -0
  39. package/build/commands/mcp/index.d.ts.map +1 -0
  40. package/build/commands/mcp/index.js +351 -0
  41. package/build/commands/mcp/index.js.map +1 -0
  42. package/build/commands/mcp/list.d.ts +11 -0
  43. package/build/commands/mcp/list.d.ts.map +1 -0
  44. package/build/commands/mcp/list.js +144 -0
  45. package/build/commands/mcp/list.js.map +1 -0
  46. package/build/commands/mcp/remove.d.ts +10 -0
  47. package/build/commands/mcp/remove.d.ts.map +1 -0
  48. package/build/commands/mcp/remove.js +89 -0
  49. package/build/commands/mcp/remove.js.map +1 -0
  50. package/build/commands/mcp/status.d.ts +10 -0
  51. package/build/commands/mcp/status.d.ts.map +1 -0
  52. package/build/commands/mcp/status.js +243 -0
  53. package/build/commands/mcp/status.js.map +1 -0
  54. package/build/commands/mcp/update.d.ts +18 -0
  55. package/build/commands/mcp/update.d.ts.map +1 -0
  56. package/build/commands/mcp/update.js +157 -0
  57. package/build/commands/mcp/update.js.map +1 -0
  58. package/build/commands/mcp/utils/configUtils.d.ts +64 -0
  59. package/build/commands/mcp/utils/configUtils.d.ts.map +1 -0
  60. package/build/commands/mcp/utils/configUtils.js +266 -0
  61. package/build/commands/mcp/utils/configUtils.js.map +1 -0
  62. package/build/commands/mcp/utils/doubleHyphenParser.d.ts +32 -0
  63. package/build/commands/mcp/utils/doubleHyphenParser.d.ts.map +1 -0
  64. package/build/commands/mcp/utils/doubleHyphenParser.js +61 -0
  65. package/build/commands/mcp/utils/doubleHyphenParser.js.map +1 -0
  66. package/build/commands/mcp/utils/validation.d.ts +33 -0
  67. package/build/commands/mcp/utils/validation.d.ts.map +1 -0
  68. package/build/commands/mcp/utils/validation.js +235 -0
  69. package/build/commands/mcp/utils/validation.js.map +1 -0
  70. package/build/constants.d.ts +12 -2
  71. package/build/constants.d.ts.map +1 -1
  72. package/build/constants.js +16 -2
  73. package/build/constants.js.map +1 -1
  74. package/build/core/capabilities/asyncLoadingOrchestrator.d.ts +96 -0
  75. package/build/core/capabilities/asyncLoadingOrchestrator.d.ts.map +1 -0
  76. package/build/core/capabilities/asyncLoadingOrchestrator.js +256 -0
  77. package/build/core/capabilities/asyncLoadingOrchestrator.js.map +1 -0
  78. package/build/core/capabilities/capabilityAggregator.d.ts +114 -0
  79. package/build/core/capabilities/capabilityAggregator.d.ts.map +1 -0
  80. package/build/core/capabilities/capabilityAggregator.js +234 -0
  81. package/build/core/capabilities/capabilityAggregator.js.map +1 -0
  82. package/build/core/client/clientManager.d.ts +28 -0
  83. package/build/core/client/clientManager.d.ts.map +1 -1
  84. package/build/core/client/clientManager.js +120 -0
  85. package/build/core/client/clientManager.js.map +1 -1
  86. package/build/core/loading/loadingStateTracker.d.ts +128 -0
  87. package/build/core/loading/loadingStateTracker.d.ts.map +1 -0
  88. package/build/core/loading/loadingStateTracker.js +209 -0
  89. package/build/core/loading/loadingStateTracker.js.map +1 -0
  90. package/build/core/loading/mcpLoadingManager.d.ts +139 -0
  91. package/build/core/loading/mcpLoadingManager.d.ts.map +1 -0
  92. package/build/core/loading/mcpLoadingManager.js +296 -0
  93. package/build/core/loading/mcpLoadingManager.js.map +1 -0
  94. package/build/core/notifications/notificationManager.d.ts +111 -0
  95. package/build/core/notifications/notificationManager.d.ts.map +1 -0
  96. package/build/core/notifications/notificationManager.js +232 -0
  97. package/build/core/notifications/notificationManager.js.map +1 -0
  98. package/build/core/server/agentConfig.d.ts +59 -0
  99. package/build/core/server/agentConfig.d.ts.map +1 -1
  100. package/build/core/server/agentConfig.js +82 -1
  101. package/build/core/server/agentConfig.js.map +1 -1
  102. package/build/core/server/serverManager.d.ts +1 -0
  103. package/build/core/server/serverManager.d.ts.map +1 -1
  104. package/build/core/server/serverManager.js +3 -0
  105. package/build/core/server/serverManager.js.map +1 -1
  106. package/build/index.js +123 -31
  107. package/build/index.js.map +1 -1
  108. package/build/server.d.ts +23 -2
  109. package/build/server.d.ts.map +1 -1
  110. package/build/server.js +83 -10
  111. package/build/server.js.map +1 -1
  112. package/build/services/healthService.d.ts +107 -0
  113. package/build/services/healthService.d.ts.map +1 -0
  114. package/build/services/healthService.js +294 -0
  115. package/build/services/healthService.js.map +1 -0
  116. package/build/transport/http/middlewares/mcpAvailabilityMiddleware.d.ts +79 -0
  117. package/build/transport/http/middlewares/mcpAvailabilityMiddleware.d.ts.map +1 -0
  118. package/build/transport/http/middlewares/mcpAvailabilityMiddleware.js +243 -0
  119. package/build/transport/http/middlewares/mcpAvailabilityMiddleware.js.map +1 -0
  120. package/build/transport/http/routes/healthRoutes.d.ts +8 -0
  121. package/build/transport/http/routes/healthRoutes.d.ts.map +1 -0
  122. package/build/transport/http/routes/healthRoutes.js +282 -0
  123. package/build/transport/http/routes/healthRoutes.js.map +1 -0
  124. package/build/transport/http/routes/sseRoutes.d.ts +2 -1
  125. package/build/transport/http/routes/sseRoutes.d.ts.map +1 -1
  126. package/build/transport/http/routes/sseRoutes.js +13 -1
  127. package/build/transport/http/routes/sseRoutes.js.map +1 -1
  128. package/build/transport/http/routes/streamableHttpRoutes.d.ts +2 -1
  129. package/build/transport/http/routes/streamableHttpRoutes.d.ts.map +1 -1
  130. package/build/transport/http/routes/streamableHttpRoutes.js +13 -1
  131. package/build/transport/http/routes/streamableHttpRoutes.js.map +1 -1
  132. package/build/transport/http/server.d.ts +7 -1
  133. package/build/transport/http/server.d.ts.map +1 -1
  134. package/build/transport/http/server.js +17 -3
  135. package/build/transport/http/server.js.map +1 -1
  136. package/build/transport/transportFactory.d.ts +4 -0
  137. package/build/transport/transportFactory.d.ts.map +1 -1
  138. package/build/transport/transportFactory.js +1 -1
  139. package/build/transport/transportFactory.js.map +1 -1
  140. package/build/utils/appDiscovery.d.ts +75 -0
  141. package/build/utils/appDiscovery.d.ts.map +1 -0
  142. package/build/utils/appDiscovery.js +358 -0
  143. package/build/utils/appDiscovery.js.map +1 -0
  144. package/build/utils/appPresets.d.ts +88 -0
  145. package/build/utils/appPresets.d.ts.map +1 -0
  146. package/build/utils/appPresets.js +430 -0
  147. package/build/utils/appPresets.js.map +1 -0
  148. package/build/utils/backupManager.d.ts +61 -0
  149. package/build/utils/backupManager.d.ts.map +1 -0
  150. package/build/utils/backupManager.js +314 -0
  151. package/build/utils/backupManager.js.map +1 -0
  152. package/build/utils/urlDetection.d.ts +35 -0
  153. package/build/utils/urlDetection.d.ts.map +1 -0
  154. package/build/utils/urlDetection.js +115 -0
  155. package/build/utils/urlDetection.js.map +1 -0
  156. package/build/utils/validationHelpers.d.ts +62 -0
  157. package/build/utils/validationHelpers.d.ts.map +1 -0
  158. package/build/utils/validationHelpers.js +252 -0
  159. package/build/utils/validationHelpers.js.map +1 -0
  160. package/package.json +25 -3
package/README.md CHANGED
@@ -6,18 +6,41 @@ A unified Model Context Protocol server implementation that aggregates multiple
6
6
  [![NPM License](https://img.shields.io/npm/l/@1mcp/agent)](https://www.npmjs.com/package/@1mcp/agent)
7
7
  [![smithery badge](https://smithery.ai/badge/@1mcp-app/agent)](https://smithery.ai/server/@1mcp-app/agent)
8
8
 
9
+ ## Table of Contents
10
+
11
+ - [Overview](#overview)
12
+ - [Features](#features)
13
+ - [Quick Start](#quick-start)
14
+ - [Commands](#commands)
15
+ - [Prerequisites](#prerequisites)
16
+ - [Usage](#usage)
17
+ - [Docker](#docker)
18
+ - [Trust Proxy Configuration](#trust-proxy-configuration)
19
+ - [Understanding Tags](#understanding-tags)
20
+ - [Configuration](#configuration)
21
+ - [Authentication](#authentication)
22
+ - [Health Monitoring](#health-monitoring)
23
+ - [How It Works](#how-it-works)
24
+ - [Development](#development)
25
+ - [Contributing](#contributing)
26
+ - [License](#license)
27
+
9
28
  ## Overview
10
29
 
11
- 1MCP (One MCP) is designed to simplify the way you work with AI assistants. Instead of configuring multiple MCP servers for different clients (Claude Desktop, Cherry Studio, Cursor, Roo Code, Claude, etc.), 1MCP provides a single, unified server that:
30
+ 1MCP (One MCP) is designed to simplify the way you work with AI assistants. Instead of configuring multiple MCP servers for different clients (Claude Desktop, Cherry Studio, Cursor, Roo Code, Claude, etc.), 1MCP provides a single, unified server.
31
+
32
+ ## Features
12
33
 
13
- - Aggregates multiple MCP servers into one unified interface
14
- - Reduces system resource usage by eliminating redundant server instances
15
- - Simplifies configuration management across different AI assistants
16
- - Provides a standardized way for AI models to interact with external tools and resources
17
- - Supports dynamic configuration reloading without server restart
18
- - Handles graceful shutdown and resource cleanup
19
- - Includes comprehensive authentication and security features
20
- - Supports advanced filtering, pagination, and request optimization
34
+ - **Unified Interface**: Aggregates multiple MCP servers into one.
35
+ - **Resource Friendly**: Reduces system resource usage by eliminating redundant server instances.
36
+ - **Simplified Configuration**: Simplifies configuration management across different AI assistants.
37
+ - **Standardized Interaction**: Provides a standardized way for AI models to interact with external tools and resources.
38
+ - **Dynamic Configuration**: Supports dynamic configuration reloading without server restart.
39
+ - **Async Loading**: Optional asynchronous server loading with real-time capability updates via listChanged notifications.
40
+ - **Graceful Shutdown**: Handles graceful shutdown and resource cleanup.
41
+ - **Secure**: Includes comprehensive authentication and security features.
42
+ - **Optimized**: Supports advanced filtering, pagination, and request optimization.
43
+ - **Health Monitoring**: Built-in health check endpoints for monitoring and observability.
21
44
 
22
45
  ## Quick Start
23
46
 
@@ -44,6 +67,42 @@ npx -y @1mcp/agent --config ~/Library/Application\ Support/Claude/claude_desktop
44
67
 
45
68
  3. Enjoy it!
46
69
 
70
+ ## Commands
71
+
72
+ 1MCP provides several commands to manage your MCP server configuration:
73
+
74
+ ### Core Commands
75
+
76
+ - **`npx -y @1mcp/agent [serve]`** - Start the 1MCP server (default command)
77
+ - `--transport` - Choose transport type (stdio, http, sse)
78
+ - `--config` - Use specific config file
79
+ - `--port` - Change HTTP port
80
+
81
+ ### MCP Management
82
+
83
+ - **`npx -y @1mcp/agent mcp add <name>`** - Add a new MCP server to configuration
84
+ - **`npx -y @1mcp/agent mcp remove <name>`** - Remove an MCP server
85
+ - **`npx -y @1mcp/agent mcp list`** - List all configured MCP servers
86
+ - **`npx -y @1mcp/agent mcp status [name]`** - Show server status and details
87
+ - **`npx -y @1mcp/agent mcp enable/disable <name>`** - Enable or disable servers
88
+ - **`npx -y @1mcp/agent mcp update <name>`** - Update server configuration
89
+
90
+ ### App Integration
91
+
92
+ - **`npx -y @1mcp/agent app consolidate`** - Consolidate configurations from other MCP apps
93
+ - **`npx -y @1mcp/agent app discover`** - Discover MCP servers from installed applications
94
+ - **`npx -y @1mcp/agent app list`** - List discovered applications
95
+ - **`npx -y @1mcp/agent app status`** - Show consolidation status
96
+
97
+ For detailed command usage, run: `1mcp <command> --help`
98
+
99
+ Full documentation: [Commands Reference](https://docs.1mcp.app/commands/)
100
+
101
+ ## Prerequisites
102
+
103
+ - [Node.js](https://nodejs.org/) (version 21 or higher)
104
+ - [pnpm](https://pnpm.io/)
105
+
47
106
  ## Usage
48
107
 
49
108
  You can run the server directly using `npx`:
@@ -80,7 +139,6 @@ Available options:
80
139
  | `--trust-proxy` | `ONE_MCP_TRUST_PROXY` | Trust proxy configuration for client IP detection (boolean, IP, CIDR, preset) | "loopback" |
81
140
  | `--tags`, `-g` | `ONE_MCP_TAGS` | Filter servers by tags | |
82
141
  | `--pagination`, `-p` | `ONE_MCP_PAGINATION` | Enable pagination for client/server lists (boolean) | false |
83
- | `--auth` | `ONE_MCP_AUTH` | Enable authentication (OAuth 2.1) - **Deprecated** | false |
84
142
  | `--enable-auth` | `ONE_MCP_ENABLE_AUTH` | Enable authentication (OAuth 2.1) | false |
85
143
  | `--enable-scope-validation` | `ONE_MCP_ENABLE_SCOPE_VALIDATION` | Enable tag-based scope validation (boolean) | true |
86
144
  | `--enable-enhanced-security` | `ONE_MCP_ENABLE_ENHANCED_SECURITY` | Enable enhanced security middleware (boolean) | false |
@@ -88,7 +146,10 @@ Available options:
88
146
  | `--session-storage-path` | `ONE_MCP_SESSION_STORAGE_PATH` | Custom session storage directory path (string) | |
89
147
  | `--rate-limit-window` | `ONE_MCP_RATE_LIMIT_WINDOW` | OAuth rate limit window in minutes (number) | 15 |
90
148
  | `--rate-limit-max` | `ONE_MCP_RATE_LIMIT_MAX` | Maximum requests per OAuth rate limit window (number) | 100 |
91
- | `--help`, `-h` | | Show help | |
149
+
150
+ | `--enable-async-loading` | `ONE_MCP_ENABLE_ASYNC_LOADING` | Enable asynchronous MCP server loading(boolean) | false |
151
+ | `--health-info-level` | `ONE_MCP_HEALTH_INFO_LEVEL` | Health endpoint information detail level ("full", "basic", "minimal") | "minimal" |
152
+ | `--help`, `-h` | | Show help | |
92
153
 
93
154
  ## Docker
94
155
 
@@ -147,11 +208,11 @@ npx -y @1mcp/agent --trust-proxy=true
147
208
 
148
209
  See [docs/TRUST_PROXY.md](docs/TRUST_PROXY.md) for detailed configuration options, security considerations, and reverse proxy setup examples.
149
210
 
150
- ### Understanding Tags
211
+ ## Understanding Tags
151
212
 
152
213
  Tags help you control which MCP servers are available to different clients. Think of tags as labels that describe what each server can do.
153
214
 
154
- #### How to Use Tags
215
+ ### How to Use Tags
155
216
 
156
217
  1. **In your server config**: Add tags to each server to describe its capabilities
157
218
 
@@ -233,8 +294,40 @@ The server automatically manages configuration in a global location:
233
294
  }
234
295
  ```
235
296
 
297
+ ## Authentication
298
+
299
+ 1MCP supports OAuth 2.1 for secure authentication. To enable it, use the `--enable-auth` flag. The `--auth` flag is deprecated and will be removed in a future version.
300
+
301
+ When authentication is enabled, 1MCP acts as an OAuth 2.1 provider, allowing client applications to securely connect. This ensures that only authorized clients can access the MCP servers.
302
+
303
+ ## Health Monitoring
304
+
305
+ 1MCP provides comprehensive health check endpoints for monitoring and observability:
306
+
307
+ ### Health Check Endpoints
308
+
309
+ - **`GET /health`** - Complete health status including system metrics, server status, and configuration
310
+ - **`GET /health/live`** - Simple liveness probe (always returns 200 if server is running)
311
+ - **`GET /health/ready`** - Readiness probe (returns 200 if configuration is loaded and ready)
312
+
313
+ ### Health Status Levels
314
+
315
+ - **`healthy`** - All systems operational (HTTP 200)
316
+ - **`degraded`** - Some issues but still functional (HTTP 200)
317
+ - **`unhealthy`** - Critical issues affecting functionality (HTTP 503)
318
+
319
+ ### Monitoring Integration
320
+
321
+ Use these endpoints with:
322
+
323
+ - Load balancers (health checks)
324
+ - Container orchestration (Kubernetes health probes)
325
+ - CI/CD pipelines (deployment validation)
326
+
236
327
  ## How It Works
237
328
 
329
+ 1MCP acts as a proxy, managing and aggregating multiple MCP servers. It starts and stops these servers as subprocesses and forwards requests from AI assistants to the appropriate server. This architecture allows for a single point of entry for all MCP traffic, simplifying management and reducing overhead.
330
+
238
331
  ### System Architecture
239
332
 
240
333
  ```mermaid
@@ -325,8 +418,16 @@ pnpm inspector
325
418
 
326
419
  The Inspector will provide a URL to access debugging tools in your browser.
327
420
 
328
- ## Debugging & Source Maps
421
+ ### Debugging & Source Maps
329
422
 
330
423
  This project uses [source-map-support](https://www.npmjs.com/package/source-map-support) to enhance stack traces. When you run the server, stack traces will reference the original TypeScript source files instead of the compiled JavaScript. This makes debugging much easier, as error locations and line numbers will match your source code.
331
424
 
332
425
  No extra setup is requiredโ€”this is enabled by default. If you see a stack trace, it will point to `.ts` files and the correct line numbers. ๐Ÿ—บ๏ธ
426
+
427
+ ## Contributing
428
+
429
+ Contributions are welcome! Please read our [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
430
+
431
+ ## License
432
+
433
+ This project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Backups command - Manage and list backup files.
3
+ *
4
+ * Provides backup management functionality including listing,
5
+ * verification, and cleanup of old backup files.
6
+ */
7
+ interface BackupsOptions {
8
+ 'app-name'?: string;
9
+ cleanup?: number;
10
+ verify: boolean;
11
+ }
12
+ /**
13
+ * Main backups command handler
14
+ */
15
+ export declare function backupsCommand(options: BackupsOptions): Promise<void>;
16
+ export {};
17
+ //# sourceMappingURL=backups.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backups.d.ts","sourceRoot":"","sources":["../../../src/commands/app/backups.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AAEH,UAAU,cAAc;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAW3E"}
@@ -0,0 +1,162 @@
1
+ import { listAppBackups, cleanupOldBackups, verifyBackupIntegrity, findBackupByMetaPath, } from '../../utils/backupManager.js';
2
+ import { getAppPreset } from '../../utils/appPresets.js';
3
+ /**
4
+ * Main backups command handler
5
+ */
6
+ export async function backupsCommand(options) {
7
+ console.log('๐Ÿ’พ MCP Configuration Backup Management\n');
8
+ // Cleanup mode
9
+ if (options.cleanup !== undefined) {
10
+ await cleanupBackups(options.cleanup);
11
+ return;
12
+ }
13
+ // List and optionally verify backups
14
+ await listBackupsWithDetails(options['app-name'], options.verify);
15
+ }
16
+ /**
17
+ * List backups with detailed information
18
+ */
19
+ async function listBackupsWithDetails(appName, verify = false) {
20
+ const backups = listAppBackups(appName);
21
+ if (backups.length === 0) {
22
+ if (appName) {
23
+ console.log(`๐Ÿ“ญ No backups found for ${appName}.`);
24
+ }
25
+ else {
26
+ console.log('๐Ÿ“ญ No backups found.');
27
+ }
28
+ console.log('\n๐Ÿ’ก Backups are created automatically during consolidation.');
29
+ return;
30
+ }
31
+ if (appName) {
32
+ const preset = getAppPreset(appName);
33
+ console.log(`๐Ÿ“‹ Backups for ${preset?.displayName || appName}:\n`);
34
+ }
35
+ else {
36
+ console.log('๐Ÿ“‹ All Available Backups:\n');
37
+ }
38
+ // Group by application
39
+ const groupedBackups = backups.reduce((groups, backup) => {
40
+ if (!groups[backup.app]) {
41
+ groups[backup.app] = [];
42
+ }
43
+ groups[backup.app].push(backup);
44
+ return groups;
45
+ }, {});
46
+ let totalSize = 0;
47
+ let verifiedCount = 0;
48
+ let corruptedCount = 0;
49
+ for (const [app, appBackups] of Object.entries(groupedBackups)) {
50
+ const preset = getAppPreset(app);
51
+ console.log(`๐Ÿ“ฑ ${preset?.displayName || app} (${app}):`);
52
+ for (const backup of appBackups) {
53
+ const backupInfo = findBackupByMetaPath(backup.metaPath);
54
+ console.log(` ๐Ÿ• ${backup.age} - ${backup.operation} operation`);
55
+ console.log(` ๐Ÿ“ ${backup.backupPath}`);
56
+ console.log(` ๐Ÿ”ง ${backup.serverCount} servers backed up`);
57
+ if (backupInfo) {
58
+ const fileSizeKB = Math.round(backupInfo.metadata.fileSize / 1024);
59
+ totalSize += backupInfo.metadata.fileSize;
60
+ console.log(` ๐Ÿ“Š Size: ${fileSizeKB} KB`);
61
+ // Verify integrity if requested
62
+ if (verify) {
63
+ const isValid = verifyBackupIntegrity(backupInfo);
64
+ if (isValid) {
65
+ console.log(` โœ… Integrity: Valid`);
66
+ verifiedCount++;
67
+ }
68
+ else {
69
+ console.log(` โŒ Integrity: Corrupted`);
70
+ corruptedCount++;
71
+ }
72
+ }
73
+ }
74
+ console.log(` ๐Ÿ“ Metadata: ${backup.metaPath}`);
75
+ console.log();
76
+ }
77
+ }
78
+ // Summary
79
+ const totalSizeMB = Math.round((totalSize / (1024 * 1024)) * 100) / 100;
80
+ console.log('๐Ÿ“Š Backup Summary:');
81
+ console.log(` ๐Ÿ“ฆ Total backups: ${backups.length}`);
82
+ console.log(` ๐Ÿ“ฑ Applications: ${Object.keys(groupedBackups).length}`);
83
+ console.log(` ๐Ÿ’ฝ Total size: ${totalSizeMB} MB`);
84
+ if (verify) {
85
+ console.log(` โœ… Verified: ${verifiedCount}`);
86
+ if (corruptedCount > 0) {
87
+ console.log(` โŒ Corrupted: ${corruptedCount}`);
88
+ }
89
+ }
90
+ // Show oldest and newest
91
+ if (backups.length > 1) {
92
+ const oldest = backups[backups.length - 1];
93
+ const newest = backups[0];
94
+ console.log(` ๐Ÿ• Oldest: ${oldest.age} (${getAppPreset(oldest.app)?.displayName || oldest.app})`);
95
+ console.log(` ๐Ÿ• Newest: ${newest.age} (${getAppPreset(newest.app)?.displayName || newest.app})`);
96
+ }
97
+ // Usage recommendations
98
+ console.log('\n๐Ÿ’ก Management Commands:');
99
+ console.log(' ๐Ÿ“‹ List app backups: npx @1mcp/agent app backups <app-name>');
100
+ console.log(' ๐Ÿ” Verify integrity: npx @1mcp/agent app backups --verify');
101
+ console.log(' ๐Ÿงน Cleanup old: npx @1mcp/agent app backups --cleanup=30');
102
+ console.log(' ๐Ÿ”„ Restore: npx @1mcp/agent app restore <app-name>');
103
+ if (corruptedCount > 0) {
104
+ console.log('\nโš ๏ธ Warning: Some backups failed integrity verification.');
105
+ console.log(' Consider creating fresh backups for affected applications.');
106
+ }
107
+ }
108
+ /**
109
+ * Cleanup old backups
110
+ */
111
+ async function cleanupBackups(maxAgeDays) {
112
+ console.log(`๐Ÿงน Cleaning up backups older than ${maxAgeDays} days...\n`);
113
+ if (maxAgeDays < 1) {
114
+ console.error('โŒ Invalid age: must be at least 1 day.');
115
+ process.exit(1);
116
+ }
117
+ // Show what will be deleted first
118
+ const allBackups = listAppBackups();
119
+ const cutoffTime = Date.now() - maxAgeDays * 24 * 60 * 60 * 1000;
120
+ const oldBackups = allBackups.filter((backup) => backup.timestamp < cutoffTime);
121
+ if (oldBackups.length === 0) {
122
+ console.log(`โœ… No backups older than ${maxAgeDays} days found.`);
123
+ return;
124
+ }
125
+ console.log(`๐Ÿ“‹ Found ${oldBackups.length} backups to delete:\n`);
126
+ const groupedOld = oldBackups.reduce((groups, backup) => {
127
+ if (!groups[backup.app]) {
128
+ groups[backup.app] = [];
129
+ }
130
+ groups[backup.app].push(backup);
131
+ return groups;
132
+ }, {});
133
+ Object.entries(groupedOld).forEach(([app, appBackups]) => {
134
+ const preset = getAppPreset(app);
135
+ console.log(`๐Ÿ“ฑ ${preset?.displayName || app}: ${appBackups.length} backups`);
136
+ appBackups.forEach((backup) => {
137
+ console.log(` ๐Ÿ• ${backup.age} - ${backup.operation}`);
138
+ });
139
+ });
140
+ // Perform cleanup
141
+ console.log('\n๐Ÿ—‘๏ธ Deleting old backups...');
142
+ const deletedCount = cleanupOldBackups(maxAgeDays);
143
+ if (deletedCount > 0) {
144
+ console.log(`โœ… Successfully deleted ${deletedCount} old backups.`);
145
+ // Show remaining backups
146
+ const remainingBackups = listAppBackups();
147
+ console.log(`๐Ÿ“ฆ Remaining backups: ${remainingBackups.length}`);
148
+ if (remainingBackups.length > 0) {
149
+ const totalSize = remainingBackups.reduce((sum, backup) => {
150
+ const backupInfo = findBackupByMetaPath(backup.metaPath);
151
+ return sum + (backupInfo?.metadata.fileSize || 0);
152
+ }, 0);
153
+ const totalSizeMB = Math.round((totalSize / (1024 * 1024)) * 100) / 100;
154
+ console.log(`๐Ÿ’ฝ Total size: ${totalSizeMB} MB`);
155
+ }
156
+ }
157
+ else {
158
+ console.log('โš ๏ธ No backups were deleted (they may have been removed already).');
159
+ }
160
+ console.log('\n๐Ÿ’ก To see remaining backups: npx @1mcp/agent app backups');
161
+ }
162
+ //# sourceMappingURL=backups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backups.js","sourceRoot":"","sources":["../../../src/commands/app/backups.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAezD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAuB;IAC1D,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IAExD,eAAe;IACf,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACtC,OAAO;IACT,CAAC;IAED,qCAAqC;IACrC,MAAM,sBAAsB,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,KA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;YAChC,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;gBACxD,MAAM,UAAU,GAAG,oBAAoB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACzD,OAAO,GAAG,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC;YACpD,CAAC,EAAE,CAAC,CAAC,CAAC;YACN,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;YACxE,OAAO,CAAC,GAAG,CAAC,kBAAkB,WAAW,KAAK,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,kEAAkE,CAAC,CAAC;IAClF,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Consolidate command - Main consolidation logic for MCP servers.
3
+ *
4
+ * Extracts MCP servers from desktop applications and consolidates
5
+ * them into 1mcp with safe backup and validation.
6
+ */
7
+ interface ConsolidateOptions {
8
+ 'app-name': string[];
9
+ url?: string;
10
+ 'dry-run': boolean;
11
+ yes: boolean;
12
+ 'manual-only': boolean;
13
+ 'backup-only': boolean;
14
+ force: boolean;
15
+ }
16
+ /**
17
+ * Main consolidate command handler
18
+ */
19
+ export declare function consolidateCommand(options: ConsolidateOptions): Promise<void>;
20
+ export {};
21
+ //# sourceMappingURL=consolidate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consolidate.d.ts","sourceRoot":"","sources":["../../../src/commands/app/consolidate.ts"],"names":[],"mappings":"AAyBA;;;;;GAKG;AAEH,UAAU,kBAAkB;IAC1B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,GAAG,EAAE,OAAO,CAAC;IACb,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;CAChB;AAWD;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2GnF"}