daguands-mcp 1.0.0 → 1.0.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/dist/index.js +25 -4
- package/dist/tools/taobao.js +0 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -101,14 +101,26 @@ class ExtensionManager {
|
|
|
101
101
|
* 主函数
|
|
102
102
|
*/
|
|
103
103
|
async function main() {
|
|
104
|
-
log('🚀
|
|
105
|
-
// 创建 WebSocket
|
|
106
|
-
|
|
104
|
+
log('🚀 达官AI MCP 本地服务器启动中...');
|
|
105
|
+
// 创建 WebSocket 服务器,处理端口占用
|
|
106
|
+
let wss;
|
|
107
|
+
try {
|
|
108
|
+
wss = new WebSocketServer({ port: WS_PORT });
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
if (error.code === 'EADDRINUSE') {
|
|
112
|
+
log(`⚠️ 端口 ${WS_PORT} 已被占用,可能已有实例在运行`);
|
|
113
|
+
log(`优雅退出,让现有实例继续服务...`);
|
|
114
|
+
// 优雅退出,返回成功状态码
|
|
115
|
+
process.exit(0);
|
|
116
|
+
}
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
107
119
|
const extensionManager = new ExtensionManager(wss);
|
|
108
120
|
// 创建 MCP Server
|
|
109
121
|
const server = new Server({
|
|
110
122
|
name: 'daguan-ai-standalone',
|
|
111
|
-
version: '
|
|
123
|
+
version: '1.0.1',
|
|
112
124
|
}, {
|
|
113
125
|
capabilities: {
|
|
114
126
|
tools: {},
|
|
@@ -151,6 +163,15 @@ async function main() {
|
|
|
151
163
|
log(` - OpenClaw: 通过 STDIO`);
|
|
152
164
|
log(` - Chrome 扩展: ws://127.0.0.1:${WS_PORT}`);
|
|
153
165
|
}
|
|
166
|
+
// 信号处理 - 优雅关闭
|
|
167
|
+
process.on('SIGINT', () => {
|
|
168
|
+
log('收到 SIGINT 信号,正在关闭...');
|
|
169
|
+
process.exit(0);
|
|
170
|
+
});
|
|
171
|
+
process.on('SIGTERM', () => {
|
|
172
|
+
log('收到 SIGTERM 信号,正在关闭...');
|
|
173
|
+
process.exit(0);
|
|
174
|
+
});
|
|
154
175
|
// 错误处理
|
|
155
176
|
process.on('uncaughtException', (error) => {
|
|
156
177
|
log('❌ 未捕获的异常:', error);
|
package/dist/tools/taobao.js
CHANGED
|
@@ -42,19 +42,4 @@ export const TAOBAO_TOOLS = [
|
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
|
-
{
|
|
46
|
-
name: 'fetch_taobao_shop_info',
|
|
47
|
-
description: '获取淘宝店铺信息(店铺名称、评分、关注数)',
|
|
48
|
-
platform: 'taobao',
|
|
49
|
-
inputSchema: {
|
|
50
|
-
type: 'object',
|
|
51
|
-
properties: {
|
|
52
|
-
shopUrl: {
|
|
53
|
-
type: 'string',
|
|
54
|
-
description: '店铺页面URL',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
required: ['shopUrl'],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
45
|
];
|