bopbop 0.2.0 → 0.2.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/npm/server.js +14 -2
  2. package/package.json +1 -1
@@ -3,7 +3,7 @@
3
3
  // Modes (BBM_MODE): extension (default, relay, BBM_RELAY_PORT), connect (BBM_CDP_URL).
4
4
  // launch (a fresh, headless Chromium: BBM_HEADLESS, BBM_CHROME, BBM_CHROME_ARGS) is internal, for tests and the
5
5
  // benchmark only, and is not in the user docs.
6
- import { realpathSync } from 'node:fs';
6
+ import { readFileSync, realpathSync } from 'node:fs';
7
7
  import { pathToFileURL } from 'node:url';
8
8
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
9
9
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
@@ -74,9 +74,21 @@ export async function createBrowser() {
74
74
  }
75
75
  return launchChromium({ headless: process.env.BBM_HEADLESS !== '0' });
76
76
  }
77
+ // package.json is one folder up from src/ (a checkout) and two up from dist/npm/ (the npm package).
78
+ function packageVersion() {
79
+ for (const path of ['../package.json', '../../package.json']) {
80
+ try {
81
+ const pkg = JSON.parse(readFileSync(new URL(path, import.meta.url), 'utf8'));
82
+ if (pkg.name === 'bopbop')
83
+ return pkg.version;
84
+ }
85
+ catch { }
86
+ }
87
+ return '0.0.0';
88
+ }
77
89
  const isLinkClosed = (e) => /CDP connection closed/.test(e?.message || '');
78
90
  export function buildServer(getController) {
79
- const server = new McpServer({ name: 'better-browser-mcp', version: '0.1.0' }, { instructions: INSTRUCTIONS });
91
+ const server = new McpServer({ name: 'better-browser-mcp', version: packageVersion() }, { instructions: INSTRUCTIONS });
80
92
  const text = (s) => ({ content: [{ type: 'text', text: s }] });
81
93
  const fail = (m) => ({ content: [{ type: 'text', text: `error: ${m}` }], isError: true });
82
94
  // A notice (e.g. "the browser connection dropped and is back") goes in front of the next result, once.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bopbop",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Give any AI agent your real Chrome: small text snapshots, its own tab group, few tokens. MCP server (formerly better-browser-mcp).",
5
5
  "keywords": [
6
6
  "agent",