vybsafe-mcp 1.0.0 → 1.0.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/package.json +1 -1
- package/server.js +9 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vybsafe-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "VybSafe for AI agents (Cursor, Claude Code, Windsurf, Claude Desktop). Scan the project and get plain-English fixes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": { "vybsafe-mcp": "server.js" },
|
package/server.js
CHANGED
|
@@ -13,8 +13,15 @@ const BASE = (process.env.VYBSAFE_API || 'https://vybsafe.vercel.app').replace(/
|
|
|
13
13
|
|
|
14
14
|
async function call(pathname, init = {}) {
|
|
15
15
|
if (!KEY) throw new Error('VYBSAFE_KEY is not set. Create a key on the VybSafe Tools page and add it to this server\'s settings.');
|
|
16
|
-
|
|
16
|
+
let r;
|
|
17
|
+
try {
|
|
18
|
+
r = await fetch(BASE + pathname, { ...init, headers: { authorization: 'Bearer ' + KEY, 'user-agent': 'vybsafe-mcp', ...(init.headers || {}) }, signal: AbortSignal.timeout(90000) });
|
|
19
|
+
} catch (e) {
|
|
20
|
+
if (e?.name === 'TimeoutError' || e?.name === 'AbortError') throw new Error('VybSafe took too long to answer. Try again in a minute.');
|
|
21
|
+
throw new Error(`Couldn't reach VybSafe at ${BASE}. Check your internet connection, or set VYBSAFE_API if you use a different address.`);
|
|
22
|
+
}
|
|
17
23
|
const j = await r.json().catch(() => ({}));
|
|
24
|
+
if (r.status === 401) throw new Error(j.error || 'VybSafe did not accept your key. Create a new key on the VybSafe Tools page and update VYBSAFE_KEY.');
|
|
18
25
|
if (!r.ok) throw new Error(j.error || 'VybSafe answered ' + r.status);
|
|
19
26
|
return j;
|
|
20
27
|
}
|
|
@@ -39,7 +46,7 @@ function report(res) {
|
|
|
39
46
|
const text = (t) => ({ content: [{ type: 'text', text: t }] });
|
|
40
47
|
const safe = (fn) => async (args) => { try { return text(await fn(args)); } catch (e) { return { ...text('VybSafe error: ' + e.message), isError: true }; } };
|
|
41
48
|
|
|
42
|
-
const server = new McpServer({ name: 'vybsafe', version: '1.0.
|
|
49
|
+
const server = new McpServer({ name: 'vybsafe', version: '1.0.1' });
|
|
43
50
|
|
|
44
51
|
server.registerTool('vybsafe_scan_project', {
|
|
45
52
|
title: 'Scan this project with VybSafe',
|