cbrowser 18.37.1 → 18.38.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"security-tools.d.ts","sourceRoot":"","sources":["../../../src/mcp-tools/base/security-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAM7C;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA0B7D"}
1
+ {"version":3,"file":"security-tools.d.ts","sourceRoot":"","sources":["../../../src/mcp-tools/base/security-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAM7C;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAsH7D"}
@@ -10,11 +10,15 @@ import { securityAuditHandler, } from "mcp-guardian";
10
10
  * Register security tools (1 tool: security_audit)
11
11
  */
12
12
  export function registerSecurityTools(server) {
13
- server.tool("security_audit", "Audit MCP tool definitions for potential prompt injection attacks. Scans tool descriptions for cross-tool instructions, privilege escalation attempts, and data exfiltration patterns. Returns detailed report of any security issues found.", {
13
+ server.tool("security_audit", "Audit MCP tool definitions for potential prompt injection attacks. Scans tool descriptions for cross-tool instructions, privilege escalation attempts, and data exfiltration patterns. Works with: local config file (Claude Desktop), remote MCP URL (Claude.ai connectors), or self-scan of current server.", {
14
14
  config_path: z
15
15
  .string()
16
16
  .optional()
17
- .describe("Path to claude_desktop_config.json. If not provided, scans the current CBrowser server's tools."),
17
+ .describe("Path to claude_desktop_config.json (Claude Desktop). If omitted, use mcp_url or self-scan."),
18
+ mcp_url: z
19
+ .string()
20
+ .optional()
21
+ .describe("URL of a remote MCP server to scan (e.g., 'https://demo.cbrowser.ai/mcp'). Fetches tool manifest directly — works from Claude.ai without a config file."),
18
22
  format: z
19
23
  .enum(["json", "text"])
20
24
  .optional()
@@ -26,7 +30,86 @@ export function registerSecurityTools(server) {
26
30
  .default(false)
27
31
  .describe("If true, connects to MCP servers to scan their tools (slower but more accurate)."),
28
32
  }, async (params) => {
29
- return await securityAuditHandler(params);
33
+ const { mcp_url, ...baseParams } = params;
34
+ // v18.35.0: Support scanning remote MCP servers by URL
35
+ // Fetches the tool manifest via MCP initialize + tools/list, then passes
36
+ // the tool definitions directly to mcp-guardian for scanning
37
+ if (mcp_url) {
38
+ try {
39
+ // Connect to remote MCP server and fetch tool list
40
+ const initResponse = await fetch(mcp_url, {
41
+ method: "POST",
42
+ headers: { "Content-Type": "application/json" },
43
+ body: JSON.stringify({
44
+ jsonrpc: "2.0",
45
+ id: 1,
46
+ method: "initialize",
47
+ params: {
48
+ protocolVersion: "2024-11-05",
49
+ capabilities: {},
50
+ clientInfo: { name: "cbrowser-security-audit", version: "1.0" },
51
+ },
52
+ }),
53
+ });
54
+ // Parse SSE response
55
+ const initText = await initResponse.text();
56
+ const initData = initText.split("\n").find(l => l.startsWith("data: "));
57
+ if (!initData)
58
+ throw new Error("No response from MCP server");
59
+ // Fetch tool list
60
+ const toolsResponse = await fetch(mcp_url, {
61
+ method: "POST",
62
+ headers: { "Content-Type": "application/json" },
63
+ body: JSON.stringify({
64
+ jsonrpc: "2.0",
65
+ id: 2,
66
+ method: "tools/list",
67
+ params: {},
68
+ }),
69
+ });
70
+ const toolsText = await toolsResponse.text();
71
+ const toolsData = toolsText.split("\n").find(l => l.startsWith("data: "));
72
+ if (!toolsData)
73
+ throw new Error("No tools/list response from MCP server");
74
+ const parsed = JSON.parse(toolsData.replace("data: ", ""));
75
+ const tools = parsed.result?.tools || [];
76
+ if (tools.length === 0) {
77
+ return {
78
+ content: [{
79
+ type: "text",
80
+ text: JSON.stringify({ error: "No tools found at " + mcp_url, suggestion: "Verify the URL is a valid MCP endpoint" }, null, 2),
81
+ }],
82
+ };
83
+ }
84
+ // Map to mcp-guardian's ToolDefinition format
85
+ const toolDefs = tools.map((t) => ({
86
+ name: t.name,
87
+ description: t.description || "",
88
+ inputSchema: t.inputSchema || {},
89
+ }));
90
+ // Pass tools directly to handler
91
+ const options = {
92
+ format: baseParams.format,
93
+ tools: toolDefs,
94
+ serverName: new URL(mcp_url).hostname,
95
+ };
96
+ return await securityAuditHandler(options);
97
+ }
98
+ catch (err) {
99
+ return {
100
+ content: [{
101
+ type: "text",
102
+ text: JSON.stringify({
103
+ error: `Failed to scan remote MCP server: ${err instanceof Error ? err.message : String(err)}`,
104
+ mcp_url,
105
+ suggestion: "Verify the URL is reachable and returns valid MCP responses. Example: https://demo.cbrowser.ai/mcp",
106
+ }, null, 2),
107
+ }],
108
+ };
109
+ }
110
+ }
111
+ // Original behavior: config_path or self-scan
112
+ return await securityAuditHandler(baseParams);
30
113
  });
31
114
  }
32
115
  //# sourceMappingURL=security-tools.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"security-tools.js","sourceRoot":"","sources":["../../../src/mcp-tools/base/security-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,oBAAoB,GAErB,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAiB;IACrD,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,8OAA8O,EAC9O;QACE,WAAW,EAAE,CAAC;aACX,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,iGAAiG,CAClG;QACH,MAAM,EAAE,CAAC;aACN,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;aACtB,QAAQ,EAAE;aACV,OAAO,CAAC,MAAM,CAAC;aACf,QAAQ,CAAC,2DAA2D,CAAC;QACxE,UAAU,EAAE,CAAC;aACV,OAAO,EAAE;aACT,QAAQ,EAAE;aACV,OAAO,CAAC,KAAK,CAAC;aACd,QAAQ,CAAC,kFAAkF,CAAC;KAChG,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,OAAO,MAAM,oBAAoB,CAAC,MAA6B,CAAC,CAAC;IACnE,CAAC,CACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"security-tools.js","sourceRoot":"","sources":["../../../src/mcp-tools/base/security-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,oBAAoB,GAErB,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAiB;IACrD,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,+SAA+S,EAC/S;QACE,WAAW,EAAE,CAAC;aACX,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,4FAA4F,CAC7F;QACH,OAAO,EAAE,CAAC;aACP,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,yJAAyJ,CAC1J;QACH,MAAM,EAAE,CAAC;aACN,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;aACtB,QAAQ,EAAE;aACV,OAAO,CAAC,MAAM,CAAC;aACf,QAAQ,CAAC,2DAA2D,CAAC;QACxE,UAAU,EAAE,CAAC;aACV,OAAO,EAAE;aACT,QAAQ,EAAE;aACV,OAAO,CAAC,KAAK,CAAC;aACd,QAAQ,CAAC,kFAAkF,CAAC;KAChG,EACD,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAC;QAE1C,uDAAuD;QACvD,yEAAyE;QACzE,6DAA6D;QAC7D,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC;gBACH,mDAAmD;gBACnD,MAAM,YAAY,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE;oBACxC,MAAM,EAAE,MAAM;oBACd,OAAO,EAA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AG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;gCAC9F,OAAO;gCACP,UAAU,EAAE,oGAAoG;6BACjH,EAAE,IAAI,EAAE,CAAC,CAAC;yBACZ,CAAC;iBACH,CAAC;YACJ,CAAC;QACH,CAAC;QAED,8CAA8C;QAC9C,OAAO,MAAM,oBAAoB,CAAC,UAAyC,CAAC,CAAC;IAC/E,CAAC,CACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cbrowser",
3
- "version": "18.37.1",
3
+ "version": "18.38.0",
4
4
  "type": "module",
5
5
  "description": "Cognitive browser automation that thinks like your users—and helps AI agents navigate too. Simulate real user cognition with abandonment detection, constitutional safety, chaos engineering, and UX friction discovery. Sites that pass CBrowser's cognitive tests are easier for both humans and AI agents to navigate.",
6
6
  "main": "dist/index.js",