@principlebreach/scopedown-mcp 1.0.0 → 1.0.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/README.md CHANGED
@@ -6,8 +6,8 @@ Your session never leaves the browser. The agent talks to this server, the serve
6
6
 
7
7
  ## Set up
8
8
 
9
- 1. Install the ScopeDown extension and sign in to HackerOne or Bugcrowd in that browser.
10
- 2. Register the bridge with your browsers:
9
+ 1. Install the [ScopeDown extension](https://github.com/PrincipleBreach/scopedown#install) and sign in to HackerOne or Bugcrowd in that browser.
10
+ 2. Register the bridge with your browsers. Each browser must have been opened at least once.
11
11
 
12
12
  ```sh
13
13
  npx @principlebreach/scopedown-mcp install
@@ -22,7 +22,7 @@ Your session never leaves the browser. The agent talks to this server, the serve
22
22
 
23
23
  Any other MCP client: run `npx -y @principlebreach/scopedown-mcp` as a stdio server.
24
24
 
25
- `scopedown-mcp doctor` shows which browsers are registered and connected. `scopedown-mcp uninstall` removes everything it installed.
25
+ `npx @principlebreach/scopedown-mcp doctor` shows which browsers are registered and connected, `uninstall` removes everything it installed, and `--version` prints the version.
26
26
 
27
27
  ## Tools
28
28
 
@@ -54,11 +54,11 @@ Every operation is listed in the extension's activity log.
54
54
 
55
55
  ## Requirements
56
56
 
57
- Node 20 or later. Tested with Chrome and Brave on macOS. Edge, Arc, Chromium, Vivaldi and Firefox registration, and Linux and Windows installs, are implemented but not yet tested.
57
+ Node 22 or later. Tested with Chrome and Brave on macOS. Edge, Arc, Chromium, Vivaldi and Firefox registration, and Linux and Windows installs, are implemented but not yet tested.
58
58
 
59
59
  ## License
60
60
 
61
- MIT. See [LICENSE](LICENSE).
61
+ MIT. See [LICENSE](LICENSE). Source, issues and the security policy: [github.com/PrincipleBreach/scopedown](https://github.com/PrincipleBreach/scopedown).
62
62
 
63
63
  ---
64
64
 
@@ -2,14 +2,17 @@
2
2
  // scopedown-mcp: the MCP server (default), the native messaging host the browser starts,
3
3
  // and the commands that install and check both.
4
4
 
5
+ import { VERSION } from '../src/version.js';
6
+
5
7
  const [command = 'serve', ...rest] = process.argv.slice(2);
6
8
 
7
- const usage = `scopedown-mcp, the ScopeDown agent bridge by Principle Breach
9
+ const usage = `scopedown-mcp ${VERSION}, the ScopeDown agent bridge by Principle Breach
8
10
 
9
11
  scopedown-mcp Run the MCP server on stdio (what your agent harness starts)
10
12
  scopedown-mcp install Register the bridge with your installed browsers
11
13
  scopedown-mcp uninstall Remove it again
12
14
  scopedown-mcp doctor Show what is installed and which browsers are connected
15
+ scopedown-mcp --version Print the version
13
16
 
14
17
  Install options:
15
18
  --browser <name> Only this browser (chrome, brave, edge, arc, chromium, vivaldi, firefox)
@@ -43,12 +46,12 @@ switch (command) {
43
46
  const extensionIds = option('--extension-id') ? [option('--extension-id')] : [];
44
47
  const out = install({ only, extensionIds });
45
48
  if (!out.installed.length) {
46
- console.log('No supported browser profile was found. Install Chrome, Brave, Edge, Arc, Chromium, Vivaldi or Firefox first.');
49
+ console.log('No browser profile was found. Open Chrome, Brave, Edge, Arc, Chromium, Vivaldi or Firefox once, then run install again.');
47
50
  process.exitCode = 1;
48
51
  break;
49
52
  }
50
53
  for (const i of out.installed) console.log(`Registered with ${i.browser}: ${i.manifest}`);
51
- console.log(`\nNext:\n 1. In the browser, click the ScopeDown icon and turn on Agent access.\n 2. Add the server to your harness, for example:\n claude mcp add scopedown -- npx -y @principlebreach/scopedown-mcp`);
54
+ console.log(`\nNext:\n 1. In the browser, click the ScopeDown icon and switch Agents on.\n 2. Add the server to your harness, for example:\n claude mcp add scopedown -- npx -y @principlebreach/scopedown-mcp`);
52
55
  break;
53
56
  }
54
57
  case 'uninstall': {
@@ -68,6 +71,11 @@ switch (command) {
68
71
  case '-h':
69
72
  console.log(usage);
70
73
  break;
74
+ case 'version':
75
+ case '--version':
76
+ case '-v':
77
+ console.log(VERSION);
78
+ break;
71
79
  default:
72
80
  // Firefox starts native hosts with the manifest path as the first argument.
73
81
  if (/\.json$/i.test(command) || command.startsWith('chrome-extension://')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principlebreach/scopedown-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "MCP server that gives AI agents your HackerOne and Bugcrowd access through the ScopeDown browser extension.",
5
5
  "keywords": [
6
6
  "mcp",
@@ -33,7 +33,7 @@
33
33
  "LICENSE"
34
34
  ],
35
35
  "engines": {
36
- "node": ">=20"
36
+ "node": ">=22"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
package/src/client.js CHANGED
@@ -108,9 +108,11 @@ export class Bridge {
108
108
  async pick(browser) {
109
109
  const all = await this.browsers();
110
110
  if (!all.length) {
111
- throw new BridgeError('no_browser', 'No browser is connected. Open the browser where you use HackerOne or Bugcrowd, click the ScopeDown icon, and turn on Agent access.');
111
+ throw new BridgeError('no_browser', 'No browser is connected. Open the browser where you use HackerOne or Bugcrowd, click the ScopeDown icon, and switch Agents on.');
112
112
  }
113
- if (!browser) return all[0];
113
+ // Socket names follow the host's process id, which changes when a browser restarts. The
114
+ // install id does not, so the default browser (and the drafts it holds) stays the same.
115
+ if (!browser) return all.reduce((a, b) => (String(b.extension.install) < String(a.extension.install) ? b : a));
114
116
  const want = browser.toLowerCase();
115
117
  const match = all.find((l) => [l.extension.install, l.extension.browser].some((v) => String(v || '').toLowerCase() === want));
116
118
  if (!match) throw new BridgeError('unknown_browser', `No connected browser called "${browser}". Connected: ${all.map(label).join(', ')}.`);
package/src/framing.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { StringDecoder } from 'node:string_decoder';
2
+
1
3
  // Wire formats.
2
4
  // Native messaging (browser <-> host): each message is a 32-bit length in native byte order
3
5
  // (little-endian on every platform browsers ship on) followed by UTF-8 JSON.
@@ -36,11 +38,13 @@ export function encodeLine(message) {
36
38
  return `${JSON.stringify(message)}\n`;
37
39
  }
38
40
 
39
- // Feeds chunks in, calls onMessage for every complete JSON line.
41
+ // Feeds chunks in, calls onMessage for every complete JSON line. A read can end inside a
42
+ // multi-byte character, so the decoder carries those bytes over to the next chunk.
40
43
  export function lineDecoder(onMessage, onError = () => {}) {
44
+ const utf8 = new StringDecoder('utf8');
41
45
  let pending = '';
42
46
  return (chunk) => {
43
- pending += chunk.toString('utf8');
47
+ pending += typeof chunk === 'string' ? chunk : utf8.write(chunk);
44
48
  let newline;
45
49
  while ((newline = pending.indexOf('\n')) >= 0) {
46
50
  const line = pending.slice(0, newline).trim();
package/src/host.js CHANGED
@@ -10,6 +10,14 @@ import { join } from 'node:path';
10
10
  import { encodeNative, nativeDecoder, encodeLine, lineDecoder } from './framing.js';
11
11
  import { scopedownHome, socketsDir, socketPath, logFile } from './paths.js';
12
12
 
13
+ // The sockets folder holds the Unix sockets, and on every OS the marker files that tell the
14
+ // MCP server where each host listens (on Windows the markers are the only way to find a pipe).
15
+ export function prepareDirs(os = platform()) {
16
+ mkdirSync(scopedownHome(), { recursive: true, mode: 0o700 });
17
+ mkdirSync(socketsDir(), { recursive: true, mode: 0o700 });
18
+ if (os !== 'win32') chmodSync(socketsDir(), 0o700);
19
+ }
20
+
13
21
  export function runHost({ stdin = process.stdin, stdout = process.stdout } = {}) {
14
22
  const log = (msg) => {
15
23
  try {
@@ -17,11 +25,7 @@ export function runHost({ stdin = process.stdin, stdout = process.stdout } = {})
17
25
  } catch { /* logging is best effort */ }
18
26
  };
19
27
 
20
- mkdirSync(scopedownHome(), { recursive: true, mode: 0o700 });
21
- if (platform() !== 'win32') {
22
- mkdirSync(socketsDir(), { recursive: true, mode: 0o700 });
23
- chmodSync(socketsDir(), 0o700);
24
- }
28
+ prepareDirs();
25
29
 
26
30
  const name = `host-${process.pid}`;
27
31
  const path = socketPath(name);
package/src/install.js CHANGED
@@ -7,6 +7,7 @@ import { join, dirname } from 'node:path';
7
7
  import { execFileSync } from 'node:child_process';
8
8
  import { fileURLToPath } from 'node:url';
9
9
  import { HOST_NAME, CHROMIUM_EXTENSION_IDS, FIREFOX_EXTENSION_IDS, binDir, scopedownHome, socketsDir } from './paths.js';
10
+ import { VERSION } from './version.js';
10
11
 
11
12
  const PACKAGE = join(dirname(fileURLToPath(import.meta.url)), '..');
12
13
 
@@ -16,7 +17,7 @@ function copyApp() {
16
17
  const app = join(scopedownHome(), 'app');
17
18
  rmSync(app, { recursive: true, force: true });
18
19
  for (const dir of ['bin', 'src']) cpSync(join(PACKAGE, dir), join(app, dir), { recursive: true });
19
- writeFileSync(join(app, 'package.json'), '{ "type": "module" }\n');
20
+ writeFileSync(join(app, 'package.json'), `${JSON.stringify({ type: 'module', version: VERSION })}\n`);
20
21
  return join(app, 'bin', 'scopedown-mcp.js');
21
22
  }
22
23
 
@@ -34,7 +35,8 @@ function nodePath() {
34
35
  }
35
36
 
36
37
  // Per-user NativeMessagingHosts folders. Only browsers whose profile folder exists get a manifest.
37
- function targets(home = homedir()) {
38
+ function targets(given) {
39
+ const home = given || homedir();
38
40
  const os = platform();
39
41
  if (os === 'darwin') {
40
42
  const lib = join(home, 'Library', 'Application Support');
@@ -50,7 +52,8 @@ function targets(home = homedir()) {
50
52
  ].map(([name, root, kind]) => ({ name, root, kind, dir: join(root, kind === 'firefox' ? 'NativeMessagingHosts' : 'NativeMessagingHosts') }));
51
53
  }
52
54
  if (os === 'linux') {
53
- const cfg = process.env.XDG_CONFIG_HOME || join(home, '.config');
55
+ // XDG_CONFIG_HOME belongs to the real home, so a home passed in (tests) keeps its own .config.
56
+ const cfg = (!given && process.env.XDG_CONFIG_HOME) || join(home, '.config');
54
57
  return [
55
58
  ['Chrome', join(cfg, 'google-chrome'), 'chromium'],
56
59
  ['Chromium', join(cfg, 'chromium'), 'chromium'],
package/src/server.js CHANGED
@@ -6,8 +6,9 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
6
6
  import { z } from 'zod';
7
7
  import { Bridge, BridgeError } from './client.js';
8
8
  import { readEvidence, FileRefused } from './files.js';
9
+ import { VERSION } from './version.js';
9
10
 
10
- export const VERSION = '1.0.0';
11
+ export { VERSION };
11
12
 
12
13
  const INSTRUCTIONS = `ScopeDown connects you to the HackerOne and Bugcrowd programs the user can access, through the user's own logged-in browser.
13
14
 
@@ -92,7 +93,7 @@ export function createServer(bridge = new Bridge()) {
92
93
 
93
94
  readTool('list_programs', {
94
95
  title: 'List programs',
95
- description: 'Lists programs the user can submit reports to. private_only shows private invitations; query searches by name or handle. Each platform returns its own next_cursor; to page, pass platform with that cursor.',
96
+ description: 'Lists programs the user can submit reports to. private_only shows private invitations; query searches by name or handle. Each platform returns its own next_cursor; to page, pass platform with that cursor until it is null. A page can hold fewer than limit programs and still have a next_cursor.',
96
97
  inputSchema: {
97
98
  platform: platform.optional().describe('Limit to one platform. Default: both.'),
98
99
  private_only: z.boolean().optional().describe('Only private programs the user was invited to.'),
@@ -141,7 +142,7 @@ export function createServer(bridge = new Bridge()) {
141
142
 
142
143
  readTool('get_my_report', {
143
144
  title: 'Get one of my reports',
144
- description: 'Returns one of the user\'s reports with its state, severity and the comment thread, so you can see what triage asked for. Long threads page with thread_cursor. Supported where status shows report_threads (HackerOne).',
145
+ description: 'Returns one of the user\'s reports with its state, severity and the comment thread, so you can see what triage asked for. Long threads page with thread_cursor. A disclosed report by someone else can be read too: check yours, which is true only for the user\'s own reports. A limited disclosure has no description; its summaries hold what was published. Supported where status shows report_threads (HackerOne).',
145
146
  inputSchema: {
146
147
  platform,
147
148
  id: z.string().regex(/^[\w-]{1,40}$/).describe('Report id, as in hackerone.com/reports/<id>.'),
package/src/version.js ADDED
@@ -0,0 +1,5 @@
1
+ // The package version, read from package.json so the CLI, the MCP handshake and npm agree.
2
+
3
+ import { readFileSync } from 'node:fs';
4
+
5
+ export const VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;