@empir3/empir3-bridge 0.3.21 → 0.3.22

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/CHANGELOG.md CHANGED
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.22] - 2026-06-21
11
+
12
+ ### Added
13
+ - **`empir3-bridge-mcp` bin** — run the MCP stdio server straight from the published npm package, no clone required. Wire it into any MCP client's `.mcp.json` with `npx -y -p @empir3/empir3-bridge empir3-bridge-mcp`. Runs `src/mcp-server.ts` through the bundled `tsx`; the companion `empir3-bridge` bin still starts the daemon directly.
14
+
10
15
  ### Changed
11
16
  - Published to npm as `@empir3/empir3-bridge`.
12
17
 
package/README.md CHANGED
@@ -101,13 +101,34 @@ npm install
101
101
  npm start
102
102
  ```
103
103
 
104
+ Or install the published package from npm:
105
+
106
+ ```bash
107
+ npm install -g @empir3/empir3-bridge
108
+ empir3-bridge # starts the bridge + Chrome (empir3-bridge --status / --kill to manage)
109
+ ```
110
+
104
111
  Open the dashboard:
105
112
 
106
113
  ```text
107
114
  http://localhost:3006
108
115
  ```
109
116
 
110
- Then add the bridge to a Claude Code project with `.mcp.json`:
117
+ Then add the bridge to a Claude Code project with `.mcp.json`. Using the published package (no clone needed):
118
+
119
+ ```json
120
+ {
121
+ "mcpServers": {
122
+ "empir3-bridge": {
123
+ "type": "stdio",
124
+ "command": "npx",
125
+ "args": ["-y", "-p", "@empir3/empir3-bridge", "empir3-bridge-mcp"]
126
+ }
127
+ }
128
+ }
129
+ ```
130
+
131
+ Or point it at a local clone (for development):
111
132
 
112
133
  ```json
113
134
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empir3/empir3-bridge",
3
- "version": "0.3.21",
3
+ "version": "0.3.22",
4
4
  "description": "Local-first browser and desktop control bridge for AI agents using MCP.",
5
5
  "license": "MIT",
6
6
  "author": "Empir3",
@@ -27,7 +27,8 @@
27
27
  "local-first"
28
28
  ],
29
29
  "bin": {
30
- "empir3-bridge": "./src/launch.js"
30
+ "empir3-bridge": "./src/launch.js",
31
+ "empir3-bridge-mcp": "./src/mcp-entry.js"
31
32
  },
32
33
  "main": "./src/cli.ts",
33
34
  "scripts": {
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * empir3-bridge-mcp — stdio MCP server entry for the published npm package.
4
+ *
5
+ * MCP clients (Claude Code, Codex, Cursor, …) launch this with:
6
+ * npx -y -p @empir3/empir3-bridge empir3-bridge-mcp
7
+ *
8
+ * It runs src/mcp-server.ts through the bundled `tsx` with stdio inherited, so
9
+ * the MCP client speaks JSON-RPC straight to the server over stdin/stdout. The
10
+ * MCP server auto-launches the bridge (HTTP wrapper + CDP) on first tool use,
11
+ * so no separate daemon step is required.
12
+ *
13
+ * The companion `empir3-bridge` bin starts the daemon directly (src/launch.js);
14
+ * this one is the thin MCP shim.
15
+ */
16
+ 'use strict';
17
+
18
+ const { spawn } = require('child_process');
19
+ const path = require('path');
20
+
21
+ let tsxCli;
22
+ try {
23
+ // Resolves tsx from the package's own node_modules regardless of cwd, the
24
+ // same mechanism src/launch.js relies on. tsx is a runtime dependency.
25
+ tsxCli = require.resolve('tsx/cli');
26
+ } catch (err) {
27
+ process.stderr.write(
28
+ '[empir3-bridge-mcp] could not resolve tsx — reinstall the package: npm i -g @empir3/empir3-bridge\n'
29
+ );
30
+ process.exit(1);
31
+ }
32
+
33
+ const mcpServer = path.join(__dirname, 'mcp-server.ts');
34
+
35
+ const child = spawn(process.execPath, [tsxCli, mcpServer, ...process.argv.slice(2)], {
36
+ stdio: 'inherit',
37
+ });
38
+
39
+ child.on('error', (err) => {
40
+ process.stderr.write(`[empir3-bridge-mcp] failed to start MCP server: ${err.message}\n`);
41
+ process.exit(1);
42
+ });
43
+
44
+ child.on('exit', (code, signal) => {
45
+ if (signal) {
46
+ try { process.kill(process.pid, signal); } catch { process.exit(1); }
47
+ } else {
48
+ process.exit(code == null ? 0 : code);
49
+ }
50
+ });
51
+
52
+ // Forward termination so the MCP client closing the pipe tears down the server.
53
+ for (const sig of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
54
+ process.on(sig, () => { try { child.kill(sig); } catch {} });
55
+ }