@liangshanli/mcp-server-project-standards 1.2.0 → 1.2.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liangshanli/mcp-server-project-standards",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "MCP Project Standards server with project info, structure, API standards, development standards and custom tools",
5
5
  "main": "bin/cli.js",
6
6
  "bin": {
@@ -54,7 +54,7 @@ console.error('==============================================');
54
54
  class ProjectStandardsMCPServer {
55
55
  constructor() {
56
56
  this.name = 'project-standards-mcp-server';
57
- this.version = '1.2.0';
57
+ this.version = '1.2.2';
58
58
  this.initialized = false;
59
59
  this.config = getConfig();
60
60
  this.needsProjectFolder = this.config === null;
@@ -499,7 +499,7 @@ class ProjectStandardsMCPServer {
499
499
  );
500
500
 
501
501
  // 构建 API 调试工具描述
502
- let apiDebugDescription = 'API debugging tool for testing and executing API requests. Use URL to identify APIs instead of index numbers.';
502
+ let apiDebugDescription = 'API debugging tool for testing and executing API requests. You can directly execute any API URL without needing to add it to the configuration first. Use URL to identify APIs instead of index numbers.';
503
503
 
504
504
  // 检查是否设置了登录接口环境变量
505
505
  const loginUrl = process.env.API_DEBUG_LOGIN_URL;
@@ -524,6 +524,7 @@ class ProjectStandardsMCPServer {
524
524
  }
525
525
 
526
526
  apiDebugDescription += '\n\n💡 Usage Instructions:';
527
+ apiDebugDescription += '\n- You can directly execute any API URL without adding it to configuration first';
527
528
  apiDebugDescription += '\n- Use URL to identify APIs for execute and delete operations (not index numbers)';
528
529
  apiDebugDescription += '\n- Login API automatically uses environment variable configuration';
529
530
  apiDebugDescription += '\n- Non-login APIs must use allowed methods only';
@@ -248,17 +248,23 @@ async function api_debug(params, config, saveConfig) {
248
248
  const apiDebugConfig = loadApiConfig();
249
249
 
250
250
  if (!apiDebugConfig.list || !Array.isArray(apiDebugConfig.list)) {
251
- throw new Error('API list not found or invalid');
251
+ apiDebugConfig.list = [];
252
252
  }
253
253
 
254
- // 查找指定URL的接口
255
- const apiItem = apiDebugConfig.list.find(item => item.url === url);
254
+ // 查找指定URL的接口,如果不存在则创建一个新的
255
+ let apiItem = apiDebugConfig.list.find(item => item.url === url);
256
+ let itemIndex = apiDebugConfig.list.findIndex(item => item.url === url);
257
+
256
258
  if (!apiItem) {
257
- throw new Error(`API with URL "${url}" not found`);
259
+ // 如果接口不存在,创建一个新的接口配置
260
+ apiItem = {
261
+ url: url,
262
+ method: 'GET',
263
+ description: `API: ${url}`
264
+ };
265
+ apiDebugConfig.list.push(apiItem);
266
+ itemIndex = apiDebugConfig.list.length - 1;
258
267
  }
259
-
260
- // 获取接口在列表中的索引(用于更新数据)
261
- const itemIndex = apiDebugConfig.list.findIndex(item => item.url === url);
262
268
  const baseUrl = apiDebugConfig.baseUrl || '';
263
269
  const commonHeaders = apiDebugConfig.headers || {};
264
270
 
@@ -299,8 +305,13 @@ async function api_debug(params, config, saveConfig) {
299
305
  }
300
306
  }
301
307
 
302
- // 构建完整 URL
303
- const fullUrl = baseUrl + apiItem.url;
308
+ // 构建完整 URL - 如果用户提供的是完整URL,直接使用;否则拼接baseUrl
309
+ let fullUrl;
310
+ if (apiItem.url.startsWith('http://') || apiItem.url.startsWith('https://')) {
311
+ fullUrl = apiItem.url;
312
+ } else {
313
+ fullUrl = baseUrl + apiItem.url;
314
+ }
304
315
 
305
316
  // 合并请求头
306
317
  const headers = {