@liangshanli/mcp-server-project-standards 2.0.0 → 2.0.1
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 +1 -1
- package/src/server-final.js +157 -8
- package/src/utils/api_debug.js +16 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liangshanli/mcp-server-project-standards",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "MCP Project Standards server with project info, structure, API standards, development standards, API debugging, login authentication and configuration management tools",
|
|
5
5
|
"main": "bin/cli.js",
|
|
6
6
|
"bin": {
|
package/src/server-final.js
CHANGED
|
@@ -1,3 +1,98 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
1
96
|
const fs = require('fs-extra');
|
|
2
97
|
const path = require('path');
|
|
3
98
|
|
|
@@ -537,36 +632,90 @@ class ProjectStandardsMCPServer {
|
|
|
537
632
|
// API Debug Tool
|
|
538
633
|
tools.push({
|
|
539
634
|
name: 'api_debug',
|
|
540
|
-
description: 'API debugging tool for directly executing API requests',
|
|
635
|
+
description: 'API debugging tool for directly executing API requests with automatic content-type detection and flexible body format support',
|
|
541
636
|
inputSchema: {
|
|
542
637
|
type: 'object',
|
|
543
638
|
properties: {
|
|
544
639
|
url: {
|
|
545
640
|
type: 'string',
|
|
546
|
-
description: 'API URL to execute (required)'
|
|
641
|
+
description: 'API URL to execute (required)',
|
|
642
|
+
examples: ['/api/users', 'https://api.example.com/users', '/api/login']
|
|
547
643
|
},
|
|
548
644
|
method: {
|
|
549
645
|
type: 'string',
|
|
550
646
|
enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
|
|
551
|
-
description: 'HTTP method (optional, defaults to GET)'
|
|
647
|
+
description: 'HTTP method (optional, defaults to GET)',
|
|
648
|
+
examples: ['GET', 'POST', 'PUT']
|
|
552
649
|
},
|
|
553
650
|
headers: {
|
|
554
651
|
type: 'object',
|
|
555
|
-
description: 'Additional headers for the request (optional)'
|
|
652
|
+
description: 'Additional headers for the request (optional)',
|
|
653
|
+
examples: [
|
|
654
|
+
{'Authorization': 'Bearer token123'},
|
|
655
|
+
{'Content-Type': 'application/json'},
|
|
656
|
+
{'X-API-Key': 'your-api-key'}
|
|
657
|
+
]
|
|
556
658
|
},
|
|
557
659
|
query: {
|
|
558
660
|
type: 'object',
|
|
559
|
-
description: 'Query parameters (optional)'
|
|
661
|
+
description: 'Query parameters (optional)',
|
|
662
|
+
examples: [
|
|
663
|
+
{'page': 1, 'limit': 10},
|
|
664
|
+
{'search': 'keyword', 'sort': 'name'},
|
|
665
|
+
{'id': 123, 'status': 'active'}
|
|
666
|
+
]
|
|
560
667
|
},
|
|
561
668
|
body: {
|
|
562
|
-
description: 'Request body (optional)'
|
|
669
|
+
description: 'Request body (optional) - Supports multiple formats: JSON object, form data, or plain text',
|
|
670
|
+
examples: [
|
|
671
|
+
'JSON Object: {"username": "admin", "password": "123456"}',
|
|
672
|
+
'Form Data: "username=admin&password=123456"',
|
|
673
|
+
'Plain Text: "Hello World"',
|
|
674
|
+
'XML: "<user><name>John</name><email>john@example.com</email></user>"'
|
|
675
|
+
]
|
|
563
676
|
},
|
|
564
677
|
contentType: {
|
|
565
678
|
type: 'string',
|
|
566
|
-
description: 'Content-Type for request body (optional, will auto-detect if not specified)'
|
|
679
|
+
description: 'Content-Type for request body (optional, will auto-detect if not specified)',
|
|
680
|
+
examples: [
|
|
681
|
+
'application/json',
|
|
682
|
+
'application/x-www-form-urlencoded',
|
|
683
|
+
'text/plain',
|
|
684
|
+
'application/xml',
|
|
685
|
+
'text/html'
|
|
686
|
+
]
|
|
567
687
|
}
|
|
568
688
|
},
|
|
569
|
-
required: ['url']
|
|
689
|
+
required: ['url'],
|
|
690
|
+
examples: [
|
|
691
|
+
{
|
|
692
|
+
description: 'Simple GET request',
|
|
693
|
+
url: '/api/users',
|
|
694
|
+
method: 'GET',
|
|
695
|
+
query: {'page': 1, 'limit': 10}
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
description: 'POST request with JSON body',
|
|
699
|
+
url: '/api/login',
|
|
700
|
+
method: 'POST',
|
|
701
|
+
body: {'username': 'admin', 'password': '123456'},
|
|
702
|
+
headers: {'Content-Type': 'application/json'}
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
description: 'PUT request with form data',
|
|
706
|
+
url: '/api/users/123',
|
|
707
|
+
method: 'PUT',
|
|
708
|
+
body: 'name=John&email=john@example.com',
|
|
709
|
+
contentType: 'application/x-www-form-urlencoded'
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
description: 'POST request with XML body',
|
|
713
|
+
url: '/api/data',
|
|
714
|
+
method: 'POST',
|
|
715
|
+
body: '<data><item>value</item></data>',
|
|
716
|
+
contentType: 'application/xml'
|
|
717
|
+
}
|
|
718
|
+
]
|
|
570
719
|
}
|
|
571
720
|
});
|
|
572
721
|
|
package/src/utils/api_debug.js
CHANGED
|
@@ -2,12 +2,27 @@ const { getAllowedMethods, loadApiConfig, saveApiConfig, detectContentType } = r
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* API 调试工具 - 直接执行API请求
|
|
5
|
+
*
|
|
6
|
+
* 支持的请求体格式:
|
|
7
|
+
* 1. JSON对象: {"username": "admin", "password": "123456"}
|
|
8
|
+
* 2. 表单数据: "username=admin&password=123456"
|
|
9
|
+
* 3. 纯文本: "Hello World"
|
|
10
|
+
* 4. XML: "<user><name>John</name><email>john@example.com</email></user>"
|
|
11
|
+
* 5. HTML: "<html><body>Content</body></html>"
|
|
12
|
+
*
|
|
13
|
+
* 自动内容类型检测:
|
|
14
|
+
* - JSON对象 → application/json
|
|
15
|
+
* - 表单数据 → application/x-www-form-urlencoded
|
|
16
|
+
* - XML → application/xml
|
|
17
|
+
* - HTML → text/html
|
|
18
|
+
* - 纯文本 → text/plain
|
|
19
|
+
*
|
|
5
20
|
* @param {Object} params - 参数
|
|
6
21
|
* @param {string} params.url - 要执行的接口URL(必需)
|
|
7
22
|
* @param {string} params.method - HTTP方法(可选,默认GET)
|
|
8
23
|
* @param {Object} params.headers - 额外请求头(可选)
|
|
9
24
|
* @param {Object} params.query - 查询参数(可选)
|
|
10
|
-
* @param {*} params.body -
|
|
25
|
+
* @param {*} params.body - 请求体(可选,支持多种格式)
|
|
11
26
|
* @param {string} params.contentType - 内容类型(可选,会自动检测)
|
|
12
27
|
* @param {Object} config - 服务器配置
|
|
13
28
|
* @param {Function} saveConfig - 保存配置函数
|