vmoo-mcp-database-server 1.2.0 → 1.2.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/README.md +214 -178
- package/bin/vmoo-mcp-deliver.js +45 -45
- package/bin/vmoo-mcp-dev.js +45 -45
- package/bin/vmoo-mcp-prod.js +45 -45
- package/bin/vmoo-mcp-server.js +81 -81
- package/index.js +38 -38
- package/package.json +61 -61
- package/shared/database-utils.js +102 -102
- package/shared/privacy-utils.js +207 -207
- package/shared/security-utils.js +219 -219
- package/shared/time-utils.js +62 -62
- package/vmoo-database-deliver/config.json +25 -25
- package/vmoo-database-deliver/package.json +26 -26
- package/vmoo-database-deliver/server.js +297 -297
- package/vmoo-database-dev/config.json +25 -25
- package/vmoo-database-dev/package.json +32 -32
- package/vmoo-database-dev/server.js +294 -294
- package/vmoo-database-prod/config.json +41 -41
- package/vmoo-database-prod/package.json +33 -33
- package/vmoo-database-prod/server.js +313 -313
package/README.md
CHANGED
|
@@ -1,178 +1,214 @@
|
|
|
1
|
-
# vmoo-mcp-database-server
|
|
2
|
-
|
|
3
|
-
VMOO数据库MCP服务器 - 支持开发和生产环境的安全数据库访问
|
|
4
|
-
|
|
5
|
-
[](https://badge.fury.io/js/vmoo-mcp-database-server)
|
|
6
|
-
[](https://opensource.org/licenses/MIT)
|
|
7
|
-
|
|
8
|
-
## 🚀 快速开始
|
|
9
|
-
|
|
10
|
-
### 使用npx直接运行(推荐)
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
# 开发环境
|
|
14
|
-
npx vmoo-mcp-database-server@latest --env=dev
|
|
15
|
-
|
|
16
|
-
# 生产环境
|
|
17
|
-
npx vmoo-mcp-database-server@latest --env=prod
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### 在Augment中配置
|
|
21
|
-
|
|
22
|
-
```json
|
|
23
|
-
{
|
|
24
|
-
"mcpServers": {
|
|
25
|
-
"vmoo-database-dev": {
|
|
26
|
-
"command": "npx",
|
|
27
|
-
"args": ["vmoo-mcp-database-server@latest", "--env=dev"]
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
###
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
###
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
1
|
+
# vmoo-mcp-database-server
|
|
2
|
+
|
|
3
|
+
VMOO数据库MCP服务器 - 支持开发和生产环境的安全数据库访问
|
|
4
|
+
|
|
5
|
+
[](https://badge.fury.io/js/vmoo-mcp-database-server)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## 🚀 快速开始
|
|
9
|
+
|
|
10
|
+
### 使用npx直接运行(推荐)
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# 开发环境
|
|
14
|
+
npx vmoo-mcp-database-server@latest --env=dev
|
|
15
|
+
|
|
16
|
+
# 生产环境
|
|
17
|
+
npx vmoo-mcp-database-server@latest --env=prod
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 在Augment中配置
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"mcpServers": {
|
|
25
|
+
"vmoo-database-dev": {
|
|
26
|
+
"command": "npx",
|
|
27
|
+
"args": ["vmoo-mcp-database-server@latest", "--env=dev"],
|
|
28
|
+
"env": {
|
|
29
|
+
"V_MOO_PASSWORD": "xxxxxxxxxxxxx"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"vmoo-database-prod": {
|
|
33
|
+
"command": "npx",
|
|
34
|
+
"args": ["vmoo-mcp-database-server@latest", "--env=prod"],
|
|
35
|
+
"env": {
|
|
36
|
+
"V_MOO_PASSWORD": "xxxxxxxxxxxxx"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"vmoo-database-deliver": {
|
|
40
|
+
"command": "npx",
|
|
41
|
+
"args": ["vmoo-mcp-database-server@latest", "--env=deliver"],
|
|
42
|
+
"env": {
|
|
43
|
+
"DELIVER_PASSWORD": "xxxxxxxxxxxxx"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 1. 安装依赖
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 2. 测试数据库连接
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm test
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
如果看到 ✅ 连接成功,说明配置正确。
|
|
63
|
+
|
|
64
|
+
### 3. 启动MCP服务器
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm start
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 🔧 在Augment中配置
|
|
71
|
+
|
|
72
|
+
### 找到Augment配置文件
|
|
73
|
+
|
|
74
|
+
- **Windows**: `%APPDATA%\Augment\config.json`
|
|
75
|
+
- **macOS**: `~/Library/Application Support/Augment/config.json`
|
|
76
|
+
- **Linux**: `~/.config/Augment/config.json`
|
|
77
|
+
|
|
78
|
+
### 添加MCP服务器配置
|
|
79
|
+
|
|
80
|
+
在配置文件中添加:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"mcpServers": {
|
|
85
|
+
"vmoo-database-dev": {
|
|
86
|
+
"command": "node",
|
|
87
|
+
"args": ["D:\\代码库\\vmoo-mcp-server\\bin\\vmoo-mcp-dev.js"],
|
|
88
|
+
"env": {
|
|
89
|
+
"V_MOO_PASSWORD": "xxxxxxxxxxxxx"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"vmoo-database-prod": {
|
|
93
|
+
"command": "node",
|
|
94
|
+
"args": ["D:\\代码库\\vmoo-mcp-server\\bin\\vmoo-mcp-prod.js"],
|
|
95
|
+
"env": {
|
|
96
|
+
"V_MOO_PASSWORD": "xxxxxxxxxxxxx"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"vmoo-database-deliver": {
|
|
100
|
+
"command": "node",
|
|
101
|
+
"args": ["D:\\代码库\\vmoo-mcp-server\\bin\\vmoo-mcp-deliver.js"],
|
|
102
|
+
"env": {
|
|
103
|
+
"DELIVER_PASSWORD": "xxxxxxxxxxxxx"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**注意**: 请将路径替换为你的实际路径。
|
|
111
|
+
|
|
112
|
+
### 重启Augment
|
|
113
|
+
|
|
114
|
+
保存配置文件后,重启Augment应用。
|
|
115
|
+
|
|
116
|
+
## 🛠️ 可用工具
|
|
117
|
+
|
|
118
|
+
配置成功后,你可以在Augment中直接询问:
|
|
119
|
+
|
|
120
|
+
### 1. 查询数据库
|
|
121
|
+
- "列出所有fanwe_开头的表"
|
|
122
|
+
- "查询最近注册的10个用户"
|
|
123
|
+
- "显示fanwe_menu表中价格最高的商品"
|
|
124
|
+
|
|
125
|
+
### 2. 查看表结构
|
|
126
|
+
- "fanwe_user表的结构是什么?"
|
|
127
|
+
- "描述fanwe_order表的字段"
|
|
128
|
+
|
|
129
|
+
### 3. 获取示例数据
|
|
130
|
+
- "显示fanwe_menu表的前5条记录"
|
|
131
|
+
- "fanwe_user表的示例数据"
|
|
132
|
+
|
|
133
|
+
### 4. 统计信息
|
|
134
|
+
- "fanwe_user表有多少条记录?"
|
|
135
|
+
- "数据库中有多少个表?"
|
|
136
|
+
|
|
137
|
+
## 📊 数据库信息
|
|
138
|
+
|
|
139
|
+
### 开发环境 (dev) 和生产环境 (prod)
|
|
140
|
+
- **主机**: 118.25.190.11:3306
|
|
141
|
+
- **数据库**: ceshi_v_moo_com
|
|
142
|
+
- **用户**: ceshi_v_moo_com
|
|
143
|
+
- **字符集**: utf8mb4
|
|
144
|
+
|
|
145
|
+
### 配送测试站 (deliver)
|
|
146
|
+
- **主机**: 118.25.190.11:3306
|
|
147
|
+
- **数据库**: ceshi_deliver
|
|
148
|
+
- **用户**: ceshi_deliver
|
|
149
|
+
- **字符集**: utf8mb4
|
|
150
|
+
|
|
151
|
+
## 🔒 安全特性
|
|
152
|
+
|
|
153
|
+
### 允许的操作
|
|
154
|
+
- **查询操作**: SELECT、SHOW、DESCRIBE、EXPLAIN
|
|
155
|
+
- **数据修改**: INSERT、UPDATE(仅限新增和修改)
|
|
156
|
+
- **表结构**: CREATE TABLE、ALTER TABLE
|
|
157
|
+
|
|
158
|
+
### 安全防护
|
|
159
|
+
- **禁止所有删除操作**: 完全阻止DELETE、DROP TABLE、DROP DATABASE等删除操作
|
|
160
|
+
- **测试环境专用**: 专为测试环境设计,确保数据安全
|
|
161
|
+
- **查询限制**: 自动添加LIMIT防止大量数据返回
|
|
162
|
+
- **SQL注入防护**: 使用参数化查询
|
|
163
|
+
- **连接池管理**: 自动管理数据库连接
|
|
164
|
+
- **错误处理**: 完善的错误捕获和提示
|
|
165
|
+
|
|
166
|
+
## 📝 使用示例
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
用户: "VMOO数据库中有哪些用户相关的表?"
|
|
170
|
+
AI: 调用list_tables工具,返回包含user的表列表
|
|
171
|
+
|
|
172
|
+
用户: "fanwe_user表的字段都有什么含义?"
|
|
173
|
+
AI: 调用describe_table工具,返回表结构详情
|
|
174
|
+
|
|
175
|
+
用户: "最近一周注册的用户有多少?"
|
|
176
|
+
AI: 调用query_database工具,执行相应SQL查询
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## 🛠️ 开发调试
|
|
180
|
+
|
|
181
|
+
### 启用调试模式
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
npm run dev
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
这将启用Node.js调试器,可以在Chrome DevTools中调试。
|
|
188
|
+
|
|
189
|
+
### 查看日志
|
|
190
|
+
|
|
191
|
+
MCP服务器的日志会输出到stderr,可以通过以下方式查看:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
node mcp-vmoo-database-server.js 2> debug.log
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## 🔧 故障排除
|
|
198
|
+
|
|
199
|
+
### 连接问题
|
|
200
|
+
- 检查网络连接
|
|
201
|
+
- 确认数据库服务器可访问
|
|
202
|
+
- 验证防火墙设置
|
|
203
|
+
|
|
204
|
+
### 权限问题
|
|
205
|
+
- 确保数据库用户有查询权限
|
|
206
|
+
- 检查表访问权限
|
|
207
|
+
|
|
208
|
+
### 配置问题
|
|
209
|
+
- 验证Augment配置文件路径正确
|
|
210
|
+
- 确保Node.js版本 >= 18.0.0
|
|
211
|
+
|
|
212
|
+
## 📄 许可证
|
|
213
|
+
|
|
214
|
+
MIT License
|
package/bin/vmoo-mcp-deliver.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// VMOO配送测试站MCP服务器启动器
|
|
4
|
-
|
|
5
|
-
import { spawn } from 'child_process';
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
7
|
-
import path from 'path';
|
|
8
|
-
|
|
9
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
const __dirname = path.dirname(__filename);
|
|
11
|
-
|
|
12
|
-
// 解析命令行参数
|
|
13
|
-
const args = process.argv.slice(2);
|
|
14
|
-
const configPath = args.find(arg => arg.startsWith('--config='))?.split('=')[1];
|
|
15
|
-
|
|
16
|
-
console.log('🚚 启动VMOO配送测试站MCP服务器...');
|
|
17
|
-
|
|
18
|
-
// 服务器文件路径
|
|
19
|
-
const serverPath = path.join(__dirname, '../vmoo-database-deliver/server.js');
|
|
20
|
-
|
|
21
|
-
// 启动服务器
|
|
22
|
-
const serverProcess = spawn('node', [serverPath], {
|
|
23
|
-
stdio: 'inherit',
|
|
24
|
-
env: {
|
|
25
|
-
...process.env,
|
|
26
|
-
...(configPath && { CONFIG_PATH: configPath })
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// 处理进程退出
|
|
31
|
-
serverProcess.on('close', (code) => {
|
|
32
|
-
console.log(`🚚 配送测试站MCP服务器已退出,退出码: ${code}`);
|
|
33
|
-
process.exit(code);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// 处理中断信号
|
|
37
|
-
process.on('SIGINT', () => {
|
|
38
|
-
console.log('\n🛑 正在关闭配送测试站MCP服务器...');
|
|
39
|
-
serverProcess.kill('SIGINT');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
process.on('SIGTERM', () => {
|
|
43
|
-
console.log('\n🛑 正在关闭配送测试站MCP服务器...');
|
|
44
|
-
serverProcess.kill('SIGTERM');
|
|
45
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// VMOO配送测试站MCP服务器启动器
|
|
4
|
+
|
|
5
|
+
import { spawn } from 'child_process';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = path.dirname(__filename);
|
|
11
|
+
|
|
12
|
+
// 解析命令行参数
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
const configPath = args.find(arg => arg.startsWith('--config='))?.split('=')[1];
|
|
15
|
+
|
|
16
|
+
console.log('🚚 启动VMOO配送测试站MCP服务器...');
|
|
17
|
+
|
|
18
|
+
// 服务器文件路径
|
|
19
|
+
const serverPath = path.join(__dirname, '../vmoo-database-deliver/server.js');
|
|
20
|
+
|
|
21
|
+
// 启动服务器
|
|
22
|
+
const serverProcess = spawn('node', [serverPath], {
|
|
23
|
+
stdio: 'inherit',
|
|
24
|
+
env: {
|
|
25
|
+
...process.env,
|
|
26
|
+
...(configPath && { CONFIG_PATH: configPath })
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// 处理进程退出
|
|
31
|
+
serverProcess.on('close', (code) => {
|
|
32
|
+
console.log(`🚚 配送测试站MCP服务器已退出,退出码: ${code}`);
|
|
33
|
+
process.exit(code);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// 处理中断信号
|
|
37
|
+
process.on('SIGINT', () => {
|
|
38
|
+
console.log('\n🛑 正在关闭配送测试站MCP服务器...');
|
|
39
|
+
serverProcess.kill('SIGINT');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
process.on('SIGTERM', () => {
|
|
43
|
+
console.log('\n🛑 正在关闭配送测试站MCP服务器...');
|
|
44
|
+
serverProcess.kill('SIGTERM');
|
|
45
|
+
});
|
package/bin/vmoo-mcp-dev.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// VMOO开发环境MCP服务器启动器
|
|
4
|
-
|
|
5
|
-
import { spawn } from 'child_process';
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
7
|
-
import path from 'path';
|
|
8
|
-
|
|
9
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
const __dirname = path.dirname(__filename);
|
|
11
|
-
|
|
12
|
-
// 解析命令行参数
|
|
13
|
-
const args = process.argv.slice(2);
|
|
14
|
-
const configPath = args.find(arg => arg.startsWith('--config='))?.split('=')[1];
|
|
15
|
-
|
|
16
|
-
console.log('🟡 启动VMOO开发环境MCP服务器...');
|
|
17
|
-
|
|
18
|
-
// 服务器文件路径
|
|
19
|
-
const serverPath = path.join(__dirname, '../vmoo-database-dev/server.js');
|
|
20
|
-
|
|
21
|
-
// 启动服务器
|
|
22
|
-
const serverProcess = spawn('node', [serverPath], {
|
|
23
|
-
stdio: 'inherit',
|
|
24
|
-
env: {
|
|
25
|
-
...process.env,
|
|
26
|
-
...(configPath && { CONFIG_PATH: configPath })
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// 处理进程退出
|
|
31
|
-
serverProcess.on('close', (code) => {
|
|
32
|
-
console.log(`🟡 开发环境MCP服务器已退出,退出码: ${code}`);
|
|
33
|
-
process.exit(code);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// 处理中断信号
|
|
37
|
-
process.on('SIGINT', () => {
|
|
38
|
-
console.log('\n🛑 正在关闭开发环境MCP服务器...');
|
|
39
|
-
serverProcess.kill('SIGINT');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
process.on('SIGTERM', () => {
|
|
43
|
-
console.log('\n🛑 正在关闭开发环境MCP服务器...');
|
|
44
|
-
serverProcess.kill('SIGTERM');
|
|
45
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// VMOO开发环境MCP服务器启动器
|
|
4
|
+
|
|
5
|
+
import { spawn } from 'child_process';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = path.dirname(__filename);
|
|
11
|
+
|
|
12
|
+
// 解析命令行参数
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
const configPath = args.find(arg => arg.startsWith('--config='))?.split('=')[1];
|
|
15
|
+
|
|
16
|
+
console.log('🟡 启动VMOO开发环境MCP服务器...');
|
|
17
|
+
|
|
18
|
+
// 服务器文件路径
|
|
19
|
+
const serverPath = path.join(__dirname, '../vmoo-database-dev/server.js');
|
|
20
|
+
|
|
21
|
+
// 启动服务器
|
|
22
|
+
const serverProcess = spawn('node', [serverPath], {
|
|
23
|
+
stdio: 'inherit',
|
|
24
|
+
env: {
|
|
25
|
+
...process.env,
|
|
26
|
+
...(configPath && { CONFIG_PATH: configPath })
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// 处理进程退出
|
|
31
|
+
serverProcess.on('close', (code) => {
|
|
32
|
+
console.log(`🟡 开发环境MCP服务器已退出,退出码: ${code}`);
|
|
33
|
+
process.exit(code);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// 处理中断信号
|
|
37
|
+
process.on('SIGINT', () => {
|
|
38
|
+
console.log('\n🛑 正在关闭开发环境MCP服务器...');
|
|
39
|
+
serverProcess.kill('SIGINT');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
process.on('SIGTERM', () => {
|
|
43
|
+
console.log('\n🛑 正在关闭开发环境MCP服务器...');
|
|
44
|
+
serverProcess.kill('SIGTERM');
|
|
45
|
+
});
|
package/bin/vmoo-mcp-prod.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// VMOO生产环境MCP服务器启动器
|
|
4
|
-
|
|
5
|
-
import { spawn } from 'child_process';
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
7
|
-
import path from 'path';
|
|
8
|
-
|
|
9
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
const __dirname = path.dirname(__filename);
|
|
11
|
-
|
|
12
|
-
// 解析命令行参数
|
|
13
|
-
const args = process.argv.slice(2);
|
|
14
|
-
const configPath = args.find(arg => arg.startsWith('--config='))?.split('=')[1];
|
|
15
|
-
|
|
16
|
-
console.log('🔴 启动VMOO生产环境MCP服务器...');
|
|
17
|
-
|
|
18
|
-
// 服务器文件路径
|
|
19
|
-
const serverPath = path.join(__dirname, '../vmoo-database-prod/server.js');
|
|
20
|
-
|
|
21
|
-
// 启动服务器
|
|
22
|
-
const serverProcess = spawn('node', [serverPath], {
|
|
23
|
-
stdio: 'inherit',
|
|
24
|
-
env: {
|
|
25
|
-
...process.env,
|
|
26
|
-
...(configPath && { CONFIG_PATH: configPath })
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// 处理进程退出
|
|
31
|
-
serverProcess.on('close', (code) => {
|
|
32
|
-
console.log(`🔴 生产环境MCP服务器已退出,退出码: ${code}`);
|
|
33
|
-
process.exit(code);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// 处理中断信号
|
|
37
|
-
process.on('SIGINT', () => {
|
|
38
|
-
console.log('\n🛑 正在关闭生产环境MCP服务器...');
|
|
39
|
-
serverProcess.kill('SIGINT');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
process.on('SIGTERM', () => {
|
|
43
|
-
console.log('\n🛑 正在关闭生产环境MCP服务器...');
|
|
44
|
-
serverProcess.kill('SIGTERM');
|
|
45
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// VMOO生产环境MCP服务器启动器
|
|
4
|
+
|
|
5
|
+
import { spawn } from 'child_process';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = path.dirname(__filename);
|
|
11
|
+
|
|
12
|
+
// 解析命令行参数
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
const configPath = args.find(arg => arg.startsWith('--config='))?.split('=')[1];
|
|
15
|
+
|
|
16
|
+
console.log('🔴 启动VMOO生产环境MCP服务器...');
|
|
17
|
+
|
|
18
|
+
// 服务器文件路径
|
|
19
|
+
const serverPath = path.join(__dirname, '../vmoo-database-prod/server.js');
|
|
20
|
+
|
|
21
|
+
// 启动服务器
|
|
22
|
+
const serverProcess = spawn('node', [serverPath], {
|
|
23
|
+
stdio: 'inherit',
|
|
24
|
+
env: {
|
|
25
|
+
...process.env,
|
|
26
|
+
...(configPath && { CONFIG_PATH: configPath })
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// 处理进程退出
|
|
31
|
+
serverProcess.on('close', (code) => {
|
|
32
|
+
console.log(`🔴 生产环境MCP服务器已退出,退出码: ${code}`);
|
|
33
|
+
process.exit(code);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// 处理中断信号
|
|
37
|
+
process.on('SIGINT', () => {
|
|
38
|
+
console.log('\n🛑 正在关闭生产环境MCP服务器...');
|
|
39
|
+
serverProcess.kill('SIGINT');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
process.on('SIGTERM', () => {
|
|
43
|
+
console.log('\n🛑 正在关闭生产环境MCP服务器...');
|
|
44
|
+
serverProcess.kill('SIGTERM');
|
|
45
|
+
});
|