@1mcp/agent 0.16.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 (156) hide show
  1. package/README.md +37 -2
  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 +11 -2
  71. package/build/constants.d.ts.map +1 -1
  72. package/build/constants.js +15 -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 +50 -0
  99. package/build/core/server/agentConfig.d.ts.map +1 -1
  100. package/build/core/server/agentConfig.js +68 -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 +115 -32
  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/transport/http/middlewares/mcpAvailabilityMiddleware.d.ts +79 -0
  113. package/build/transport/http/middlewares/mcpAvailabilityMiddleware.d.ts.map +1 -0
  114. package/build/transport/http/middlewares/mcpAvailabilityMiddleware.js +243 -0
  115. package/build/transport/http/middlewares/mcpAvailabilityMiddleware.js.map +1 -0
  116. package/build/transport/http/routes/healthRoutes.d.ts +2 -1
  117. package/build/transport/http/routes/healthRoutes.d.ts.map +1 -1
  118. package/build/transport/http/routes/healthRoutes.js +170 -1
  119. package/build/transport/http/routes/healthRoutes.js.map +1 -1
  120. package/build/transport/http/routes/sseRoutes.d.ts +2 -1
  121. package/build/transport/http/routes/sseRoutes.d.ts.map +1 -1
  122. package/build/transport/http/routes/sseRoutes.js +13 -1
  123. package/build/transport/http/routes/sseRoutes.js.map +1 -1
  124. package/build/transport/http/routes/streamableHttpRoutes.d.ts +2 -1
  125. package/build/transport/http/routes/streamableHttpRoutes.d.ts.map +1 -1
  126. package/build/transport/http/routes/streamableHttpRoutes.js +13 -1
  127. package/build/transport/http/routes/streamableHttpRoutes.js.map +1 -1
  128. package/build/transport/http/server.d.ts +7 -1
  129. package/build/transport/http/server.d.ts.map +1 -1
  130. package/build/transport/http/server.js +15 -4
  131. package/build/transport/http/server.js.map +1 -1
  132. package/build/transport/transportFactory.d.ts +4 -0
  133. package/build/transport/transportFactory.d.ts.map +1 -1
  134. package/build/transport/transportFactory.js +1 -1
  135. package/build/transport/transportFactory.js.map +1 -1
  136. package/build/utils/appDiscovery.d.ts +75 -0
  137. package/build/utils/appDiscovery.d.ts.map +1 -0
  138. package/build/utils/appDiscovery.js +358 -0
  139. package/build/utils/appDiscovery.js.map +1 -0
  140. package/build/utils/appPresets.d.ts +88 -0
  141. package/build/utils/appPresets.d.ts.map +1 -0
  142. package/build/utils/appPresets.js +430 -0
  143. package/build/utils/appPresets.js.map +1 -0
  144. package/build/utils/backupManager.d.ts +61 -0
  145. package/build/utils/backupManager.d.ts.map +1 -0
  146. package/build/utils/backupManager.js +314 -0
  147. package/build/utils/backupManager.js.map +1 -0
  148. package/build/utils/urlDetection.d.ts +35 -0
  149. package/build/utils/urlDetection.d.ts.map +1 -0
  150. package/build/utils/urlDetection.js +115 -0
  151. package/build/utils/urlDetection.js.map +1 -0
  152. package/build/utils/validationHelpers.d.ts +62 -0
  153. package/build/utils/validationHelpers.d.ts.map +1 -0
  154. package/build/utils/validationHelpers.js +252 -0
  155. package/build/utils/validationHelpers.js.map +1 -0
  156. package/package.json +9 -2
@@ -0,0 +1,135 @@
1
+ import { serverExists, setServer, parseEnvVars, parseHeaders, parseTags, validateConfigPath, backupConfig, reloadMcpConfig, } from './utils/configUtils.js';
2
+ import { validateServerName, validateServerArgs, validateEnvVars, validateHeaders, validateTags, validateTimeout, } from './utils/validation.js';
3
+ /**
4
+ * Add a new MCP server to the configuration
5
+ */
6
+ export async function addCommand(argv) {
7
+ try {
8
+ const { name, config: configPath, type, disabled = false } = argv;
9
+ console.log(`Adding MCP server: ${name}`);
10
+ // Validate inputs
11
+ validateServerName(name);
12
+ // Type is required either explicitly or inferred from " -- " pattern
13
+ if (!type) {
14
+ throw new Error('Server type must be specified with --type or inferred from " -- " pattern');
15
+ }
16
+ validateServerArgs(type, argv);
17
+ validateEnvVars(argv.env);
18
+ validateHeaders(argv.headers);
19
+ validateTags(argv.tags);
20
+ validateTimeout(argv.timeout);
21
+ // Validate config path
22
+ try {
23
+ validateConfigPath(configPath);
24
+ }
25
+ catch (error) {
26
+ if (error instanceof Error && error.message.includes('not found')) {
27
+ // If config file doesn't exist, we'll create it
28
+ console.log('Configuration file not found, will create a new one');
29
+ }
30
+ else {
31
+ throw error;
32
+ }
33
+ }
34
+ // Check if server already exists
35
+ if (serverExists(name, configPath)) {
36
+ throw new Error(`Server '${name}' already exists. Use 'mcp update' to modify it or 'mcp remove' to delete it first.`);
37
+ }
38
+ // Create backup if config file exists
39
+ let backupPath;
40
+ try {
41
+ backupPath = backupConfig(configPath);
42
+ }
43
+ catch (_error) {
44
+ // Config file might not exist yet, that's ok
45
+ console.log('Creating new configuration file');
46
+ }
47
+ // Build server configuration
48
+ const serverConfig = {
49
+ type: type,
50
+ disabled,
51
+ };
52
+ // Add type-specific configuration
53
+ switch (type) {
54
+ case 'stdio':
55
+ if (!argv.command) {
56
+ throw new Error('Command is required for stdio servers');
57
+ }
58
+ serverConfig.command = argv.command;
59
+ if (argv.args && argv.args.length > 0) {
60
+ serverConfig.args = argv.args;
61
+ }
62
+ if (argv.cwd) {
63
+ serverConfig.cwd = argv.cwd;
64
+ }
65
+ break;
66
+ case 'http':
67
+ case 'sse':
68
+ if (!argv.url) {
69
+ throw new Error(`URL is required for ${type} servers`);
70
+ }
71
+ serverConfig.url = argv.url;
72
+ // Add headers if provided
73
+ if (argv.headers && argv.headers.length > 0) {
74
+ serverConfig.headers = parseHeaders(argv.headers);
75
+ }
76
+ break;
77
+ }
78
+ // Add common optional configuration
79
+ if (argv.env && argv.env.length > 0) {
80
+ serverConfig.env = parseEnvVars(argv.env);
81
+ }
82
+ if (argv.tags) {
83
+ serverConfig.tags = parseTags(argv.tags);
84
+ }
85
+ if (argv.timeout !== undefined) {
86
+ serverConfig.timeout = argv.timeout;
87
+ }
88
+ // Save the server configuration
89
+ setServer(name, serverConfig, configPath);
90
+ // Reload MCP configuration
91
+ reloadMcpConfig(configPath);
92
+ // Success message
93
+ console.log(`✅ Successfully added server '${name}'`);
94
+ console.log(` Type: ${type}`);
95
+ if (type === 'stdio') {
96
+ console.log(` Command: ${serverConfig.command}`);
97
+ if (serverConfig.args) {
98
+ console.log(` Args: ${serverConfig.args.join(' ')}`);
99
+ }
100
+ if (serverConfig.cwd) {
101
+ console.log(` Working Directory: ${serverConfig.cwd}`);
102
+ }
103
+ }
104
+ else {
105
+ console.log(` URL: ${serverConfig.url}`);
106
+ if (serverConfig.headers) {
107
+ console.log(` Headers: ${Object.keys(serverConfig.headers).length} header(s)`);
108
+ }
109
+ }
110
+ if (serverConfig.env) {
111
+ console.log(` Environment Variables: ${Object.keys(serverConfig.env).length} variable(s)`);
112
+ }
113
+ if (serverConfig.tags && serverConfig.tags.length > 0) {
114
+ console.log(` Tags: ${serverConfig.tags.join(', ')}`);
115
+ }
116
+ if (serverConfig.timeout) {
117
+ console.log(` Timeout: ${serverConfig.timeout}ms`);
118
+ }
119
+ if (disabled) {
120
+ console.log(` Status: Disabled (use 'mcp enable ${name}' to activate)`);
121
+ }
122
+ else {
123
+ console.log(` Status: Enabled`);
124
+ }
125
+ if (backupPath) {
126
+ console.log(` Backup created: ${backupPath}`);
127
+ }
128
+ console.log(`\n💡 Server added to configuration. If 1mcp is running, the new server will be loaded automatically.`);
129
+ }
130
+ catch (error) {
131
+ console.error(`❌ Failed to add server: ${error instanceof Error ? error.message : error}`);
132
+ process.exit(1);
133
+ }
134
+ }
135
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/commands/mcp/add.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAiB/B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAoB;IACnD,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC;QAElE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC;QAE1C,kBAAkB;QAClB,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAEzB,qEAAqE;QACrE,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,C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AY,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;YACzB,OAAO,CAAC,GAAG,CAAC,eAAe,YAAY,CAAC,OAAO,IAAI,CAAC,CAAC;QACvD,CAAC;QAED,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,wCAAwC,IAAI,gBAAgB,CAAC,CAAC;QAC5E,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QACpC,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,sBAAsB,UAAU,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,sGAAsG,CAAC,CAAC;IACtH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,13 @@
1
+ export interface EnableDisableCommandArgs {
2
+ name: string;
3
+ config?: string;
4
+ }
5
+ /**
6
+ * Enable a disabled MCP server
7
+ */
8
+ export declare function enableCommand(argv: EnableDisableCommandArgs): Promise<void>;
9
+ /**
10
+ * Disable an MCP server without removing it
11
+ */
12
+ export declare function disableCommand(argv: EnableDisableCommandArgs): Promise<void>;
13
+ //# sourceMappingURL=enable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enable.d.ts","sourceRoot":"","sources":["../../../src/commands/mcp/enable.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwDjF;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDlF"}
@@ -0,0 +1,100 @@
1
+ import { serverExists, getServer, setServer, validateConfigPath, backupConfig, reloadMcpConfig, } from './utils/configUtils.js';
2
+ import { validateServerName } from './utils/validation.js';
3
+ /**
4
+ * Enable a disabled MCP server
5
+ */
6
+ export async function enableCommand(argv) {
7
+ try {
8
+ const { name, config: configPath } = argv;
9
+ console.log(`Enabling MCP server: ${name}`);
10
+ // Validate inputs
11
+ validateServerName(name);
12
+ // Validate config path
13
+ validateConfigPath(configPath);
14
+ // Check if server exists
15
+ if (!serverExists(name, configPath)) {
16
+ throw new Error(`Server '${name}' does not exist. Use 'mcp add' to create it first.`);
17
+ }
18
+ // Get current server configuration
19
+ const currentConfig = getServer(name, configPath);
20
+ if (!currentConfig) {
21
+ throw new Error(`Failed to retrieve server '${name}' configuration.`);
22
+ }
23
+ // Check if server is already enabled
24
+ if (!currentConfig.disabled) {
25
+ console.log(`Server '${name}' is already enabled.`);
26
+ return;
27
+ }
28
+ // Create backup
29
+ const backupPath = backupConfig(configPath);
30
+ // Update configuration to enable the server
31
+ const updatedConfig = {
32
+ ...currentConfig,
33
+ disabled: false,
34
+ };
35
+ // Remove the disabled property entirely if it's false (cleaner config)
36
+ delete updatedConfig.disabled;
37
+ // Save the updated configuration
38
+ setServer(name, updatedConfig, configPath);
39
+ // Reload MCP configuration
40
+ reloadMcpConfig(configPath);
41
+ // Success message
42
+ console.log(`✅ Successfully enabled server '${name}'`);
43
+ console.log(` Status: Disabled → Enabled`);
44
+ console.log(` Backup created: ${backupPath}`);
45
+ console.log(`\n💡 Server enabled. If 1mcp is running, the server will be started automatically.`);
46
+ }
47
+ catch (error) {
48
+ console.error(`❌ Failed to enable server: ${error instanceof Error ? error.message : error}`);
49
+ process.exit(1);
50
+ }
51
+ }
52
+ /**
53
+ * Disable an MCP server without removing it
54
+ */
55
+ export async function disableCommand(argv) {
56
+ try {
57
+ const { name, config: configPath } = argv;
58
+ console.log(`Disabling MCP server: ${name}`);
59
+ // Validate inputs
60
+ validateServerName(name);
61
+ // Validate config path
62
+ validateConfigPath(configPath);
63
+ // Check if server exists
64
+ if (!serverExists(name, configPath)) {
65
+ throw new Error(`Server '${name}' does not exist. Use 'mcp add' to create it first.`);
66
+ }
67
+ // Get current server configuration
68
+ const currentConfig = getServer(name, configPath);
69
+ if (!currentConfig) {
70
+ throw new Error(`Failed to retrieve server '${name}' configuration.`);
71
+ }
72
+ // Check if server is already disabled
73
+ if (currentConfig.disabled) {
74
+ console.log(`Server '${name}' is already disabled.`);
75
+ return;
76
+ }
77
+ // Create backup
78
+ const backupPath = backupConfig(configPath);
79
+ // Update configuration to disable the server
80
+ const updatedConfig = {
81
+ ...currentConfig,
82
+ disabled: true,
83
+ };
84
+ // Save the updated configuration
85
+ setServer(name, updatedConfig, configPath);
86
+ // Reload MCP configuration
87
+ reloadMcpConfig(configPath);
88
+ // Success message
89
+ console.log(`✅ Successfully disabled server '${name}'`);
90
+ console.log(` Status: Enabled → Disabled`);
91
+ console.log(` Backup created: ${backupPath}`);
92
+ console.log(`\n💡 Server disabled. If 1mcp is running, the server will be stopped automatically.`);
93
+ console.log(` Use 'mcp enable ${name}' to re-enable it later.`);
94
+ }
95
+ catch (error) {
96
+ console.error(`❌ Failed to disable server: ${error instanceof Error ? error.message : error}`);
97
+ process.exit(1);
98
+ }
99
+ }
100
+ //# sourceMappingURL=enable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enable.js","sourceRoot":"","sources":["../../../src/commands/mcp/enable.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,eAAe,GAChB,MA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AAO,CAAC,GAAG,CAAC,WAAW,IAAI,wBAAwB,CAAC,CAAC;YACrD,OAAO;QACT,CAAC;QAED,gBAAgB;QAChB,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;QAE5C,6CAA6C;QAC7C,MAAM,aAAa,GAAoB;YACrC,GAAG,aAAa;YAChB,QAAQ,EAAE,IAAI;SACf,CAAC;QAEF,iCAAiC;QACjC,SAAS,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;QAE3C,2BAA2B;QAC3B,eAAe,CAAC,UAAU,CAAC,CAAC;QAE5B,kBAAkB;QAClB,OAAO,CAAC,GAAG,CAAC,mCAAmC,IAAI,GAAG,CAAC,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,sBAAsB,UAAU,EAAE,CAAC,CAAC;QAChD,OAAO,CAAC,GAAG,CAAC,qFAAqF,CAAC,CAAC;QACnG,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,0BAA0B,CAAC,CAAC;IACpE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,+BAA+B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QAC/F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Argv } from 'yargs';
2
+ /**
3
+ * MCP command group entry point.
4
+ *
5
+ * Manages MCP server configurations, allowing users to add, remove, update,
6
+ * enable/disable, list, and check status of MCP servers in their 1mcp configuration.
7
+ */
8
+ /**
9
+ * Register MCP command group and subcommands
10
+ */
11
+ export declare function setupMcpCommands(yargs: Argv): Argv;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAElC;;;;;GAKG;AAEH;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CA6VlD"}
@@ -0,0 +1,351 @@
1
+ /**
2
+ * MCP command group entry point.
3
+ *
4
+ * Manages MCP server configurations, allowing users to add, remove, update,
5
+ * enable/disable, list, and check status of MCP servers in their 1mcp configuration.
6
+ */
7
+ /**
8
+ * Register MCP command group and subcommands
9
+ */
10
+ export function setupMcpCommands(yargs) {
11
+ return yargs.command('mcp', 'Manage MCP server configurations', (yargs) => {
12
+ return yargs
13
+ .command({
14
+ command: 'add <name>',
15
+ describe: 'Add a new MCP server to the configuration',
16
+ builder: (yargs) => {
17
+ return yargs
18
+ .positional('name', {
19
+ describe: 'Name of the MCP server',
20
+ type: 'string',
21
+ demandOption: true,
22
+ })
23
+ .option('config', {
24
+ describe: 'Path to the config file',
25
+ type: 'string',
26
+ alias: 'c',
27
+ })
28
+ .option('type', {
29
+ describe: 'Transport type for the server (auto-detected when using " -- " pattern)',
30
+ type: 'string',
31
+ choices: ['stdio', 'http', 'sse'],
32
+ demandOption: false,
33
+ })
34
+ .option('command', {
35
+ describe: 'Command to execute (required for stdio)',
36
+ type: 'string',
37
+ })
38
+ .option('args', {
39
+ describe: 'Arguments for the command (stdio only)',
40
+ type: 'array',
41
+ string: true,
42
+ })
43
+ .option('url', {
44
+ describe: 'URL for HTTP/SSE servers',
45
+ type: 'string',
46
+ alias: 'u',
47
+ })
48
+ .option('env', {
49
+ describe: 'Environment variables in key=value format',
50
+ type: 'array',
51
+ string: true,
52
+ alias: 'e',
53
+ })
54
+ .option('tags', {
55
+ describe: 'Tags for categorization (comma-separated)',
56
+ type: 'string',
57
+ alias: 'g',
58
+ })
59
+ .option('timeout', {
60
+ describe: 'Connection timeout in milliseconds',
61
+ type: 'number',
62
+ })
63
+ .option('disabled', {
64
+ describe: 'Add server in disabled state',
65
+ type: 'boolean',
66
+ default: false,
67
+ })
68
+ .option('cwd', {
69
+ describe: 'Working directory for stdio servers',
70
+ type: 'string',
71
+ })
72
+ .option('headers', {
73
+ describe: 'HTTP headers in key=value format (HTTP/SSE only)',
74
+ type: 'array',
75
+ string: true,
76
+ })
77
+ .example([
78
+ ['$0 mcp add myserver --type=stdio --command=node --args=server.js', 'Add stdio server (explicit)'],
79
+ ['$0 mcp add webserver --type=http --url=http://localhost:3000/mcp', 'Add HTTP server'],
80
+ [
81
+ '$0 mcp add airtable --env AIRTABLE_API_KEY=key -- npx -y airtable-mcp-server',
82
+ 'Add server using " -- " pattern',
83
+ ],
84
+ ['$0 mcp add myserver -- cmd /c npx -y @some/package', 'Add server with Windows command'],
85
+ ['$0 mcp add tagged --type=stdio --command=echo --tags=dev,test', 'Add server with tags'],
86
+ [
87
+ '$0 mcp add custom --type=stdio --command=python --env=PATH=/custom/path --disabled',
88
+ 'Add disabled server with custom env',
89
+ ],
90
+ ]);
91
+ },
92
+ handler: async (argv) => {
93
+ const { addCommand } = await import('./add.js');
94
+ const { parseDoubleHyphenArgs, hasDoubleHyphen, mergeDoubleHyphenArgs } = await import('./utils/doubleHyphenParser.js');
95
+ // Check if " -- " pattern is used
96
+ if (hasDoubleHyphen(process.argv)) {
97
+ const doubleHyphenResult = parseDoubleHyphenArgs(process.argv);
98
+ const mergedArgv = mergeDoubleHyphenArgs(argv, doubleHyphenResult);
99
+ await addCommand(mergedArgv);
100
+ }
101
+ else {
102
+ await addCommand(argv);
103
+ }
104
+ },
105
+ })
106
+ .command({
107
+ command: 'remove <name>',
108
+ describe: 'Remove an MCP server from the configuration',
109
+ builder: (yargs) => {
110
+ return yargs
111
+ .positional('name', {
112
+ describe: 'Name of the MCP server to remove',
113
+ type: 'string',
114
+ demandOption: true,
115
+ })
116
+ .option('config', {
117
+ describe: 'Path to the config file',
118
+ type: 'string',
119
+ alias: 'c',
120
+ })
121
+ .option('yes', {
122
+ describe: 'Skip confirmation prompt',
123
+ type: 'boolean',
124
+ default: false,
125
+ alias: 'y',
126
+ })
127
+ .example([
128
+ ['$0 mcp remove myserver', 'Remove server with confirmation'],
129
+ ['$0 mcp remove myserver --yes', 'Remove server without confirmation'],
130
+ ]);
131
+ },
132
+ handler: async (argv) => {
133
+ const { removeCommand } = await import('./remove.js');
134
+ await removeCommand(argv);
135
+ },
136
+ })
137
+ .command({
138
+ command: 'update <name>',
139
+ describe: 'Update an existing MCP server configuration',
140
+ builder: (yargs) => {
141
+ return yargs
142
+ .positional('name', {
143
+ describe: 'Name of the MCP server to update',
144
+ type: 'string',
145
+ demandOption: true,
146
+ })
147
+ .option('config', {
148
+ describe: 'Path to the config file',
149
+ type: 'string',
150
+ alias: 'c',
151
+ })
152
+ .option('type', {
153
+ describe: 'Transport type for the server (auto-detected when using " -- " pattern)',
154
+ type: 'string',
155
+ choices: ['stdio', 'http', 'sse'],
156
+ })
157
+ .option('command', {
158
+ describe: 'Command to execute (stdio only)',
159
+ type: 'string',
160
+ })
161
+ .option('args', {
162
+ describe: 'Arguments for the command (stdio only)',
163
+ type: 'array',
164
+ string: true,
165
+ })
166
+ .option('url', {
167
+ describe: 'URL for HTTP/SSE servers',
168
+ type: 'string',
169
+ alias: 'u',
170
+ })
171
+ .option('env', {
172
+ describe: 'Environment variables in key=value format',
173
+ type: 'array',
174
+ string: true,
175
+ alias: 'e',
176
+ })
177
+ .option('tags', {
178
+ describe: 'Tags for categorization (comma-separated)',
179
+ type: 'string',
180
+ alias: 'g',
181
+ })
182
+ .option('timeout', {
183
+ describe: 'Connection timeout in milliseconds',
184
+ type: 'number',
185
+ })
186
+ .option('cwd', {
187
+ describe: 'Working directory for stdio servers',
188
+ type: 'string',
189
+ })
190
+ .option('headers', {
191
+ describe: 'HTTP headers in key=value format (HTTP/SSE only)',
192
+ type: 'array',
193
+ string: true,
194
+ })
195
+ .example([
196
+ ['$0 mcp update myserver --tags=prod,api', 'Update server tags'],
197
+ ['$0 mcp update myserver --env=NODE_ENV=production', 'Update environment'],
198
+ ['$0 mcp update myserver -- npx -y updated-package', 'Update using " -- " pattern'],
199
+ ['$0 mcp update myserver --timeout=10000', 'Update timeout'],
200
+ ]);
201
+ },
202
+ handler: async (argv) => {
203
+ const { updateCommand } = await import('./update.js');
204
+ const { parseDoubleHyphenArgs, hasDoubleHyphen, mergeDoubleHyphenArgs } = await import('./utils/doubleHyphenParser.js');
205
+ // Check if " -- " pattern is used
206
+ if (hasDoubleHyphen(process.argv)) {
207
+ const doubleHyphenResult = parseDoubleHyphenArgs(process.argv);
208
+ const mergedArgv = mergeDoubleHyphenArgs(argv, doubleHyphenResult);
209
+ await updateCommand(mergedArgv);
210
+ }
211
+ else {
212
+ await updateCommand(argv);
213
+ }
214
+ },
215
+ })
216
+ .command({
217
+ command: 'enable <name>',
218
+ describe: 'Enable a disabled MCP server',
219
+ builder: (yargs) => {
220
+ return yargs
221
+ .positional('name', {
222
+ describe: 'Name of the MCP server to enable',
223
+ type: 'string',
224
+ demandOption: true,
225
+ })
226
+ .option('config', {
227
+ describe: 'Path to the config file',
228
+ type: 'string',
229
+ alias: 'c',
230
+ })
231
+ .example([['$0 mcp enable myserver', 'Enable a disabled server']]);
232
+ },
233
+ handler: async (argv) => {
234
+ const { enableCommand } = await import('./enable.js');
235
+ await enableCommand(argv);
236
+ },
237
+ })
238
+ .command({
239
+ command: 'disable <name>',
240
+ describe: 'Disable an MCP server without removing it',
241
+ builder: (yargs) => {
242
+ return yargs
243
+ .positional('name', {
244
+ describe: 'Name of the MCP server to disable',
245
+ type: 'string',
246
+ demandOption: true,
247
+ })
248
+ .option('config', {
249
+ describe: 'Path to the config file',
250
+ type: 'string',
251
+ alias: 'c',
252
+ })
253
+ .example([['$0 mcp disable myserver', 'Disable a server temporarily']]);
254
+ },
255
+ handler: async (argv) => {
256
+ const { disableCommand } = await import('./enable.js');
257
+ await disableCommand(argv);
258
+ },
259
+ })
260
+ .command({
261
+ command: 'list',
262
+ describe: 'List all configured MCP servers',
263
+ builder: (yargs) => {
264
+ return yargs
265
+ .option('config', {
266
+ describe: 'Path to the config file',
267
+ type: 'string',
268
+ alias: 'c',
269
+ })
270
+ .option('show-disabled', {
271
+ describe: 'Include disabled servers in the list',
272
+ type: 'boolean',
273
+ default: false,
274
+ })
275
+ .option('tags', {
276
+ describe: 'Filter servers by tags (comma-separated)',
277
+ type: 'string',
278
+ alias: 'g',
279
+ })
280
+ .option('verbose', {
281
+ describe: 'Show detailed server configuration',
282
+ type: 'boolean',
283
+ default: false,
284
+ alias: 'v',
285
+ })
286
+ .example([
287
+ ['$0 mcp list', 'List all enabled servers'],
288
+ ['$0 mcp list --show-disabled', 'List all servers including disabled'],
289
+ ['$0 mcp list --tags=prod,api', 'List servers with specific tags'],
290
+ ['$0 mcp list --verbose', 'List servers with detailed config'],
291
+ ]);
292
+ },
293
+ handler: async (argv) => {
294
+ const { listCommand } = await import('./list.js');
295
+ await listCommand(argv);
296
+ },
297
+ })
298
+ .command({
299
+ command: 'status [name]',
300
+ describe: 'Show status and details of MCP servers',
301
+ builder: (yargs) => {
302
+ return yargs
303
+ .positional('name', {
304
+ describe: 'Name of specific server to check (optional)',
305
+ type: 'string',
306
+ })
307
+ .option('config', {
308
+ describe: 'Path to the config file',
309
+ type: 'string',
310
+ alias: 'c',
311
+ })
312
+ .option('verbose', {
313
+ describe: 'Show detailed status information',
314
+ type: 'boolean',
315
+ default: false,
316
+ alias: 'v',
317
+ })
318
+ .example([
319
+ ['$0 mcp status', 'Show status of all servers'],
320
+ ['$0 mcp status myserver', 'Show status of specific server'],
321
+ ['$0 mcp status --verbose', 'Show detailed status information'],
322
+ ]);
323
+ },
324
+ handler: async (argv) => {
325
+ const { statusCommand } = await import('./status.js');
326
+ await statusCommand(argv);
327
+ },
328
+ })
329
+ .demandCommand(1, 'You must specify a subcommand')
330
+ .help().epilogue(`
331
+ MCP Command Group - MCP Server Configuration Management
332
+
333
+ The mcp command group helps you manage MCP server configurations in your 1mcp instance.
334
+
335
+ This allows you to:
336
+ • Add new MCP servers with various transport types (stdio, HTTP, SSE)
337
+ • Remove servers you no longer need
338
+ • Update server configurations including environment variables and tags
339
+ • Enable/disable servers without removing them
340
+ • List and filter servers by tags or status
341
+ • Check the status and details of configured servers
342
+
343
+ For more information about each command, use: $0 mcp <command> --help
344
+ `);
345
+ }, () => {
346
+ // This handler runs when 'mcp' is called without a subcommand
347
+ console.log('Please specify a subcommand. Use --help for available commands.');
348
+ process.exit(1);
349
+ });
350
+ }
351
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/mcp/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAW;IAC1C,OAAO,KAAK,CAAC,OAAO,CAClB,KAAK,EACL,kCAAkC,EAClC,CAAC,KAAK,EAAE,EAAE;QACR,OAAO,KAAK;aACT,OAAO,CAAC;YACP,OAAO,EAAE,YAAY;YACrB,QAAQ,EAAE,2CAA2C;YACrD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;gBACjB,OAAO,KAAK;qBACT,UAAU,CAAC,MAAM,EAAE;oBAClB,QAAQ,EAAE,wBAAwB;oBAClC,IAAI,EAAE,QAAQ;oBACd,YAAY,EAAE,IAAI;iBACnB,CAAC;qBACD,MAAM,CAAC,QAAQ,EAAE;oBAChB,QAAQ,EAAE,yBAAyB;oBACnC,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,GAAG;iBACX,CAAC;qBACD,MAAM,CAAC,MAAM,EAAE;oBACd,QAAQ,EAAE,yEAAyE;oBACnF,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC;oBACjC,YAAY,EAAE,KAAK;iBACpB,CAAC;qBACD,MAAM,CAAC,SAAS,EAAE;oBACjB,QAAQ,EAAE,y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