@liangshanli/mcp-server-project-standards 1.2.1 → 2.0.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.
@@ -7,13 +7,15 @@ const project_structure = require('./utils/get_project_structure');
7
7
  const api_standards = require('./utils/get_api_standards');
8
8
  const development_standards = require('./utils/get_development_standards');
9
9
  const database_standards = require('./utils/database_standards');
10
+ const api_login = require('./utils/api_login');
10
11
  const api_debug = require('./utils/api_debug');
12
+ const api_config = require('./utils/api_config');
11
13
 
12
14
  // Get configuration from file or environment
13
15
  const getConfig = () => {
14
16
  const configDir = process.env.CONFIG_DIR || './.setting';
15
17
  const configPath = path.join(configDir, 'config.json');
16
-
18
+
17
19
  try {
18
20
  if (fs.existsSync(configPath)) {
19
21
  const configData = fs.readFileSync(configPath, 'utf8');
@@ -31,7 +33,7 @@ const getConfig = () => {
31
33
  const saveConfig = (config) => {
32
34
  const configDir = process.env.CONFIG_DIR || './.setting';
33
35
  const configPath = path.join(configDir, 'config.json');
34
-
36
+
35
37
  try {
36
38
  if (!fs.existsSync(configDir)) {
37
39
  fs.mkdirSync(configDir, { recursive: true });
@@ -54,11 +56,11 @@ console.error('==============================================');
54
56
  class ProjectStandardsMCPServer {
55
57
  constructor() {
56
58
  this.name = 'project-standards-mcp-server';
57
- this.version = '1.2.1';
59
+ this.version = '1.2.2';
58
60
  this.initialized = false;
59
61
  this.config = getConfig();
60
62
  this.needsProjectFolder = this.config === null;
61
-
63
+
62
64
  // 如果配置文件不存在,创建默认配置
63
65
  if (this.needsProjectFolder) {
64
66
  this.createDefaultConfig();
@@ -69,14 +71,14 @@ class ProjectStandardsMCPServer {
69
71
  createDefaultConfig() {
70
72
  const configDir = process.env.CONFIG_DIR || './.setting';
71
73
  const configPath = path.join(configDir, 'config.json');
72
-
74
+
73
75
  try {
74
76
  // 创建配置目录
75
77
  if (!fs.existsSync(configDir)) {
76
78
  fs.mkdirSync(configDir, { recursive: true });
77
79
  console.error(`Created config directory: ${configDir}`);
78
80
  }
79
-
81
+
80
82
  // 创建默认配置文件
81
83
  const defaultConfig = {
82
84
  project_info: {},
@@ -85,10 +87,10 @@ class ProjectStandardsMCPServer {
85
87
  development_standards: [],
86
88
  database_standards: []
87
89
  };
88
-
90
+
89
91
  fs.writeFileSync(configPath, JSON.stringify(defaultConfig, null, 2), 'utf8');
90
92
  console.error(`Created default config file: ${configPath}`);
91
-
93
+
92
94
  // 更新配置和状态
93
95
  this.config = defaultConfig;
94
96
  this.needsProjectFolder = false;
@@ -149,7 +151,7 @@ class ProjectStandardsMCPServer {
149
151
  return result;
150
152
  }
151
153
 
152
- // API debug tool
154
+ // API debug tool (legacy)
153
155
  async api_debug(params) {
154
156
  const result = await api_debug(params, this.config, saveConfig);
155
157
  // Update local config if action was 'set'
@@ -159,6 +161,24 @@ class ProjectStandardsMCPServer {
159
161
  return result;
160
162
  }
161
163
 
164
+ // API login tool
165
+ async api_login(params) {
166
+ const result = await api_login(params, this.config, saveConfig);
167
+ return result;
168
+ }
169
+
170
+ // API debug tool
171
+ async api_debug(params) {
172
+ const result = await api_debug(params, this.config, saveConfig);
173
+ return result;
174
+ }
175
+
176
+ // API config tool
177
+ async api_config(params) {
178
+ const result = await api_config(params, this.config, saveConfig);
179
+ return result;
180
+ }
181
+
162
182
 
163
183
 
164
184
 
@@ -180,42 +200,42 @@ class ProjectStandardsMCPServer {
180
200
  if (!this.initialized) {
181
201
  this.initialized = true;
182
202
  }
183
-
203
+
184
204
  // Build server capabilities to match client capabilities
185
205
  const serverCapabilities = {
186
206
  tools: {
187
207
  listChanged: false
188
208
  }
189
209
  };
190
-
210
+
191
211
  // If client supports prompts, we also support it
192
212
  if (params?.capabilities?.prompts) {
193
213
  serverCapabilities.prompts = {
194
214
  listChanged: false
195
215
  };
196
216
  }
197
-
217
+
198
218
  // If client supports resources, we also support it
199
219
  if (params?.capabilities?.resources) {
200
220
  serverCapabilities.resources = {
201
221
  listChanged: false
202
222
  };
203
223
  }
204
-
224
+
205
225
  // If client supports logging, we also support it
206
226
  if (params?.capabilities?.logging) {
207
227
  serverCapabilities.logging = {
208
228
  listChanged: false
209
229
  };
210
230
  }
211
-
231
+
212
232
  // If client supports roots, we also support it
213
233
  if (params?.capabilities?.roots) {
214
234
  serverCapabilities.roots = {
215
235
  listChanged: false
216
236
  };
217
237
  }
218
-
238
+
219
239
  result = {
220
240
  protocolVersion: params?.protocolVersion || '2025-06-18',
221
241
  capabilities: serverCapabilities,
@@ -226,7 +246,7 @@ class ProjectStandardsMCPServer {
226
246
  };
227
247
  } else if (method === 'tools/list') {
228
248
  const tools = [];
229
-
249
+
230
250
  // Add all tools since config is always available now
231
251
  tools.push({
232
252
  name: 'project_info',
@@ -266,18 +286,18 @@ class ProjectStandardsMCPServer {
266
286
  ]
267
287
  }
268
288
  });
269
-
270
- tools.push( {
271
- name: 'project_structure',
272
- description: 'Get, set or delete project structure in configuration',
273
- inputSchema: {
274
- type: 'object',
275
- properties: {
276
- action: {
277
- type: 'string',
278
- enum: ['get', 'set', 'delete'],
279
- description: 'Action to perform: "get" to retrieve structure, "set" to update structure, "delete" to delete structure item'
280
- },
289
+
290
+ tools.push({
291
+ name: 'project_structure',
292
+ description: 'Get, set or delete project structure in configuration',
293
+ inputSchema: {
294
+ type: 'object',
295
+ properties: {
296
+ action: {
297
+ type: 'string',
298
+ enum: ['get', 'set', 'delete'],
299
+ description: 'Action to perform: "get" to retrieve structure, "set" to update structure, "delete" to delete structure item'
300
+ },
281
301
  structure: {
282
302
  type: 'array',
283
303
  description: 'Array of structure items with path and description (required for "set" action)',
@@ -325,225 +345,246 @@ class ProjectStandardsMCPServer {
325
345
  ]
326
346
  }
327
347
  });
328
-
329
- tools.push( {
330
- name: 'api_standards',
331
- description: 'Get, set or delete API interface standards and best practices',
332
- inputSchema: {
333
- type: 'object',
334
- properties: {
335
- action: {
336
- type: 'string',
337
- enum: ['get', 'set', 'delete'],
338
- description: 'Action to perform: "get" to retrieve standards, "set" to update standards, "delete" to delete header'
339
- },
340
- key: {
341
- type: 'string',
342
- enum: ['interfaceType', 'successStructure', 'errorStructure', 'basicHeaders', 'requirements'],
343
- description: 'Key to update when action is "set" (interfaceType|successStructure|errorStructure|basicHeaders|requirements)'
344
- },
345
- value: {
346
- oneOf: [
347
- { type: 'string' },
348
- { type: 'array' }
349
- ],
350
- description: 'Value to set when action is "set" (must be string or array)'
351
- },
352
- forceOverwrite: {
353
- type: 'boolean',
354
- description: 'Force overwrite array values when action is "set" and value is array (default: false)'
355
- },
356
- headerName: {
357
- type: 'string',
358
- description: 'Header name to delete when action is "delete"'
359
- },
360
- requirement: {
361
- type: 'string',
362
- description: 'Requirement content to delete when action is "delete"'
363
- }
364
- },
365
- required: ['action'],
366
- anyOf: [
367
- {
368
- properties: {
369
- action: { const: 'get' }
370
- }
371
- },
372
- {
373
- properties: {
374
- action: { const: 'set' },
375
- key: { type: 'string' },
376
- value: {}
377
- },
378
- required: ['key', 'value']
379
- },
380
- {
381
- properties: {
382
- action: { const: 'delete' },
383
- headerName: { type: 'string' }
384
- },
385
- required: ['headerName']
386
- },
387
- {
388
- properties: {
389
- action: { const: 'delete' },
390
- requirement: { type: 'string' }
391
- },
392
- required: ['requirement']
393
- }
394
- ]
348
+
349
+ tools.push({
350
+ name: 'api_standards',
351
+ description: 'Get, set or delete API interface standards and best practices',
352
+ inputSchema: {
353
+ type: 'object',
354
+ properties: {
355
+ action: {
356
+ type: 'string',
357
+ enum: ['get', 'set', 'delete'],
358
+ description: 'Action to perform: "get" to retrieve standards, "set" to update standards, "delete" to delete header'
359
+ },
360
+ key: {
361
+ type: 'string',
362
+ enum: ['interfaceType', 'successStructure', 'errorStructure', 'basicHeaders', 'requirements'],
363
+ description: 'Key to update when action is "set" (interfaceType|successStructure|errorStructure|basicHeaders|requirements)'
364
+ },
365
+ value: {
366
+ oneOf: [
367
+ { type: 'string' },
368
+ { type: 'array' }
369
+ ],
370
+ description: 'Value to set when action is "set" (must be string or array)'
371
+ },
372
+ forceOverwrite: {
373
+ type: 'boolean',
374
+ description: 'Force overwrite array values when action is "set" and value is array (default: false)'
375
+ },
376
+ headerName: {
377
+ type: 'string',
378
+ description: 'Header name to delete when action is "delete"'
379
+ },
380
+ requirement: {
381
+ type: 'string',
382
+ description: 'Requirement content to delete when action is "delete"'
395
383
  }
396
384
  },
397
- {
398
- name: 'development_standards',
399
- description: 'Get, set or delete development standards',
400
- inputSchema: {
401
- type: 'object',
385
+ required: ['action'],
386
+ anyOf: [
387
+ {
402
388
  properties: {
403
- action: {
404
- type: 'string',
405
- enum: ['get', 'set', 'delete'],
406
- description: 'Action to perform: "get" to retrieve standards, "set" to update standards, "delete" to delete standard'
407
- },
408
- standards: {
409
- type: 'array',
410
- description: 'Array of development standards (required for "set" action)',
411
- items: {
412
- type: 'string'
413
- }
414
- },
415
- forceOverwrite: {
416
- type: 'boolean',
417
- description: 'Force overwrite array values when action is "set" and value is array (default: false)'
418
- },
419
- standard: {
420
- type: 'string',
421
- description: 'Standard content to delete when action is "delete"'
389
+ action: { const: 'get' }
390
+ }
391
+ },
392
+ {
393
+ properties: {
394
+ action: { const: 'set' },
395
+ key: { type: 'string' },
396
+ value: {}
397
+ },
398
+ required: ['key', 'value']
399
+ },
400
+ {
401
+ properties: {
402
+ action: { const: 'delete' },
403
+ headerName: { type: 'string' }
404
+ },
405
+ required: ['headerName']
406
+ },
407
+ {
408
+ properties: {
409
+ action: { const: 'delete' },
410
+ requirement: { type: 'string' }
411
+ },
412
+ required: ['requirement']
413
+ }
414
+ ]
415
+ }
416
+ },
417
+ {
418
+ name: 'development_standards',
419
+ description: 'Get, set or delete development standards',
420
+ inputSchema: {
421
+ type: 'object',
422
+ properties: {
423
+ action: {
424
+ type: 'string',
425
+ enum: ['get', 'set', 'delete'],
426
+ description: 'Action to perform: "get" to retrieve standards, "set" to update standards, "delete" to delete standard'
427
+ },
428
+ standards: {
429
+ type: 'array',
430
+ description: 'Array of development standards (required for "set" action)',
431
+ items: {
432
+ type: 'string'
422
433
  }
423
434
  },
424
- required: ['action'],
425
- anyOf: [
426
- {
427
- properties: {
428
- action: { const: 'get' }
429
- }
430
- },
431
- {
432
- properties: {
433
- action: { const: 'set' },
434
- standards: { type: 'array' }
435
- },
436
- required: ['standards']
437
- },
438
- {
439
- properties: {
440
- action: { const: 'delete' },
441
- standard: { type: 'string' }
442
- },
443
- required: ['standard']
435
+ forceOverwrite: {
436
+ type: 'boolean',
437
+ description: 'Force overwrite array values when action is "set" and value is array (default: false)'
438
+ },
439
+ standard: {
440
+ type: 'string',
441
+ description: 'Standard content to delete when action is "delete"'
442
+ }
443
+ },
444
+ required: ['action'],
445
+ anyOf: [
446
+ {
447
+ properties: {
448
+ action: { const: 'get' }
444
449
  }
445
- ]
446
- }
447
- },
448
- {
449
- name: 'database_standards',
450
- description: 'Get, set or delete database standards',
451
- inputSchema: {
452
- type: 'object',
453
- properties: {
454
- action: {
455
- type: 'string',
456
- enum: ['get', 'set', 'delete'],
457
- description: 'Action to perform: "get" to retrieve standards, "set" to update standards, "delete" to delete standard'
458
- },
459
- standards: {
460
- type: 'array',
461
- description: 'Array of database standards (required for "set" action)',
462
- items: {
463
- type: 'string'
464
- }
450
+ },
451
+ {
452
+ properties: {
453
+ action: { const: 'set' },
454
+ standards: { type: 'array' }
465
455
  },
466
- forceOverwrite: {
467
- type: 'boolean',
468
- description: 'Force overwrite array values when action is "set" and value is array (default: false)'
456
+ required: ['standards']
457
+ },
458
+ {
459
+ properties: {
460
+ action: { const: 'delete' },
461
+ standard: { type: 'string' }
469
462
  },
470
- standard: {
471
- type: 'string',
472
- description: 'Standard content to delete when action is "delete"'
463
+ required: ['standard']
464
+ }
465
+ ]
466
+ }
467
+ },
468
+ {
469
+ name: 'database_standards',
470
+ description: 'Get, set or delete database standards',
471
+ inputSchema: {
472
+ type: 'object',
473
+ properties: {
474
+ action: {
475
+ type: 'string',
476
+ enum: ['get', 'set', 'delete'],
477
+ description: 'Action to perform: "get" to retrieve standards, "set" to update standards, "delete" to delete standard'
478
+ },
479
+ standards: {
480
+ type: 'array',
481
+ description: 'Array of database standards (required for "set" action)',
482
+ items: {
483
+ type: 'string'
473
484
  }
474
485
  },
475
- required: ['action'],
476
- anyOf: [
477
- {
478
- properties: {
479
- action: { const: 'get' }
480
- }
486
+ forceOverwrite: {
487
+ type: 'boolean',
488
+ description: 'Force overwrite array values when action is "set" and value is array (default: false)'
489
+ },
490
+ standard: {
491
+ type: 'string',
492
+ description: 'Standard content to delete when action is "delete"'
493
+ }
494
+ },
495
+ required: ['action'],
496
+ anyOf: [
497
+ {
498
+ properties: {
499
+ action: { const: 'get' }
500
+ }
501
+ },
502
+ {
503
+ properties: {
504
+ action: { const: 'set' },
505
+ standards: { type: 'array' }
481
506
  },
482
- {
483
- properties: {
484
- action: { const: 'set' },
485
- standards: { type: 'array' }
486
- },
487
- required: ['standards']
507
+ required: ['standards']
508
+ },
509
+ {
510
+ properties: {
511
+ action: { const: 'delete' },
512
+ standard: { type: 'string' }
488
513
  },
489
- {
490
- properties: {
491
- action: { const: 'delete' },
492
- standard: { type: 'string' }
493
- },
494
- required: ['standard']
495
- }
496
- ]
497
- }
514
+ required: ['standard']
515
+ }
516
+ ]
498
517
  }
499
- );
500
-
501
- // 构建 API 调试工具描述
502
- let apiDebugDescription = 'API debugging tool for testing and executing API requests. Use URL to identify APIs instead of index numbers.';
503
-
504
- // 检查是否设置了登录接口环境变量
505
- const loginUrl = process.env.API_DEBUG_LOGIN_URL;
506
- const loginMethod = process.env.API_DEBUG_LOGIN_METHOD;
507
- const loginDescription = process.env.API_DEBUG_LOGIN_DESCRIPTION;
508
- const allowedMethods = process.env.API_DEBUG_ALLOWED_METHODS;
509
-
510
- if (loginUrl || loginMethod || allowedMethods) {
511
- apiDebugDescription += '\n\n🔐 Login Authentication Configuration:';
512
-
513
- if (loginUrl) {
514
- apiDebugDescription += `\n- Login URL: ${loginUrl}`;
515
518
  }
516
- if (loginMethod) {
517
- apiDebugDescription += `\n- Login Method: ${loginMethod}`;
518
- }
519
- if (loginDescription) {
520
- apiDebugDescription += `\n- Login Description: ${loginDescription}`;
521
- }
522
- if (allowedMethods) {
523
- apiDebugDescription += `\n- Allowed Methods: ${allowedMethods}`;
519
+ );
520
+
521
+
522
+ // API Login Tool
523
+ tools.push({
524
+ name: 'api_login',
525
+ description: 'API login authentication tool that uses environment variables for login credentials',
526
+ inputSchema: {
527
+ type: 'object',
528
+ properties: {
529
+ baseUrl: {
530
+ type: 'string',
531
+ description: 'Base URL for login request (optional, will override config baseUrl)'
532
+ }
533
+ }
524
534
  }
525
-
526
- apiDebugDescription += '\n\n💡 Usage Instructions:';
527
- apiDebugDescription += '\n- Use URL to identify APIs for execute and delete operations (not index numbers)';
528
- apiDebugDescription += '\n- Login API automatically uses environment variable configuration';
529
- apiDebugDescription += '\n- Non-login APIs must use allowed methods only';
530
- apiDebugDescription += '\n- Common request headers are automatically updated after successful login';
531
- }
532
-
535
+ });
536
+
537
+ // API Debug Tool
533
538
  tools.push({
534
539
  name: 'api_debug',
535
- description: apiDebugDescription,
540
+ description: 'API debugging tool for directly executing API requests',
536
541
  inputSchema: {
537
542
  type: 'object',
538
543
  properties: {
539
- action: {
540
- type: 'string',
541
- enum: ['get', 'set', 'delete', 'execute', 'updateBaseUrl', 'updateHeaders', 'deleteHeader', 'search'],
542
- description: 'Action to perform: "get" to retrieve config, "set" to update config, "delete" to delete API by URL, "execute" to execute API by URL, "updateBaseUrl" to update base URL, "updateHeaders" to update headers, "deleteHeader" to delete specific header, "search" to search APIs by URL or description'
543
- },
544
+ url: {
545
+ type: 'string',
546
+ description: 'API URL to execute (required)'
547
+ },
548
+ method: {
549
+ type: 'string',
550
+ enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
551
+ description: 'HTTP method (optional, defaults to GET)'
552
+ },
553
+ headers: {
554
+ type: 'object',
555
+ description: 'Additional headers for the request (optional)'
556
+ },
557
+ query: {
558
+ type: 'object',
559
+ description: 'Query parameters (optional)'
560
+ },
561
+ body: {
562
+ description: 'Request body (optional)'
563
+ },
564
+ contentType: {
565
+ type: 'string',
566
+ description: 'Content-Type for request body (optional, will auto-detect if not specified)'
567
+ }
568
+ },
569
+ required: ['url']
570
+ }
571
+ });
572
+
573
+ // API Config Tool
574
+ tools.push({
575
+ name: 'api_config',
576
+ description: 'API configuration management tool for managing API settings, endpoints, and configurations',
577
+ inputSchema: {
578
+ type: 'object',
579
+ properties: {
580
+ action: {
581
+ type: 'string',
582
+ enum: ['get', 'set', 'updateBaseUrl', 'updateHeaders', 'deleteHeader', 'search', 'list'],
583
+ description: 'Action to perform: "get" to retrieve config, "set" to update config, "updateBaseUrl" to update base URL, "updateHeaders" to update headers, "deleteHeader" to delete header, "search" to search APIs, "list" to list all APIs'
584
+ },
544
585
  config: {
545
586
  type: 'object',
546
- description: 'API debug configuration (required for "set" action)',
587
+ description: 'API configuration (required for "set" action)',
547
588
  properties: {
548
589
  baseUrl: {
549
590
  type: 'string',
@@ -555,7 +596,7 @@ class ProjectStandardsMCPServer {
555
596
  },
556
597
  list: {
557
598
  type: 'array',
558
- description: 'List of API endpoints to test',
599
+ description: 'List of API endpoints',
559
600
  items: {
560
601
  type: 'object',
561
602
  properties: {
@@ -574,45 +615,41 @@ class ProjectStandardsMCPServer {
574
615
  },
575
616
  query: {
576
617
  type: 'object',
577
- description: 'Query parameters for GET requests'
618
+ description: 'Query parameters'
578
619
  },
579
620
  body: {
580
- description: 'Request body for POST/PUT requests'
621
+ description: 'Request body'
581
622
  },
582
623
  contentType: {
583
624
  type: 'string',
584
- description: 'Content-Type for request body (optional, will auto-detect if not specified)'
625
+ description: 'Content-Type for request body'
585
626
  },
586
627
  header: {
587
628
  type: 'object',
588
629
  description: 'Additional headers for this specific request'
589
630
  }
590
631
  },
591
- required: ['url', 'method']
632
+ required: ['url']
592
633
  }
593
634
  }
594
635
  }
595
636
  },
596
- url: {
597
- type: 'string',
598
- description: 'URL of API to delete or execute (required for "delete" and "execute" actions)'
599
- },
600
- baseUrl: {
601
- type: 'string',
602
- description: 'New base URL (required for "updateBaseUrl" action)'
603
- },
604
- headers: {
605
- type: 'object',
606
- description: 'New headers to add or update (required for "updateHeaders" action)'
607
- },
608
- headerName: {
609
- type: 'string',
610
- description: 'Name of header to delete (required for "deleteHeader" action)'
611
- },
612
- keyword: {
613
- type: 'string',
614
- description: 'Search keyword to match against URL or description (required for "search" action)'
615
- }
637
+ baseUrl: {
638
+ type: 'string',
639
+ description: 'New base URL (required for "updateBaseUrl" action)'
640
+ },
641
+ headers: {
642
+ type: 'object',
643
+ description: 'New headers to add or update (required for "updateHeaders" action)'
644
+ },
645
+ headerName: {
646
+ type: 'string',
647
+ description: 'Name of header to delete (required for "deleteHeader" action)'
648
+ },
649
+ keyword: {
650
+ type: 'string',
651
+ description: 'Search keyword (required for "search" action)'
652
+ }
616
653
  },
617
654
  required: ['action'],
618
655
  anyOf: [
@@ -623,24 +660,15 @@ class ProjectStandardsMCPServer {
623
660
  },
624
661
  {
625
662
  properties: {
626
- action: { const: 'set' },
627
- config: { type: 'object' }
628
- },
629
- required: ['config']
630
- },
631
- {
632
- properties: {
633
- action: { const: 'delete' },
634
- url: { type: 'string' }
635
- },
636
- required: ['url']
663
+ action: { const: 'list' }
664
+ }
637
665
  },
638
666
  {
639
667
  properties: {
640
- action: { const: 'execute' },
641
- url: { type: 'string' }
668
+ action: { const: 'set' },
669
+ config: { type: 'object' }
642
670
  },
643
- required: ['url']
671
+ required: ['config']
644
672
  },
645
673
  {
646
674
  properties: {
@@ -673,7 +701,8 @@ class ProjectStandardsMCPServer {
673
701
  ]
674
702
  }
675
703
  });
676
-
704
+
705
+
677
706
  result = {
678
707
  tools: tools,
679
708
  environment: {
@@ -792,7 +821,7 @@ class ProjectStandardsMCPServer {
792
821
  if (method === 'notifications/initialized' || method === 'notifications/exit') {
793
822
  return null;
794
823
  }
795
-
824
+
796
825
  // shutdown method needs to return response
797
826
  if (method === 'shutdown') {
798
827
  return {
@@ -811,12 +840,12 @@ class ProjectStandardsMCPServer {
811
840
  // Use standard MCP error codes
812
841
  let errorCode = -32603; // Internal error
813
842
  let errorMessage = error.message;
814
-
843
+
815
844
  if (error.message.includes('Server not initialized')) {
816
845
  errorCode = -32002; // Server not initialized
817
846
  } else if (error.message.includes('Unknown method')) {
818
847
  errorCode = -32601; // Method not found
819
- } else if (error.message.includes('Unsupported JSON-RPC version')) {
848
+ } else if (error.message.includes('Unsupported JSON-RPC version')) {
820
849
  errorCode = -32600; // Invalid Request
821
850
  }
822
851
  return {