imcp 0.1.3 → 0.1.5

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 (239) hide show
  1. package/README.md +21 -4
  2. package/dist/cli/commands/install.js.map +1 -0
  3. package/dist/cli/commands/list.js.map +1 -0
  4. package/dist/cli/commands/pull.js.map +1 -0
  5. package/dist/cli/commands/serve.js.map +1 -0
  6. package/dist/cli/commands/start.d.ts +2 -0
  7. package/dist/cli/commands/start.js +32 -0
  8. package/dist/cli/commands/start.js.map +1 -0
  9. package/dist/cli/commands/sync.d.ts +2 -0
  10. package/dist/cli/commands/sync.js +17 -0
  11. package/dist/cli/commands/sync.js.map +1 -0
  12. package/dist/cli/commands/uninstall.js.map +1 -0
  13. package/dist/cli/index.js +0 -0
  14. package/dist/cli/index.js.map +1 -0
  15. package/dist/core/ConfigurationLoader.d.ts +32 -0
  16. package/{src/core/loaders/ConfigurationLoader.ts → dist/core/ConfigurationLoader.js} +236 -298
  17. package/dist/core/ConfigurationLoader.js.map +1 -0
  18. package/dist/core/ConfigurationProvider.d.ts +35 -0
  19. package/{src/core/loaders/ConfigurationProvider.ts → dist/core/ConfigurationProvider.js} +375 -462
  20. package/dist/core/ConfigurationProvider.js.map +1 -0
  21. package/dist/core/InstallationService.d.ts +50 -0
  22. package/dist/core/InstallationService.js +350 -0
  23. package/dist/core/InstallationService.js.map +1 -0
  24. package/dist/core/MCPManager.d.ts +28 -0
  25. package/dist/core/MCPManager.js +188 -0
  26. package/dist/core/MCPManager.js.map +1 -0
  27. package/dist/core/RequirementService.d.ts +40 -0
  28. package/dist/core/RequirementService.js +110 -0
  29. package/dist/core/RequirementService.js.map +1 -0
  30. package/dist/core/ServerSchemaLoader.d.ts +11 -0
  31. package/dist/core/ServerSchemaLoader.js +43 -0
  32. package/dist/core/ServerSchemaLoader.js.map +1 -0
  33. package/dist/core/ServerSchemaProvider.d.ts +17 -0
  34. package/dist/core/ServerSchemaProvider.js +120 -0
  35. package/dist/core/ServerSchemaProvider.js.map +1 -0
  36. package/dist/core/constants.d.ts +47 -0
  37. package/dist/core/constants.js +94 -0
  38. package/dist/core/constants.js.map +1 -0
  39. package/dist/core/installers/BaseInstaller.d.ts +74 -0
  40. package/dist/core/installers/BaseInstaller.js +253 -0
  41. package/dist/core/installers/BaseInstaller.js.map +1 -0
  42. package/dist/core/installers/ClientInstaller.d.ts +23 -0
  43. package/dist/core/installers/ClientInstaller.js +564 -0
  44. package/dist/core/installers/ClientInstaller.js.map +1 -0
  45. package/dist/core/installers/CommandInstaller.d.ts +37 -0
  46. package/{src/core/installers/requirements/CommandInstaller.ts → dist/core/installers/CommandInstaller.js} +173 -231
  47. package/dist/core/installers/CommandInstaller.js.map +1 -0
  48. package/dist/core/installers/GeneralInstaller.d.ts +33 -0
  49. package/dist/core/installers/GeneralInstaller.js +85 -0
  50. package/dist/core/installers/GeneralInstaller.js.map +1 -0
  51. package/dist/core/installers/InstallerFactory.d.ts +54 -0
  52. package/{src/core/installers/requirements/InstallerFactory.ts → dist/core/installers/InstallerFactory.js} +97 -112
  53. package/dist/core/installers/InstallerFactory.js.map +1 -0
  54. package/dist/core/installers/NpmInstaller.d.ts +26 -0
  55. package/dist/core/installers/NpmInstaller.js +127 -0
  56. package/dist/core/installers/NpmInstaller.js.map +1 -0
  57. package/dist/core/installers/PipInstaller.d.ts +28 -0
  58. package/dist/core/installers/PipInstaller.js +127 -0
  59. package/dist/core/installers/PipInstaller.js.map +1 -0
  60. package/{src/core/installers/requirements/RequirementInstaller.ts → dist/core/installers/RequirementInstaller.d.ts} +33 -42
  61. package/dist/core/installers/RequirementInstaller.js +3 -0
  62. package/dist/core/installers/RequirementInstaller.js.map +1 -0
  63. package/dist/core/installers/clients/BaseClientInstaller.js.map +1 -0
  64. package/dist/core/installers/clients/ClientInstaller.js.map +1 -0
  65. package/dist/core/installers/clients/ClientInstallerFactory.js.map +1 -0
  66. package/dist/core/installers/clients/ClineInstaller.js.map +1 -0
  67. package/dist/core/installers/clients/ExtensionInstaller.js.map +1 -0
  68. package/dist/core/installers/clients/GithubCopilotInstaller.js.map +1 -0
  69. package/dist/core/installers/clients/MSRooCodeInstaller.js.map +1 -0
  70. package/dist/core/installers/index.js.map +1 -0
  71. package/dist/core/installers/requirements/BaseInstaller.js.map +1 -0
  72. package/dist/core/installers/requirements/CommandInstaller.js.map +1 -0
  73. package/dist/core/installers/requirements/GeneralInstaller.js.map +1 -0
  74. package/dist/core/installers/requirements/InstallerFactory.js +2 -0
  75. package/dist/core/installers/requirements/InstallerFactory.js.map +1 -0
  76. package/dist/core/installers/requirements/NpmInstaller.js.map +1 -0
  77. package/dist/core/installers/requirements/NugetInstaller.d.ts +37 -0
  78. package/dist/core/installers/requirements/NugetInstaller.js +189 -0
  79. package/dist/core/installers/requirements/NugetInstaller.js.map +1 -0
  80. package/dist/core/installers/requirements/PipInstaller.js.map +1 -0
  81. package/dist/core/installers/requirements/RequirementInstaller.js.map +1 -0
  82. package/dist/core/loaders/ConfigurationLoader.js.map +1 -0
  83. package/dist/core/loaders/ConfigurationProvider.js.map +1 -0
  84. package/dist/core/loaders/InstallOperationManager.js.map +1 -0
  85. package/dist/core/loaders/ServerSchemaLoader.js.map +1 -0
  86. package/dist/core/loaders/ServerSchemaProvider.js.map +1 -0
  87. package/dist/core/loaders/SystemSettingsManager.js.map +1 -0
  88. package/dist/core/metadatas/constants.js.map +1 -0
  89. package/dist/core/metadatas/recordingConstants.d.ts +2 -0
  90. package/dist/core/metadatas/recordingConstants.js +2 -0
  91. package/dist/core/metadatas/recordingConstants.js.map +1 -0
  92. package/dist/core/metadatas/types.d.ts +1 -1
  93. package/dist/core/metadatas/types.js.map +1 -0
  94. package/dist/core/onboard/FeedOnboardService.js +1 -22
  95. package/dist/core/onboard/FeedOnboardService.js.map +1 -0
  96. package/dist/core/onboard/OnboardProcessor.js.map +1 -0
  97. package/dist/core/onboard/OnboardStatus.js.map +1 -0
  98. package/dist/core/onboard/OnboardStatusManager.js.map +1 -0
  99. package/dist/core/types.d.ts +166 -0
  100. package/dist/core/types.js +16 -0
  101. package/dist/core/types.js.map +1 -0
  102. package/dist/core/validators/FeedValidator.js.map +1 -0
  103. package/dist/core/validators/IServerValidator.js.map +1 -0
  104. package/dist/core/validators/SSEServerValidator.js.map +1 -0
  105. package/dist/core/validators/ServerValidatorFactory.js.map +1 -0
  106. package/dist/core/validators/StdioServerValidator.js +5 -5
  107. package/dist/core/validators/StdioServerValidator.js.map +1 -0
  108. package/dist/index.js.map +1 -0
  109. package/dist/services/InstallRequestValidator.d.ts +21 -0
  110. package/dist/services/InstallRequestValidator.js +99 -0
  111. package/dist/services/InstallRequestValidator.js.map +1 -0
  112. package/dist/services/InstallationService.js.map +1 -0
  113. package/dist/services/MCPManager.js.map +1 -0
  114. package/dist/services/RequirementService.js.map +1 -0
  115. package/dist/services/ServerService.js.map +1 -0
  116. package/dist/services/TelemetryService.js.map +1 -0
  117. package/dist/utils/UpdateCheckTracker.js.map +1 -0
  118. package/dist/utils/adoUtils.js.map +1 -0
  119. package/dist/utils/clientUtils.js.map +1 -0
  120. package/dist/utils/feedUtils.js.map +1 -0
  121. package/dist/utils/githubAuth.js.map +1 -0
  122. package/dist/utils/githubUtils.js.map +1 -0
  123. package/dist/utils/logger.js.map +1 -0
  124. package/dist/utils/macroExpressionUtils.js.map +1 -0
  125. package/dist/utils/osUtils.d.ts +11 -0
  126. package/dist/utils/osUtils.js +100 -0
  127. package/dist/utils/osUtils.js.map +1 -0
  128. package/dist/utils/versionUtils.js.map +1 -0
  129. package/dist/web/contract/serverContract.js.map +1 -0
  130. package/dist/web/public/index.html +1 -1
  131. package/dist/web/public/js/modal/installHandler.js +227 -0
  132. package/dist/web/public/js/modal/loadingUI.js +74 -0
  133. package/dist/web/public/js/modal/messageQueue.js +101 -45
  134. package/dist/web/public/js/modal/modalUI.js +214 -0
  135. package/{src/web/public/js/modal/versionUtils.js → dist/web/public/js/modal/version.js} +1 -1
  136. package/dist/web/public/js/onboard/templates.js +1 -0
  137. package/dist/web/public/js/serverCategoryList.js +3 -3
  138. package/dist/web/public/onboard.html +4 -4
  139. package/dist/web/server.js.map +1 -0
  140. package/package.json +5 -1
  141. package/.github/ISSUE_TEMPLATE/JitAccess.yml +0 -28
  142. package/.github/acl/access.yml +0 -20
  143. package/.github/compliance/inventory.yml +0 -5
  144. package/.github/policies/jit.yml +0 -19
  145. package/.roo/rules-code/rules.md +0 -88
  146. package/dist/core/onboard/InstallOperationManager.d.ts +0 -23
  147. package/dist/core/onboard/InstallOperationManager.js +0 -144
  148. package/docs/ONBOARDING_PAGE_DESIGN.md +0 -260
  149. package/docs/Telemetry.md +0 -136
  150. package/memory-bank/activeContext.md +0 -26
  151. package/memory-bank/decisionLog.md +0 -91
  152. package/memory-bank/productContext.md +0 -41
  153. package/memory-bank/progress.md +0 -35
  154. package/memory-bank/systemPatterns.md +0 -10
  155. package/src/cli/commands/install.ts +0 -139
  156. package/src/cli/commands/list.ts +0 -113
  157. package/src/cli/commands/pull.ts +0 -16
  158. package/src/cli/commands/serve.ts +0 -39
  159. package/src/cli/commands/uninstall.ts +0 -64
  160. package/src/cli/index.ts +0 -82
  161. package/src/core/installers/clients/BaseClientInstaller.ts +0 -341
  162. package/src/core/installers/clients/ClientInstaller.ts +0 -222
  163. package/src/core/installers/clients/ClientInstallerFactory.ts +0 -43
  164. package/src/core/installers/clients/ClineInstaller.ts +0 -35
  165. package/src/core/installers/clients/ExtensionInstaller.ts +0 -165
  166. package/src/core/installers/clients/GithubCopilotInstaller.ts +0 -79
  167. package/src/core/installers/clients/MSRooCodeInstaller.ts +0 -32
  168. package/src/core/installers/index.ts +0 -11
  169. package/src/core/installers/requirements/BaseInstaller.ts +0 -85
  170. package/src/core/installers/requirements/GeneralInstaller.ts +0 -133
  171. package/src/core/installers/requirements/NpmInstaller.ts +0 -271
  172. package/src/core/installers/requirements/PipInstaller.ts +0 -207
  173. package/src/core/loaders/InstallOperationManager.ts +0 -367
  174. package/src/core/loaders/ServerSchemaLoader.ts +0 -117
  175. package/src/core/loaders/ServerSchemaProvider.ts +0 -99
  176. package/src/core/loaders/SystemSettingsManager.ts +0 -278
  177. package/src/core/metadatas/constants.ts +0 -122
  178. package/src/core/metadatas/recordingConstants.ts +0 -62
  179. package/src/core/metadatas/types.ts +0 -202
  180. package/src/core/onboard/FeedOnboardService.ts +0 -524
  181. package/src/core/onboard/OnboardProcessor.ts +0 -356
  182. package/src/core/onboard/OnboardStatus.ts +0 -60
  183. package/src/core/onboard/OnboardStatusManager.ts +0 -416
  184. package/src/core/validators/FeedValidator.ts +0 -135
  185. package/src/core/validators/IServerValidator.ts +0 -21
  186. package/src/core/validators/SSEServerValidator.ts +0 -43
  187. package/src/core/validators/ServerValidatorFactory.ts +0 -51
  188. package/src/core/validators/StdioServerValidator.ts +0 -312
  189. package/src/index.ts +0 -44
  190. package/src/services/InstallationService.ts +0 -102
  191. package/src/services/MCPManager.ts +0 -249
  192. package/src/services/RequirementService.ts +0 -627
  193. package/src/services/ServerService.ts +0 -161
  194. package/src/services/TelemetryService.ts +0 -59
  195. package/src/utils/UpdateCheckTracker.ts +0 -86
  196. package/src/utils/adoUtils.ts +0 -293
  197. package/src/utils/clientUtils.ts +0 -72
  198. package/src/utils/feedUtils.ts +0 -31
  199. package/src/utils/githubAuth.ts +0 -212
  200. package/src/utils/githubUtils.ts +0 -164
  201. package/src/utils/logger.ts +0 -195
  202. package/src/utils/macroExpressionUtils.ts +0 -104
  203. package/src/utils/osUtils.ts +0 -597
  204. package/src/utils/versionUtils.ts +0 -114
  205. package/src/web/contract/serverContract.ts +0 -74
  206. package/src/web/public/css/detailsWidget.css +0 -235
  207. package/src/web/public/css/modal.css +0 -757
  208. package/src/web/public/css/notifications.css +0 -101
  209. package/src/web/public/css/onboard.css +0 -107
  210. package/src/web/public/css/serverCategoryList.css +0 -120
  211. package/src/web/public/css/serverDetails.css +0 -139
  212. package/src/web/public/index.html +0 -359
  213. package/src/web/public/js/api.js +0 -132
  214. package/src/web/public/js/detailsWidget.js +0 -264
  215. package/src/web/public/js/flights/flights.js +0 -127
  216. package/src/web/public/js/modal/index.js +0 -52
  217. package/src/web/public/js/modal/installModal.js +0 -162
  218. package/src/web/public/js/modal/installation.js +0 -266
  219. package/src/web/public/js/modal/loadingModal.js +0 -182
  220. package/src/web/public/js/modal/modalSetup.js +0 -595
  221. package/src/web/public/js/modal/modalUtils.js +0 -37
  222. package/src/web/public/js/modal.js +0 -42
  223. package/src/web/public/js/notifications.js +0 -137
  224. package/src/web/public/js/onboard/formProcessor.js +0 -1037
  225. package/src/web/public/js/onboard/index.js +0 -374
  226. package/src/web/public/js/onboard/publishHandler.js +0 -172
  227. package/src/web/public/js/onboard/state.js +0 -76
  228. package/src/web/public/js/onboard/templates.js +0 -341
  229. package/src/web/public/js/onboard/uiHandlers.js +0 -1076
  230. package/src/web/public/js/onboard/validationHandlers.js +0 -493
  231. package/src/web/public/js/serverCategoryDetails.js +0 -364
  232. package/src/web/public/js/serverCategoryList.js +0 -241
  233. package/src/web/public/js/settings.js +0 -314
  234. package/src/web/public/modal.html +0 -84
  235. package/src/web/public/onboard.html +0 -296
  236. package/src/web/public/settings.html +0 -135
  237. package/src/web/public/styles.css +0 -277
  238. package/src/web/server.ts +0 -478
  239. package/tsconfig.json +0 -18
@@ -1,462 +1,375 @@
1
- import fs from 'fs/promises';
2
- import path from 'path';
3
- import { exec } from 'child_process';
4
- import { promisify } from 'util';
5
- import { fileURLToPath } from 'url';
6
- import { GITHUB_REPO, LOCAL_FEEDS_DIR, SETTINGS_DIR, SUPPORTED_CLIENTS } from '../metadatas/constants.js';
7
- import { Logger } from '../../utils/logger.js';
8
- import { checkGithubAuth } from '../../utils/githubAuth.js';
9
- import {
10
- MCPConfiguration,
11
- MCPServerCategory,
12
- FeedConfiguration,
13
- InstallationStatus,
14
- RequirementStatus,
15
- MCPServerStatus,
16
- OperationStatus,
17
- ClientSettings,
18
- McpConfig
19
- } from '../metadatas/types.js';
20
- import { ConfigurationLoader } from './ConfigurationLoader.js';
21
-
22
- const execAsync = promisify(exec);
23
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
24
-
25
- export class ConfigurationProvider {
26
- private static instance: ConfigurationProvider;
27
- private configPath: string;
28
- private configuration: MCPConfiguration;
29
- private configLock: Promise<void> = Promise.resolve();
30
- private tempDir: string;
31
-
32
- private constructor() {
33
- // Initialize configuration in user's appdata/imcp directory
34
- this.configPath = path.join(SETTINGS_DIR, 'configurations.json');
35
- this.configuration = {
36
- localServerCategories: [],
37
- feeds: {},
38
- clientMCPSettings: {}
39
- };
40
- this.tempDir = path.join(LOCAL_FEEDS_DIR, '../temp');
41
- }
42
-
43
- public static getInstance(): ConfigurationProvider {
44
- if (!ConfigurationProvider.instance) {
45
- ConfigurationProvider.instance = new ConfigurationProvider();
46
- }
47
- return ConfigurationProvider.instance;
48
- }
49
-
50
- private async withLock<T>(operation: () => Promise<T>): Promise<T> {
51
- const current = this.configLock;
52
- let resolve: () => void;
53
- this.configLock = new Promise<void>(r => resolve = r);
54
- try {
55
- await current;
56
- return await operation();
57
- } finally {
58
- resolve!();
59
- }
60
- }
61
-
62
- async initialize(feedFile?: string, settings?: { prLink?:string, adhocServers?: string[] }): Promise<void> {
63
- await this.withLock(async () => {
64
- const configDir = path.dirname(this.configPath);
65
- await fs.mkdir(configDir, { recursive: true });
66
- // remove the old configuration file if it exists
67
- try {
68
- await fs.rm(this.configPath, { recursive: true, force: true });
69
- } catch (error) {
70
- if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {
71
- throw error;
72
- }
73
- }
74
-
75
- try {
76
- try {
77
- const config = JSON.parse(await fs.readFile(this.configPath, 'utf8'));
78
- this.configuration = config;
79
- } catch (error) {
80
- if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {
81
- throw error;
82
- }
83
- // File doesn't exist, use default empty configuration
84
- await this.saveConfiguration();
85
- }
86
-
87
- // Always load feeds and client settings, whether file existed or not
88
- await this.loadFeedsIntoConfiguration(feedFile, settings);
89
- await this.loadClientMCPSettings();
90
- } catch (error) {
91
- Logger.error('Error during initialization', error);
92
- throw error;
93
- }
94
- });
95
- }
96
-
97
- private async saveConfiguration(): Promise<void> {
98
- const configDir = path.dirname(this.configPath);
99
- await fs.mkdir(configDir, { recursive: true });
100
- await fs.writeFile(this.configPath, JSON.stringify(this.configuration, null, 2));
101
- }
102
-
103
- async getServerCategories(): Promise<MCPServerCategory[]> {
104
- return await this.withLock(async () => {
105
- return this.configuration.localServerCategories;
106
- });
107
- }
108
-
109
- async getServerCategory(categoryName: string): Promise<MCPServerCategory | undefined> {
110
- return await this.withLock(async () => {
111
- return this.configuration.localServerCategories.find(s => s.name === categoryName);
112
- });
113
- }
114
-
115
- async getClientMcpSettings(): Promise<Record<string, Record<string, any>> | undefined> {
116
- return await this.withLock(async () => {
117
- return this.configuration.clientMCPSettings;
118
- });
119
- }
120
-
121
- async getFeedConfiguration(categoryName: string): Promise<FeedConfiguration | undefined> {
122
- return await this.withLock(async () => {
123
- return this.configuration.feeds[categoryName];
124
- });
125
- }
126
-
127
- async getServerMcpConfig(categoryName: string, serverName: string): Promise<McpConfig | undefined> {
128
- return await this.withLock(async () => {
129
- return this.configuration.feeds[categoryName]?.mcpServers.find(s => s.name === serverName);
130
- });
131
- }
132
-
133
- async getInstallationStatus(categoryName: string): Promise<InstallationStatus | undefined> {
134
- return await this.withLock(async () => {
135
- // Inline getServerCategory logic
136
- const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
137
- return category?.installationStatus;
138
- });
139
- }
140
-
141
- async getServerStatus(categoryName: string, serverName: string): Promise<MCPServerStatus | undefined> {
142
- return await this.withLock(async () => {
143
- // Inline getInstallationStatus logic
144
- const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
145
- const status = category?.installationStatus;
146
- return status?.serversStatus[serverName];
147
- });
148
- }
149
-
150
- async getRequirementStatus(categoryName: string, requirementName: string): Promise<RequirementStatus | undefined> {
151
- return await this.withLock(async () => {
152
- // Inline getInstallationStatus logic
153
- const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
154
- const status = category?.installationStatus;
155
- return status?.requirementsStatus[requirementName];
156
- });
157
- }
158
-
159
- async updateInstallationStatus(
160
- categoryName: string,
161
- requirementStatus: Record<string, RequirementStatus>,
162
- serverStatus: Record<string, MCPServerStatus>
163
- ): Promise<boolean> {
164
- return await this.withLock(async () => {
165
- // Inline getServerCategory logic
166
- const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
167
- if (!category) return false;
168
-
169
- if (!category.installationStatus) {
170
- category.installationStatus = {
171
- requirementsStatus: {},
172
- serversStatus: {},
173
- lastUpdated: new Date().toISOString()
174
- };
175
- }
176
-
177
- category.installationStatus.requirementsStatus = {
178
- ...category.installationStatus.requirementsStatus,
179
- ...requirementStatus
180
- };
181
-
182
- category.installationStatus.serversStatus = {
183
- ...category.installationStatus.serversStatus,
184
- ...serverStatus
185
- };
186
-
187
- category.installationStatus.lastUpdated = new Date().toISOString();
188
- await this.saveConfiguration();
189
- return true;
190
- });
191
- }
192
-
193
- async updateRequirementStatus(
194
- categoryName: string,
195
- requirementName: string,
196
- status: RequirementStatus
197
- ): Promise<boolean> {
198
- return await this.withLock(async () => {
199
- // Inline getServerCategory logic
200
- const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
201
- if (!category?.installationStatus) return false;
202
-
203
- category.installationStatus.requirementsStatus[requirementName] = status;
204
- category.installationStatus.lastUpdated = new Date().toISOString();
205
- await this.saveConfiguration();
206
- return true;
207
- });
208
- }
209
-
210
- async updateRequirementOperationStatus(
211
- categoryName: string,
212
- requirementName: string,
213
- operationStatus: OperationStatus
214
- ): Promise<boolean> {
215
- return await this.withLock(async () => {
216
- // Inline getServerCategory logic
217
- const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
218
- if (!category?.installationStatus?.requirementsStatus[requirementName]) return false;
219
-
220
- category.installationStatus.requirementsStatus[requirementName].operationStatus = operationStatus;
221
- category.installationStatus.lastUpdated = new Date().toISOString();
222
- await this.saveConfiguration();
223
- return true;
224
- });
225
- }
226
-
227
- async updateServerStatus(
228
- categoryName: string,
229
- serverName: string,
230
- status: MCPServerStatus
231
- ): Promise<boolean> {
232
- return await this.withLock(async () => {
233
- // Inline getServerCategory logic
234
- const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
235
- if (!category?.installationStatus) return false;
236
-
237
- category.installationStatus.serversStatus[serverName] = status;
238
- category.installationStatus.lastUpdated = new Date().toISOString();
239
- await this.saveConfiguration();
240
- return true;
241
- });
242
- }
243
-
244
- async updateServerOperationStatus(
245
- categoryName: string,
246
- serverName: string,
247
- clientName: string,
248
- operationStatus: OperationStatus
249
- ): Promise<boolean> {
250
- return await this.withLock(async () => {
251
- // Inline getServerCategory logic
252
- const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
253
- if (!category?.installationStatus?.serversStatus[serverName]) return false;
254
-
255
- category.installationStatus.serversStatus[serverName].installedStatus[clientName] = operationStatus;
256
- category.installationStatus.lastUpdated = new Date().toISOString();
257
- await this.saveConfiguration();
258
- return true;
259
- });
260
- }
261
-
262
- async isRequirementsReady(categoryName: string, serverName: string): Promise<boolean> {
263
- return await this.withLock(async () => {
264
- // Inline getServerCategory logic
265
- const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
266
- if (!category?.feedConfiguration) return false;
267
-
268
- const serverConfig = category.feedConfiguration.mcpServers.find(s => s.name === serverName);
269
- if (!serverConfig?.dependencies?.requirements) return true; // No requirements means ready
270
-
271
- const requirementNames = serverConfig.dependencies.requirements.map(r => r.name);
272
- // Inline getInstallationStatus logic (using the already fetched category)
273
- const status = category?.installationStatus;
274
-
275
- if (!status?.requirementsStatus) return false;
276
-
277
- return requirementNames.every(name => {
278
- const reqStatus = status.requirementsStatus[name];
279
- return reqStatus?.installed && !reqStatus?.error;
280
- });
281
- });
282
- }
283
-
284
- async GetServerRequirementStatus(categoryName: string, serverName: string): Promise<RequirementStatus[]> {
285
- return await this.withLock(async () => {
286
- // Inline getServerCategory logic
287
- const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
288
- if (!category?.feedConfiguration) return [];
289
- const serverConfig = category.feedConfiguration.mcpServers.find(s => s.name === serverName);
290
- if (!serverConfig?.dependencies?.requirements) return [];
291
- const requirementNames = serverConfig.dependencies.requirements.map(r => r.name);
292
-
293
- return requirementNames
294
- .map(name => category?.installationStatus?.requirementsStatus[name])
295
- .filter(x => x !== undefined) as RequirementStatus[];
296
- });
297
- }
298
-
299
- async isServerReady(categoryName: string, serverName: string, clients: string[]): Promise<boolean> {
300
- return await this.withLock(async () => {
301
- // Inline the logic from getServerStatus and getInstallationStatus to avoid nested lock
302
- const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
303
- const installationStatus = category?.installationStatus;
304
- const serverStatus = installationStatus?.serversStatus[serverName];
305
-
306
- if (!serverStatus) return false;
307
-
308
- return clients.every(clientName => {
309
- // Add optional chaining for safety in case installedStatus is missing
310
- const clientStatus = serverStatus.installedStatus?.[clientName];
311
- return clientStatus?.status === 'completed' && !clientStatus?.error;
312
- });
313
- });
314
- }
315
- async syncFeeds(): Promise<void> {
316
- return await this.withLock(async () => {
317
- Logger.log('Starting feed synchronization...');
318
- try {
319
- // Check GitHub authentication first
320
- await checkGithubAuth();
321
-
322
- Logger.debug({
323
- action: 'create_directories',
324
- paths: {
325
- localFeeds: LOCAL_FEEDS_DIR,
326
- tempDir: this.tempDir
327
- }
328
- });
329
-
330
- await fs.mkdir(LOCAL_FEEDS_DIR, { recursive: true });
331
- await fs.mkdir(this.tempDir, { recursive: true });
332
-
333
- // Clean up temp directory
334
- await fs.rm(this.tempDir, { recursive: true, force: true });
335
-
336
- // Download latest release
337
- Logger.debug('Downloading latest release...');
338
- const { downloadGithubRelease } = await import('../../utils/githubUtils.js');
339
- const { version, downloadPath } = await downloadGithubRelease(
340
- GITHUB_REPO.repoName,
341
- 'latest',
342
- GITHUB_REPO.feedAssetsName,
343
- undefined,
344
- true,
345
- this.tempDir
346
- );
347
-
348
- Logger.debug({
349
- action: 'download_release',
350
- downloadPath,
351
- version,
352
- repoName: GITHUB_REPO.repoName,
353
- });
354
-
355
- Logger.debug('Updating local feeds...');
356
- await fs.rm(LOCAL_FEEDS_DIR, { recursive: true, force: true });
357
- const sourceFeedsDir = downloadPath;
358
-
359
- try {
360
- await fs.access(downloadPath);
361
- } catch (err) {
362
- throw new Error(`Could not find feeds directory in downloaded path: ${sourceFeedsDir}`);
363
- }
364
-
365
- await fs.cp(sourceFeedsDir, LOCAL_FEEDS_DIR, { recursive: true, force: true });
366
- Logger.log('Successfully updated local feeds');
367
-
368
- } catch (error) {
369
- Logger.error('Error during feed synchronization', error);
370
- throw new Error('Failed to sync feeds. Use --verbose for detailed error information.');
371
- }
372
- });
373
- }
374
-
375
- private async loadFeedsIntoConfiguration(feedFile?: string, settings?: { prLink?:string, adhocServers?: string[] }): Promise<void> {
376
- this.configuration = await ConfigurationLoader.loadFeedsIntoConfiguration(this.configuration, feedFile, settings);
377
- await this.saveConfiguration();
378
- }
379
-
380
- private async loadClientMCPSettings(): Promise<void> {
381
- this.configuration = await ConfigurationLoader.loadClientMCPSettings(this.configuration);
382
- await this.saveConfiguration();
383
- }
384
-
385
- // Public method to reload client MCP settings
386
- async reloadClientMCPSettings(): Promise<void> {
387
- return await this.withLock(async () => {
388
- await this.loadClientMCPSettings();
389
- });
390
- }
391
-
392
- async removeServerFromClientMCPSettings(serverName: string, target?: string): Promise<void> {
393
- return await this.withLock(async () => {
394
- // Load utils in async context to avoid circular dependencies
395
- const { readJsonFile, writeJsonFile } = await import('../../utils/clientUtils.js');
396
-
397
- // Filter clients if target is specified
398
- const clientEntries = Object.entries(SUPPORTED_CLIENTS as Record<string, ClientSettings>);
399
- const targetClients = target
400
- ? clientEntries.filter(([clientName]) => clientName === target)
401
- : clientEntries;
402
-
403
- for (const [clientName, clientSettings] of targetClients) {
404
- const settingPath = process.env.CODE_INSIDERS
405
- ? clientSettings.codeInsiderSettingPath
406
- : clientSettings.codeSettingPath;
407
-
408
- try {
409
- const content = await readJsonFile(settingPath, true);
410
- let modified = false;
411
-
412
- // Handle GitHub Copilot's different structure
413
- if (clientName === 'GithubCopilot' && content.mcp?.servers?.[serverName]) {
414
- delete content.mcp.servers[serverName];
415
- modified = true;
416
- } else if (content.mcpServers?.[serverName]) {
417
- delete content.mcpServers[serverName];
418
- modified = true;
419
- }
420
-
421
- // Only write if we actually modified the content
422
- if (modified) {
423
- await writeJsonFile(settingPath, content);
424
- Logger.debug(`Removed server ${serverName} from client ${clientName} settings`);
425
- }
426
- } catch (error) {
427
- Logger.error(`Failed to remove server ${serverName} from client ${clientName} settings:`, error);
428
- }
429
- }
430
-
431
- // Also update our in-memory configuration
432
- if (this.configuration.clientMCPSettings) {
433
- if (target) {
434
- // Only update settings for the target client
435
- const clientSettings = this.configuration.clientMCPSettings[target];
436
- if (clientSettings) {
437
- if (clientSettings.mcpServers?.[serverName]) {
438
- delete clientSettings.mcpServers[serverName];
439
- }
440
- if (clientSettings.servers?.[serverName]) { // For GitHub Copilot
441
- delete clientSettings.servers[serverName];
442
- }
443
- }
444
- } else {
445
- // Update all clients if no target specified
446
- for (const clientSettings of Object.values(this.configuration.clientMCPSettings)) {
447
- if (clientSettings.mcpServers?.[serverName]) {
448
- delete clientSettings.mcpServers[serverName];
449
- }
450
- if (clientSettings.servers?.[serverName]) { // For GitHub Copilot
451
- delete clientSettings.servers[serverName];
452
- }
453
- }
454
- }
455
- await this.saveConfiguration();
456
- }
457
- });
458
- }
459
- }
460
-
461
- // Export a singleton instance
462
- export const configProvider = ConfigurationProvider.getInstance();
1
+ import fs from 'fs/promises';
2
+ import path from 'path';
3
+ import { exec } from 'child_process';
4
+ import { promisify } from 'util';
5
+ import { fileURLToPath } from 'url';
6
+ import { GITHUB_REPO, LOCAL_FEEDS_DIR, SETTINGS_DIR, SUPPORTED_CLIENTS } from './constants.js';
7
+ import { Logger } from '../utils/logger.js';
8
+ import { checkGithubAuth } from '../utils/githubAuth.js';
9
+ import { ConfigurationLoader } from './ConfigurationLoader.js';
10
+ const execAsync = promisify(exec);
11
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
12
+ export class ConfigurationProvider {
13
+ static instance;
14
+ configPath;
15
+ configuration;
16
+ configLock = Promise.resolve();
17
+ tempDir;
18
+ constructor() {
19
+ // Initialize configuration in user's appdata/imcp directory
20
+ this.configPath = path.join(SETTINGS_DIR, 'configurations.json');
21
+ this.configuration = {
22
+ localServerCategories: [],
23
+ feeds: {},
24
+ clientMCPSettings: {}
25
+ };
26
+ this.tempDir = path.join(LOCAL_FEEDS_DIR, '../temp');
27
+ }
28
+ static getInstance() {
29
+ if (!ConfigurationProvider.instance) {
30
+ ConfigurationProvider.instance = new ConfigurationProvider();
31
+ }
32
+ return ConfigurationProvider.instance;
33
+ }
34
+ async withLock(operation) {
35
+ const current = this.configLock;
36
+ let resolve;
37
+ this.configLock = new Promise(r => resolve = r);
38
+ try {
39
+ await current;
40
+ return await operation();
41
+ }
42
+ finally {
43
+ resolve();
44
+ }
45
+ }
46
+ async initialize(feedFile) {
47
+ await this.withLock(async () => {
48
+ const configDir = path.dirname(this.configPath);
49
+ await fs.mkdir(configDir, { recursive: true });
50
+ try {
51
+ try {
52
+ const config = JSON.parse(await fs.readFile(this.configPath, 'utf8'));
53
+ this.configuration = config;
54
+ }
55
+ catch (error) {
56
+ if (error.code !== 'ENOENT') {
57
+ throw error;
58
+ }
59
+ // File doesn't exist, use default empty configuration
60
+ await this.saveConfiguration();
61
+ }
62
+ // Always load feeds and client settings, whether file existed or not
63
+ await this.loadFeedsIntoConfiguration(feedFile);
64
+ await this.loadClientMCPSettings();
65
+ }
66
+ catch (error) {
67
+ Logger.error('Error during initialization', error);
68
+ throw error;
69
+ }
70
+ });
71
+ }
72
+ async saveConfiguration() {
73
+ const configDir = path.dirname(this.configPath);
74
+ await fs.mkdir(configDir, { recursive: true });
75
+ await fs.writeFile(this.configPath, JSON.stringify(this.configuration, null, 2));
76
+ }
77
+ async getServerCategories() {
78
+ return await this.withLock(async () => {
79
+ return this.configuration.localServerCategories;
80
+ });
81
+ }
82
+ async getServerCategory(categoryName) {
83
+ return await this.withLock(async () => {
84
+ return this.configuration.localServerCategories.find(s => s.name === categoryName);
85
+ });
86
+ }
87
+ async getClientMcpSettings() {
88
+ return await this.withLock(async () => {
89
+ return this.configuration.clientMCPSettings;
90
+ });
91
+ }
92
+ async getFeedConfiguration(categoryName) {
93
+ return await this.withLock(async () => {
94
+ return this.configuration.feeds[categoryName];
95
+ });
96
+ }
97
+ async getServerMcpConfig(categoryName, serverName) {
98
+ return await this.withLock(async () => {
99
+ return this.configuration.feeds[categoryName]?.mcpServers.find(s => s.name === serverName);
100
+ });
101
+ }
102
+ async getInstallationStatus(categoryName) {
103
+ return await this.withLock(async () => {
104
+ // Inline getServerCategory logic
105
+ const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
106
+ return category?.installationStatus;
107
+ });
108
+ }
109
+ async getServerStatus(categoryName, serverName) {
110
+ return await this.withLock(async () => {
111
+ // Inline getInstallationStatus logic
112
+ const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
113
+ const status = category?.installationStatus;
114
+ return status?.serversStatus[serverName];
115
+ });
116
+ }
117
+ async getRequirementStatus(categoryName, requirementName) {
118
+ return await this.withLock(async () => {
119
+ // Inline getInstallationStatus logic
120
+ const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
121
+ const status = category?.installationStatus;
122
+ return status?.requirementsStatus[requirementName];
123
+ });
124
+ }
125
+ async updateInstallationStatus(categoryName, requirementStatus, serverStatus) {
126
+ return await this.withLock(async () => {
127
+ // Inline getServerCategory logic
128
+ const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
129
+ if (!category)
130
+ return false;
131
+ if (!category.installationStatus) {
132
+ category.installationStatus = {
133
+ requirementsStatus: {},
134
+ serversStatus: {},
135
+ lastUpdated: new Date().toISOString()
136
+ };
137
+ }
138
+ category.installationStatus.requirementsStatus = {
139
+ ...category.installationStatus.requirementsStatus,
140
+ ...requirementStatus
141
+ };
142
+ category.installationStatus.serversStatus = {
143
+ ...category.installationStatus.serversStatus,
144
+ ...serverStatus
145
+ };
146
+ category.installationStatus.lastUpdated = new Date().toISOString();
147
+ await this.saveConfiguration();
148
+ return true;
149
+ });
150
+ }
151
+ async updateRequirementStatus(categoryName, requirementName, status) {
152
+ return await this.withLock(async () => {
153
+ // Inline getServerCategory logic
154
+ const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
155
+ if (!category?.installationStatus)
156
+ return false;
157
+ category.installationStatus.requirementsStatus[requirementName] = status;
158
+ category.installationStatus.lastUpdated = new Date().toISOString();
159
+ await this.saveConfiguration();
160
+ return true;
161
+ });
162
+ }
163
+ async updateRequirementOperationStatus(categoryName, requirementName, operationStatus) {
164
+ return await this.withLock(async () => {
165
+ // Inline getServerCategory logic
166
+ const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
167
+ if (!category?.installationStatus?.requirementsStatus[requirementName])
168
+ return false;
169
+ category.installationStatus.requirementsStatus[requirementName].operationStatus = operationStatus;
170
+ category.installationStatus.lastUpdated = new Date().toISOString();
171
+ await this.saveConfiguration();
172
+ return true;
173
+ });
174
+ }
175
+ async updateServerStatus(categoryName, serverName, status) {
176
+ return await this.withLock(async () => {
177
+ // Inline getServerCategory logic
178
+ const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
179
+ if (!category?.installationStatus)
180
+ return false;
181
+ category.installationStatus.serversStatus[serverName] = status;
182
+ category.installationStatus.lastUpdated = new Date().toISOString();
183
+ await this.saveConfiguration();
184
+ return true;
185
+ });
186
+ }
187
+ async updateServerOperationStatus(categoryName, serverName, clientName, operationStatus) {
188
+ return await this.withLock(async () => {
189
+ // Inline getServerCategory logic
190
+ const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
191
+ if (!category?.installationStatus?.serversStatus[serverName])
192
+ return false;
193
+ category.installationStatus.serversStatus[serverName].installedStatus[clientName] = operationStatus;
194
+ category.installationStatus.lastUpdated = new Date().toISOString();
195
+ await this.saveConfiguration();
196
+ return true;
197
+ });
198
+ }
199
+ async isRequirementsReady(categoryName, serverName) {
200
+ return await this.withLock(async () => {
201
+ // Inline getServerCategory logic
202
+ const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
203
+ if (!category?.feedConfiguration)
204
+ return false;
205
+ const serverConfig = category.feedConfiguration.mcpServers.find(s => s.name === serverName);
206
+ if (!serverConfig?.dependencies?.requirements)
207
+ return true; // No requirements means ready
208
+ const requirementNames = serverConfig.dependencies.requirements.map(r => r.name);
209
+ // Inline getInstallationStatus logic (using the already fetched category)
210
+ const status = category?.installationStatus;
211
+ if (!status?.requirementsStatus)
212
+ return false;
213
+ return requirementNames.every(name => {
214
+ const reqStatus = status.requirementsStatus[name];
215
+ return reqStatus?.installed && !reqStatus?.error;
216
+ });
217
+ });
218
+ }
219
+ async GetServerRequirementStatus(categoryName, serverName) {
220
+ return await this.withLock(async () => {
221
+ // Inline getServerCategory logic
222
+ const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
223
+ if (!category?.feedConfiguration)
224
+ return [];
225
+ const serverConfig = category.feedConfiguration.mcpServers.find(s => s.name === serverName);
226
+ if (!serverConfig?.dependencies?.requirements)
227
+ return [];
228
+ const requirementNames = serverConfig.dependencies.requirements.map(r => r.name);
229
+ return requirementNames
230
+ .map(name => category?.installationStatus?.requirementsStatus[name])
231
+ .filter(x => x !== undefined);
232
+ });
233
+ }
234
+ async isServerReady(categoryName, serverName, clients) {
235
+ return await this.withLock(async () => {
236
+ // Inline the logic from getServerStatus and getInstallationStatus to avoid nested lock
237
+ const category = this.configuration.localServerCategories.find(s => s.name === categoryName);
238
+ const installationStatus = category?.installationStatus;
239
+ const serverStatus = installationStatus?.serversStatus[serverName];
240
+ if (!serverStatus)
241
+ return false;
242
+ return clients.every(clientName => {
243
+ // Add optional chaining for safety in case installedStatus is missing
244
+ const clientStatus = serverStatus.installedStatus?.[clientName];
245
+ return clientStatus?.status === 'completed' && !clientStatus?.error;
246
+ });
247
+ });
248
+ }
249
+ async syncFeeds() {
250
+ return await this.withLock(async () => {
251
+ Logger.log('Starting feed synchronization...');
252
+ try {
253
+ // Check GitHub authentication first
254
+ await checkGithubAuth();
255
+ Logger.debug({
256
+ action: 'create_directories',
257
+ paths: {
258
+ localFeeds: LOCAL_FEEDS_DIR,
259
+ tempDir: this.tempDir
260
+ }
261
+ });
262
+ await fs.mkdir(LOCAL_FEEDS_DIR, { recursive: true });
263
+ await fs.mkdir(this.tempDir, { recursive: true });
264
+ // Clean up temp directory
265
+ await fs.rm(this.tempDir, { recursive: true, force: true });
266
+ // Download latest release
267
+ Logger.debug('Downloading latest release...');
268
+ const { downloadGithubRelease } = await import('../utils/githubUtils.js');
269
+ const { version, downloadPath } = await downloadGithubRelease(GITHUB_REPO.repoName, 'latest', GITHUB_REPO.feedAssetsName, undefined, true, this.tempDir);
270
+ Logger.debug({
271
+ action: 'download_release',
272
+ downloadPath,
273
+ version,
274
+ repoName: GITHUB_REPO.repoName,
275
+ });
276
+ Logger.debug('Updating local feeds...');
277
+ await fs.rm(LOCAL_FEEDS_DIR, { recursive: true, force: true });
278
+ const sourceFeedsDir = downloadPath;
279
+ try {
280
+ await fs.access(downloadPath);
281
+ }
282
+ catch (err) {
283
+ throw new Error(`Could not find feeds directory in downloaded path: ${sourceFeedsDir}`);
284
+ }
285
+ await fs.cp(sourceFeedsDir, LOCAL_FEEDS_DIR, { recursive: true, force: true });
286
+ Logger.log('Successfully updated local feeds');
287
+ }
288
+ catch (error) {
289
+ Logger.error('Error during feed synchronization', error);
290
+ throw new Error('Failed to sync feeds. Use --verbose for detailed error information.');
291
+ }
292
+ });
293
+ }
294
+ async loadFeedsIntoConfiguration(feedFile) {
295
+ this.configuration = await ConfigurationLoader.loadFeedsIntoConfiguration(this.configuration, feedFile);
296
+ await this.saveConfiguration();
297
+ }
298
+ async loadClientMCPSettings() {
299
+ this.configuration = await ConfigurationLoader.loadClientMCPSettings(this.configuration);
300
+ await this.saveConfiguration();
301
+ }
302
+ // Public method to reload client MCP settings
303
+ async reloadClientMCPSettings() {
304
+ return await this.withLock(async () => {
305
+ await this.loadClientMCPSettings();
306
+ });
307
+ }
308
+ async removeServerFromClientMCPSettings(serverName, target) {
309
+ return await this.withLock(async () => {
310
+ // Load utils in async context to avoid circular dependencies
311
+ const { readJsonFile, writeJsonFile } = await import('../utils/clientUtils.js');
312
+ // Filter clients if target is specified
313
+ const clientEntries = Object.entries(SUPPORTED_CLIENTS);
314
+ const targetClients = target
315
+ ? clientEntries.filter(([clientName]) => clientName === target)
316
+ : clientEntries;
317
+ for (const [clientName, clientSettings] of targetClients) {
318
+ const settingPath = process.env.CODE_INSIDERS
319
+ ? clientSettings.codeInsiderSettingPath
320
+ : clientSettings.codeSettingPath;
321
+ try {
322
+ const content = await readJsonFile(settingPath, true);
323
+ let modified = false;
324
+ // Handle GitHub Copilot's different structure
325
+ if (clientName === 'GithubCopilot' && content.mcp?.servers?.[serverName]) {
326
+ delete content.mcp.servers[serverName];
327
+ modified = true;
328
+ }
329
+ else if (content.mcpServers?.[serverName]) {
330
+ delete content.mcpServers[serverName];
331
+ modified = true;
332
+ }
333
+ // Only write if we actually modified the content
334
+ if (modified) {
335
+ await writeJsonFile(settingPath, content);
336
+ Logger.debug(`Removed server ${serverName} from client ${clientName} settings`);
337
+ }
338
+ }
339
+ catch (error) {
340
+ Logger.error(`Failed to remove server ${serverName} from client ${clientName} settings:`, error);
341
+ }
342
+ }
343
+ // Also update our in-memory configuration
344
+ if (this.configuration.clientMCPSettings) {
345
+ if (target) {
346
+ // Only update settings for the target client
347
+ const clientSettings = this.configuration.clientMCPSettings[target];
348
+ if (clientSettings) {
349
+ if (clientSettings.mcpServers?.[serverName]) {
350
+ delete clientSettings.mcpServers[serverName];
351
+ }
352
+ if (clientSettings.servers?.[serverName]) { // For GitHub Copilot
353
+ delete clientSettings.servers[serverName];
354
+ }
355
+ }
356
+ }
357
+ else {
358
+ // Update all clients if no target specified
359
+ for (const clientSettings of Object.values(this.configuration.clientMCPSettings)) {
360
+ if (clientSettings.mcpServers?.[serverName]) {
361
+ delete clientSettings.mcpServers[serverName];
362
+ }
363
+ if (clientSettings.servers?.[serverName]) { // For GitHub Copilot
364
+ delete clientSettings.servers[serverName];
365
+ }
366
+ }
367
+ }
368
+ await this.saveConfiguration();
369
+ }
370
+ });
371
+ }
372
+ }
373
+ // Export a singleton instance
374
+ export const configProvider = ConfigurationProvider.getInstance();
375
+ //# sourceMappingURL=ConfigurationProvider.js.map