@uni-helper/mcp 0.0.2-beta.1 → 0.0.2-beta.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.d.mts
CHANGED
|
@@ -74,6 +74,7 @@ interface UniMcpOptions {
|
|
|
74
74
|
}
|
|
75
75
|
//#endregion
|
|
76
76
|
//#region src/index.d.ts
|
|
77
|
-
declare function
|
|
77
|
+
declare function isBuild(): boolean;
|
|
78
|
+
declare function uniMcp(options?: UniMcpOptions): Plugin | undefined;
|
|
78
79
|
//#endregion
|
|
79
|
-
export { uniMcp as default };
|
|
80
|
+
export { uniMcp as default, isBuild };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import minimist from "minimist";
|
|
1
3
|
import { searchForWorkspaceRoot } from "vite";
|
|
2
4
|
import { serve } from "@hono/node-server";
|
|
3
5
|
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
6
|
+
import fkill from "fkill";
|
|
4
7
|
import { Hono } from "hono";
|
|
5
8
|
import { cors } from "hono/cors";
|
|
6
9
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -178,11 +181,16 @@ function connectServer(server, options) {
|
|
|
178
181
|
exposeHeaders: ["mcp-session-id", "mcp-protocol-version"]
|
|
179
182
|
}));
|
|
180
183
|
app.all("/mcp", (c) => transport.handleRequest(c.req.raw));
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
fkill(port, {
|
|
185
|
+
force: true,
|
|
186
|
+
silent: true
|
|
187
|
+
}).then(() => {
|
|
188
|
+
server.connect(transport).then(() => {
|
|
189
|
+
if (printUrl) console.log(`${ansis_default.cyan` ➜ MCP: `}${ansis_default.gray(`server is running at ${ansis_default.green(`http://localhost:${port}/mcp`)}`)}`);
|
|
190
|
+
serve({
|
|
191
|
+
fetch: app.fetch,
|
|
192
|
+
port
|
|
193
|
+
});
|
|
186
194
|
});
|
|
187
195
|
});
|
|
188
196
|
return `http://localhost:${port}/mcp`;
|
|
@@ -193,7 +201,8 @@ function connectServer(server, options) {
|
|
|
193
201
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
194
202
|
async function loadVectorStore(vectorName, _embeddings) {
|
|
195
203
|
const vectorDirMap = { uniapp: join(__dirname, "../", "vectorStore", "uniapp") };
|
|
196
|
-
env.
|
|
204
|
+
env.version = "master";
|
|
205
|
+
env.remoteHost = "https://www.modelscope.cn/models";
|
|
197
206
|
const embeddings = _embeddings ?? new HuggingFaceTransformersEmbeddings({
|
|
198
207
|
model: "onnx-community/Qwen3-Embedding-0.6B-ONNX",
|
|
199
208
|
pretrainedOptions: {
|
|
@@ -206,7 +215,7 @@ async function loadVectorStore(vectorName, _embeddings) {
|
|
|
206
215
|
|
|
207
216
|
//#endregion
|
|
208
217
|
//#region package.json
|
|
209
|
-
var version = "0.0.2-beta.
|
|
218
|
+
var version = "0.0.2-beta.2";
|
|
210
219
|
|
|
211
220
|
//#endregion
|
|
212
221
|
//#region src/mcpServer/projectAnalyzer.ts
|
|
@@ -396,7 +405,11 @@ async function updateConfigs(root, sseUrl, options) {
|
|
|
396
405
|
|
|
397
406
|
//#endregion
|
|
398
407
|
//#region src/index.ts
|
|
408
|
+
function isBuild() {
|
|
409
|
+
return minimist(process.argv.slice(2))._.includes("build");
|
|
410
|
+
}
|
|
399
411
|
function uniMcp(options = {}) {
|
|
412
|
+
if (isBuild()) return;
|
|
400
413
|
return {
|
|
401
414
|
name: "uni-mcp",
|
|
402
415
|
enforce: "post",
|
|
@@ -408,4 +421,4 @@ function uniMcp(options = {}) {
|
|
|
408
421
|
}
|
|
409
422
|
|
|
410
423
|
//#endregion
|
|
411
|
-
export { uniMcp as default };
|
|
424
|
+
export { uniMcp as default, isBuild };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uni-helper/mcp",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.2-beta.
|
|
4
|
+
"version": "0.0.2-beta.2",
|
|
5
5
|
"description": "mcp - uniapp也得有ai开发体验",
|
|
6
6
|
"author": "FliPPeDround <flippedround@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -44,11 +44,13 @@
|
|
|
44
44
|
"@langchain/community": "^1.1.4",
|
|
45
45
|
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
46
46
|
"consola": "^3.2.3",
|
|
47
|
+
"fkill": "^10.0.3",
|
|
47
48
|
"fs-extra": "^11.3.3",
|
|
48
49
|
"hnswlib-node": "^3.0.0",
|
|
49
50
|
"hono": "^4.11.4",
|
|
50
51
|
"langchain": "^1.2.8",
|
|
51
52
|
"local-pkg": "^1.1.2",
|
|
53
|
+
"minimist": "^1.2.8",
|
|
52
54
|
"open": "^11.0.0",
|
|
53
55
|
"pathe": "^2.0.3",
|
|
54
56
|
"zod": "^4.3.5"
|
|
@@ -62,6 +64,7 @@
|
|
|
62
64
|
"@modelcontextprotocol/inspector": "^0.18.0",
|
|
63
65
|
"@types/debug": "^4.1.12",
|
|
64
66
|
"@types/fs-extra": "^11.0.4",
|
|
67
|
+
"@types/minimist": "^1.2.5",
|
|
65
68
|
"@types/node": "^25.0.8",
|
|
66
69
|
"@types/turndown": "^5.0.6",
|
|
67
70
|
"ansis": "^4.2.0",
|
|
@@ -96,6 +99,6 @@
|
|
|
96
99
|
"inspect": "mcp-inspector",
|
|
97
100
|
"release": "bumpp",
|
|
98
101
|
"test": "vitest",
|
|
99
|
-
"postinstall": "node scripts/download-model.
|
|
102
|
+
"postinstall": "node scripts/download-model.mjs"
|
|
100
103
|
}
|
|
101
104
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import process from 'node:process'
|
|
2
|
+
import { env } from '@huggingface/transformers'
|
|
3
|
+
import { HuggingFaceTransformersEmbeddings } from '@langchain/community/embeddings/huggingface_transformers'
|
|
4
4
|
|
|
5
5
|
async function downloadModel() {
|
|
6
|
-
env.
|
|
7
|
-
|
|
6
|
+
env.version = 'master'
|
|
7
|
+
env.remoteHost = 'https://www.modelscope.cn/models'
|
|
8
|
+
await new Promise(resolve => setTimeout(resolve, 1000))
|
|
8
9
|
const embeddings = new HuggingFaceTransformersEmbeddings({
|
|
9
10
|
model: 'onnx-community/Qwen3-Embedding-0.6B-ONNX',
|
|
10
11
|
pretrainedOptions: {
|