@recapt/mcp 0.0.32 → 0.0.35
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 +20 -1
- package/package.json +2 -4
package/dist/index.js
CHANGED
|
@@ -309,11 +309,30 @@ async function getEmbedder() {
|
|
|
309
309
|
}
|
|
310
310
|
return loadingPromise;
|
|
311
311
|
}
|
|
312
|
-
async function
|
|
312
|
+
async function embedTextLocally(text) {
|
|
313
313
|
const model = await getEmbedder();
|
|
314
314
|
const output = await model(text, { pooling: "mean", normalize: true });
|
|
315
315
|
return Array.from(output.data);
|
|
316
316
|
}
|
|
317
|
+
async function embedTextViaApi(text) {
|
|
318
|
+
if (!isApiConfigured()) {
|
|
319
|
+
throw new Error("API not configured for remote embedding");
|
|
320
|
+
}
|
|
321
|
+
const { data, error } = await apiPost("/embed", {
|
|
322
|
+
text
|
|
323
|
+
});
|
|
324
|
+
if (error || !data?.embedding) {
|
|
325
|
+
throw new Error(error || "No embedding returned from API");
|
|
326
|
+
}
|
|
327
|
+
return data.embedding;
|
|
328
|
+
}
|
|
329
|
+
async function embedText(text) {
|
|
330
|
+
try {
|
|
331
|
+
return await embedTextLocally(text);
|
|
332
|
+
} catch {
|
|
333
|
+
return await embedTextViaApi(text);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
317
336
|
function cosineSimilarity(a, b) {
|
|
318
337
|
if (a.length === 0 || b.length === 0 || a.length !== b.length)
|
|
319
338
|
return 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@recapt/mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
4
4
|
"description": "MCP exposing recapt behavioral intelligence to AI coding agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,9 +36,7 @@
|
|
|
36
36
|
"dotenv": "^17.2.2",
|
|
37
37
|
"zod": "^3.24.0"
|
|
38
38
|
},
|
|
39
|
-
"optionalDependencies": {
|
|
40
|
-
"@xenova/transformers": "^2.17.0"
|
|
41
|
-
},
|
|
39
|
+
"optionalDependencies": {},
|
|
42
40
|
"peerDependencies": {
|
|
43
41
|
"@types/node": "^24.3.1",
|
|
44
42
|
"prettier": "^3.8.1",
|