@liangshanli/mcp-server-project-standards 2.1.4 → 2.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.
- package/package.json +1 -1
- package/src/server-final.js +3 -3
- package/src/utils/api_debug.js +26 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liangshanli/mcp-server-project-standards",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
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
|
@@ -957,9 +957,9 @@ class ProjectStandardsMCPServer {
|
|
|
957
957
|
|
|
958
958
|
result = await this[name](args || {});
|
|
959
959
|
|
|
960
|
-
// Check if result has contentType (
|
|
961
|
-
if (result && result.contentType === "
|
|
962
|
-
// Return the result as-is for
|
|
960
|
+
// Check if result has contentType (special format)
|
|
961
|
+
if (result && result.contentType === "text") {
|
|
962
|
+
// Return the result as-is for special text format
|
|
963
963
|
return {
|
|
964
964
|
jsonrpc: '2.0',
|
|
965
965
|
id,
|
package/src/utils/api_debug.js
CHANGED
|
@@ -74,20 +74,35 @@ async function api_debug(params, config, saveConfig) {
|
|
|
74
74
|
} catch (parseError) {
|
|
75
75
|
// 无法解析为JSON,给出建议
|
|
76
76
|
return {
|
|
77
|
-
contentType: "
|
|
77
|
+
contentType: "text",
|
|
78
78
|
content: [
|
|
79
79
|
{
|
|
80
80
|
type: "text",
|
|
81
|
-
text:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
text: "❌ JSON Parse Error Detected\n\nThe request body starts with { but cannot be parsed as a valid JSON object."
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: "text",
|
|
85
|
+
text: "⚠️ IMPORTANT: You MUST use addApi to add the API to the list first!\n\nDirect execution is not possible with invalid JSON. You must follow these steps:"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: "text",
|
|
89
|
+
text: "🔧 Step 1: Add API to Configuration (REQUIRED)\n\nCall: api_config with action=\"addApi\" and api={\"url\":\"${url}\",\"method\":\"${requestMethod}\",\"body\":\"your corrected JSON here\"}\n\nThis will store the API configuration for future use."
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
type: "text",
|
|
93
|
+
text: "🔧 Step 2: Execute API by Index\n\nAfter adding the API, call: api_execute with index=<returned index>\n\nThis will execute the pre-configured API with the correct format."
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
type: "text",
|
|
97
|
+
text: "🚨 REMINDER: You MUST use addApi first!\n\n- Cannot execute API directly with invalid JSON\n- Must add to configuration list using api_config tool\n- Then use api_execute with the returned index"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
type: "text",
|
|
101
|
+
text: "💡 Why This Approach is Required:\n- Invalid JSON cannot be processed directly\n- addApi allows you to fix the JSON format\n- Configuration is saved for reuse\n- Better error handling and debugging"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: "text",
|
|
105
|
+
text: "📋 Final Reminder: Use addApi → Then api_execute\n\n1. First: api_config with action=\"addApi\"\n2. Then: api_execute with index=<number>\n\nThis is the ONLY way to handle invalid JSON requests."
|
|
91
106
|
}
|
|
92
107
|
]
|
|
93
108
|
};
|