@liangshanli/mcp-server-project-standards 5.0.0 → 5.1.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.
- package/README.md +28 -0
- package/README.zh-CN.md +28 -0
- package/package.json +1 -1
- package/src/server-final.js +28 -1
- package/src/utils/download_file.js +76 -0
package/README.md
CHANGED
|
@@ -4,6 +4,10 @@ A MCP (Model Context Protocol) server for project standards management, designed
|
|
|
4
4
|
|
|
5
5
|
## 📋 Version Updates
|
|
6
6
|
|
|
7
|
+
### v5.1.0 (2025-12-22)
|
|
8
|
+
- **New Tool**: Added `download_file` tool to download files from URL to project path.
|
|
9
|
+
- **Version Sync**: Updated server and package versions to 5.1.0.
|
|
10
|
+
|
|
7
11
|
### v5.0.0 (2025-12-19) - Major Release
|
|
8
12
|
- **Project Path Support**: Added `PROJECT_PATH` environment variable for resolving relative paths.
|
|
9
13
|
- **Cursor Detection**: Automatic identification of Cursor IDE for enhanced features.
|
|
@@ -115,6 +119,7 @@ A MCP (Model Context Protocol) server for project standards management, designed
|
|
|
115
119
|
- ✅ **Configuration Management** - JSON-based configuration storage and management
|
|
116
120
|
- ✅ **Auto-Restart** - Intelligent process management and fault recovery
|
|
117
121
|
- ✅ **Health Checks** - Real-time service status and performance monitoring
|
|
122
|
+
- ✅ **File Downloader** - Download files from URLs directly to the project directory
|
|
118
123
|
|
|
119
124
|
## 🎯 Application Scenarios
|
|
120
125
|
|
|
@@ -605,6 +610,29 @@ Generates AI project guidance files (`.cursorrules` for Cursor, `PROJECT_RULES.m
|
|
|
605
610
|
}
|
|
606
611
|
```
|
|
607
612
|
|
|
613
|
+
### 9. File Download Tool (download_file)
|
|
614
|
+
Download a file from a URL and save it to a specified path within the project.
|
|
615
|
+
|
|
616
|
+
**Parameters:**
|
|
617
|
+
- `url` (required): The URL of the file to download.
|
|
618
|
+
- `savePath` (required): The path where the file should be saved (relative to project path or absolute).
|
|
619
|
+
|
|
620
|
+
**Example:**
|
|
621
|
+
```json
|
|
622
|
+
{
|
|
623
|
+
"jsonrpc": "2.0",
|
|
624
|
+
"id": 12,
|
|
625
|
+
"method": "tools/call",
|
|
626
|
+
"params": {
|
|
627
|
+
"name": "download_file",
|
|
628
|
+
"arguments": {
|
|
629
|
+
"url": "https://example.com/logo.png",
|
|
630
|
+
"savePath": "assets/logo.png"
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
```
|
|
635
|
+
|
|
608
636
|
## 🔗 Related Tools for Collaborative Use
|
|
609
637
|
|
|
610
638
|
To provide a more complete development experience, we recommend using the following MCP tools in collaboration:
|
package/README.zh-CN.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
## 📋 版本更新说明
|
|
6
6
|
|
|
7
|
+
### v5.1.0 (2025-12-22)
|
|
8
|
+
- **新增工具**:新增 `download_file` 工具,支持从 URL 下载文件到项目目录。
|
|
9
|
+
- **版本同步**:服务器和包版本更新至 5.1.0。
|
|
10
|
+
|
|
7
11
|
### v5.0.0 (2025-12-19) - 重大更新
|
|
8
12
|
- **项目路径支持**:新增 `PROJECT_PATH` 环境变量,支持相对于项目根目录解析路径。
|
|
9
13
|
- **Cursor 自动识别**:初始化时自动识别 Cursor 编辑器,开启环境特有的增强模式。
|
|
@@ -99,6 +103,7 @@
|
|
|
99
103
|
- ✅ **配置管理** - 基于 JSON 文件的配置存储和管理
|
|
100
104
|
- ✅ **自动重启** - 智能的进程管理和故障恢复
|
|
101
105
|
- ✅ **健康检查** - 实时监控服务状态和性能
|
|
106
|
+
- ✅ **文件下载** - 支持从 URL 直接下载文件到项目目录
|
|
102
107
|
|
|
103
108
|
## 🎯 应用场景
|
|
104
109
|
|
|
@@ -593,6 +598,29 @@ API 调试工具支持完整的登录认证流程,让您轻松管理 API 访
|
|
|
593
598
|
}
|
|
594
599
|
```
|
|
595
600
|
|
|
601
|
+
### 9. 文件下载工具 (download_file)
|
|
602
|
+
从指定的 URL 下载文件并保存到项目路径中的指定位置。
|
|
603
|
+
|
|
604
|
+
**参数:**
|
|
605
|
+
- `url` (必需): 要下载的文件的 URL。
|
|
606
|
+
- `savePath` (必需): 文件保存路径(相对于项目路径或绝对路径)。
|
|
607
|
+
|
|
608
|
+
**使用示例:**
|
|
609
|
+
```json
|
|
610
|
+
{
|
|
611
|
+
"jsonrpc": "2.0",
|
|
612
|
+
"id": 12,
|
|
613
|
+
"method": "tools/call",
|
|
614
|
+
"params": {
|
|
615
|
+
"name": "download_file",
|
|
616
|
+
"arguments": {
|
|
617
|
+
"url": "https://example.com/logo.png",
|
|
618
|
+
"savePath": "assets/logo.png"
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
```
|
|
623
|
+
|
|
596
624
|
## 🔗 相关工具协同使用
|
|
597
625
|
|
|
598
626
|
为了提供更完整的开发体验,推荐与以下 MCP 工具协同使用:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liangshanli/mcp-server-project-standards",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
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
|
@@ -14,6 +14,7 @@ const api_help = require('./utils/api_help');
|
|
|
14
14
|
const api_execute = require('./utils/api_execute');
|
|
15
15
|
const list_directory = require('./utils/list_directory');
|
|
16
16
|
const generate_cursorrules = require('./utils/generate_cursorrules');
|
|
17
|
+
const download_file = require('./utils/download_file');
|
|
17
18
|
|
|
18
19
|
// Get config directory based on CONFIG_DIR and TOOL_PREFIX
|
|
19
20
|
const getConfigDir = () => {
|
|
@@ -88,7 +89,7 @@ global.isCursor = false;
|
|
|
88
89
|
class ProjectStandardsMCPServer {
|
|
89
90
|
constructor() {
|
|
90
91
|
this.name = 'project-standards-mcp-server';
|
|
91
|
-
this.version = '1.
|
|
92
|
+
this.version = '5.1.0';
|
|
92
93
|
this.initialized = false;
|
|
93
94
|
this.config = getConfig();
|
|
94
95
|
this.needsProjectFolder = this.config === null;
|
|
@@ -231,6 +232,12 @@ class ProjectStandardsMCPServer {
|
|
|
231
232
|
return result;
|
|
232
233
|
}
|
|
233
234
|
|
|
235
|
+
// Download file tool
|
|
236
|
+
async download_file(params) {
|
|
237
|
+
const result = await download_file(params);
|
|
238
|
+
return result;
|
|
239
|
+
}
|
|
240
|
+
|
|
234
241
|
// Handle JSON-RPC requests
|
|
235
242
|
async handleRequest(request) {
|
|
236
243
|
try {
|
|
@@ -740,6 +747,26 @@ class ProjectStandardsMCPServer {
|
|
|
740
747
|
}
|
|
741
748
|
});
|
|
742
749
|
|
|
750
|
+
// Download File Tool
|
|
751
|
+
tools.push({
|
|
752
|
+
name: 'download_file',
|
|
753
|
+
description: 'Download a file from a URL and save it to a specified path. Supported schemes: http, https.',
|
|
754
|
+
inputSchema: {
|
|
755
|
+
type: 'object',
|
|
756
|
+
properties: {
|
|
757
|
+
url: {
|
|
758
|
+
type: 'string',
|
|
759
|
+
description: 'The URL of the file to download (required)'
|
|
760
|
+
},
|
|
761
|
+
savePath: {
|
|
762
|
+
type: 'string',
|
|
763
|
+
description: 'The path where the file should be saved (relative to project path or absolute, required)'
|
|
764
|
+
}
|
|
765
|
+
},
|
|
766
|
+
required: ['url', 'savePath']
|
|
767
|
+
}
|
|
768
|
+
});
|
|
769
|
+
|
|
743
770
|
// API Config Tool
|
|
744
771
|
tools.push({
|
|
745
772
|
name: 'api_config',
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const https = require('https');
|
|
4
|
+
|
|
5
|
+
// Create an agent for HTTPS requests that skips certificate verification
|
|
6
|
+
const httpsAgent = new https.Agent({
|
|
7
|
+
rejectUnauthorized: false
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Download file tool
|
|
12
|
+
*
|
|
13
|
+
* @param {Object} params - Parameters
|
|
14
|
+
* @param {string} params.url - URL of the file to download
|
|
15
|
+
* @param {string} params.savePath - Path to save the file (relative to project path or absolute)
|
|
16
|
+
* @returns {Object} Download result
|
|
17
|
+
*/
|
|
18
|
+
async function download_file(params) {
|
|
19
|
+
const { url, savePath } = params || {};
|
|
20
|
+
|
|
21
|
+
if (!url) {
|
|
22
|
+
throw new Error('URL is required');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!savePath) {
|
|
26
|
+
throw new Error('Save path is required');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Resolve save path
|
|
30
|
+
const projectPath = process.env.PROJECT_PATH || '.';
|
|
31
|
+
let finalSavePath = savePath;
|
|
32
|
+
if (!path.isAbsolute(savePath)) {
|
|
33
|
+
finalSavePath = path.resolve(projectPath, savePath);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
// Ensure directory exists
|
|
38
|
+
await fs.ensureDir(path.dirname(finalSavePath));
|
|
39
|
+
|
|
40
|
+
// Execute download
|
|
41
|
+
const fetchOptions = {};
|
|
42
|
+
if (url.startsWith('https')) {
|
|
43
|
+
fetchOptions.agent = httpsAgent;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const response = await fetch(url, fetchOptions);
|
|
47
|
+
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
throw new Error(`Failed to download: \${response.status} \${response.statusText}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const buffer = await response.arrayBuffer();
|
|
53
|
+
await fs.writeFile(finalSavePath, Buffer.from(buffer));
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
success: true,
|
|
57
|
+
message: `Successfully downloaded file to \${finalSavePath}`,
|
|
58
|
+
url: url,
|
|
59
|
+
savePath: finalSavePath,
|
|
60
|
+
size: buffer.byteLength,
|
|
61
|
+
timestamp: new Date().toISOString()
|
|
62
|
+
};
|
|
63
|
+
} catch (err) {
|
|
64
|
+
return {
|
|
65
|
+
success: false,
|
|
66
|
+
message: `Failed to download file: \${err.message}`,
|
|
67
|
+
url: url,
|
|
68
|
+
savePath: finalSavePath,
|
|
69
|
+
error: err.message,
|
|
70
|
+
timestamp: new Date().toISOString()
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
module.exports = download_file;
|
|
76
|
+
|