imcp 0.0.6 → 0.0.7

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.
@@ -48,17 +48,24 @@ export class ConfigurationProvider {
48
48
  const configDir = path.dirname(this.configPath);
49
49
  await fs.mkdir(configDir, { recursive: true });
50
50
  try {
51
- const config = JSON.parse(await fs.readFile(this.configPath, 'utf8'));
52
- this.configuration = config;
53
- await this.loadFeedsIntoConfiguration(); // Load feeds into configuration
54
- await this.loadClientMCPSettings(); // Load MCP settings for each client
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();
64
+ await this.loadClientMCPSettings();
55
65
  }
56
66
  catch (error) {
57
- if (error.code !== 'ENOENT') {
58
- throw error;
59
- }
60
- // File doesn't exist, use default empty configuration
61
- await this.saveConfiguration();
67
+ Logger.error('Error during initialization', error);
68
+ throw error;
62
69
  }
63
70
  });
64
71
  }
@@ -256,7 +263,7 @@ export class ConfigurationProvider {
256
263
  });
257
264
  }
258
265
  Logger.debug('Updating local feeds...');
259
- // await fs.rm(LOCAL_FEEDS_DIR, { recursive: true, force: true });
266
+ await fs.rm(LOCAL_FEEDS_DIR, { recursive: true, force: true });
260
267
  const sourceFeedsDir = path.join(this.tempDir, GITHUB_REPO.feedsPath);
261
268
  try {
262
269
  await fs.access(sourceFeedsDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imcp",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Node.js SDK for Model Context Protocol (MCP)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -63,16 +63,23 @@ export class ConfigurationProvider {
63
63
  await fs.mkdir(configDir, { recursive: true });
64
64
 
65
65
  try {
66
- const config = JSON.parse(await fs.readFile(this.configPath, 'utf8'));
67
- this.configuration = config;
68
- await this.loadFeedsIntoConfiguration(); // Load feeds into configuration
69
- await this.loadClientMCPSettings(); // Load MCP settings for each client
70
- } catch (error) {
71
- if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {
72
- throw error;
66
+ try {
67
+ const config = JSON.parse(await fs.readFile(this.configPath, 'utf8'));
68
+ this.configuration = config;
69
+ } catch (error) {
70
+ if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {
71
+ throw error;
72
+ }
73
+ // File doesn't exist, use default empty configuration
74
+ await this.saveConfiguration();
73
75
  }
74
- // File doesn't exist, use default empty configuration
75
- await this.saveConfiguration();
76
+
77
+ // Always load feeds and client settings, whether file existed or not
78
+ await this.loadFeedsIntoConfiguration();
79
+ await this.loadClientMCPSettings();
80
+ } catch (error) {
81
+ Logger.error('Error during initialization', error);
82
+ throw error;
76
83
  }
77
84
  });
78
85
  }
@@ -314,7 +321,7 @@ export class ConfigurationProvider {
314
321
  }
315
322
 
316
323
  Logger.debug('Updating local feeds...');
317
- // await fs.rm(LOCAL_FEEDS_DIR, { recursive: true, force: true });
324
+ await fs.rm(LOCAL_FEEDS_DIR, { recursive: true, force: true });
318
325
  const sourceFeedsDir = path.join(this.tempDir, GITHUB_REPO.feedsPath);
319
326
 
320
327
  try {