@nyx-intelligence/val-mcp 0.6.0 → 0.6.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.
Files changed (2) hide show
  1. package/dist/index.js +29 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -22,7 +22,34 @@ function fmtSnapshot(els) {
22
22
  return els.map((e) => `[${e.ref}] ${e.kind} ${e.text || "—"}${e.attrs ? ` (${e.attrs})` : ""}`).join("\n");
23
23
  }
24
24
  // ───────────────────────── CLI (testing without an MCP client) ─────────────────────────
25
+ /**
26
+ * Verify the caller has an active Val subscription. Called from BOTH the
27
+ * CLI and the MCP server entry points — no path runs Val without a key.
28
+ */
29
+ async function validateLicense() {
30
+ const apiBase = process.env.VAL_API_BASE || "https://val.nyx-intelligence.com";
31
+ const key = process.env.VAL_LICENSE_KEY || "";
32
+ if (!key) {
33
+ console.error("Val: missing VAL_LICENSE_KEY. Subscribe at https://val.nyx-intelligence.com");
34
+ process.exit(1);
35
+ }
36
+ try {
37
+ const res = await fetch(`${apiBase}/api/license/validate`, {
38
+ headers: { Authorization: `Bearer ${key}` },
39
+ });
40
+ const lic = (await res.json());
41
+ if (!lic.valid) {
42
+ console.error("Val: no active subscription for this VAL_LICENSE_KEY. Subscribe at https://val.nyx-intelligence.com");
43
+ process.exit(1);
44
+ }
45
+ }
46
+ catch {
47
+ console.error("Val: could not verify your license (check VAL_LICENSE_KEY and connectivity).");
48
+ process.exit(1);
49
+ }
50
+ }
25
51
  async function runCli(args) {
52
+ await validateLicense();
26
53
  const [cmd, url, arg2, arg3] = args;
27
54
  if (cmd === "scan" && url) {
28
55
  const { findings, pagesVisited } = await scanSite(url, { maxPages: Number(arg2) || 12, device: arg3 || undefined });
@@ -64,27 +91,12 @@ async function runCli(args) {
64
91
  }
65
92
  // ───────────────────────── MCP server ─────────────────────────
66
93
  async function runServer() {
67
- // License gate — no active subscription, no tools.
68
- const apiBase = process.env.VAL_API_BASE || "https://val.nyx-intelligence.com";
69
- try {
70
- const res = await fetch(`${apiBase}/api/license/validate`, {
71
- headers: { Authorization: `Bearer ${process.env.VAL_LICENSE_KEY || ""}` },
72
- });
73
- const lic = (await res.json());
74
- if (!lic.valid) {
75
- console.error("Val: no active subscription for this VAL_LICENSE_KEY. Subscribe at https://val.nyx-intelligence.com");
76
- process.exit(1);
77
- }
78
- }
79
- catch {
80
- console.error("Val: could not verify your license (check VAL_LICENSE_KEY and connectivity).");
81
- process.exit(1);
82
- }
94
+ await validateLicense();
83
95
  const { McpServer } = await import("@modelcontextprotocol/sdk/server/mcp.js");
84
96
  const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
85
97
  const { chromium } = await import("playwright");
86
98
  const { z } = await import("zod");
87
- const server = new McpServer({ name: "val", version: "0.6.0" });
99
+ const server = new McpServer({ name: "val", version: "0.6.1" });
88
100
  const text = (t) => ({ content: [{ type: "text", text: t }] });
89
101
  // ── Passive crawl ──
90
102
  server.registerTool("val_scan_devices", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nyx-intelligence/val-mcp",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Val — a 100% MCP QA agent for vibecoders. Drives a real browser to catch UX bugs (broken links, 404s, console errors, broken images) so your coding agent can fix them.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",