aboutsummaryrefslogtreecommitdiff
path: root/mcp/server.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'mcp/server.mjs')
-rwxr-xr-xmcp/server.mjs17
1 files changed, 4 insertions, 13 deletions
diff --git a/mcp/server.mjs b/mcp/server.mjs
index c6e70f1..42da739 100755
--- a/mcp/server.mjs
+++ b/mcp/server.mjs
@@ -6,8 +6,8 @@
// MCP client drives the browser through pi-chrome's companion extension, with one implementation
// of the tools, the page snapshots and the bridge client rather than a second copy to drift.
//
-// pi-chrome itself is a dependency, loaded from node_modules; PI_CHROME_PATH points at another
-// copy (a fork, a checkout) instead.
+// pi-chrome itself is this repository's own extensions/chrome-profile-bridge, the directory above
+// this one; PI_CHROME_PATH points at another copy instead.
//
// Two transports:
//
@@ -46,17 +46,8 @@ const log = (message) => console.error(`[${NAME}] ${message}`);
// Base64 grows a file by a third; this keeps the encoded image under Claude Desktop's 1MB limit.
const MAX_INLINE_IMAGE_BYTES = 700 * 1024;
-// pi-chrome's tool layer: the dependency by default, or any other copy of it.
-const EXTENSION = (() => {
- const override = process.env.PI_CHROME_PATH?.trim();
- if (override) return override;
- try {
- return fileURLToPath(import.meta.resolve("pi-chrome/extensions/chrome-profile-bridge/index.ts"));
- } catch {
- log("cannot find pi-chrome. Run ./run.sh (or npm ci) here, or set PI_CHROME_PATH to a copy of its index.ts");
- process.exit(2);
- }
-})();
+// pi-chrome's tool layer: the one in this repository by default, or any other copy of it.
+const EXTENSION = process.env.PI_CHROME_PATH?.trim() || resolve(here, "../extensions/chrome-profile-bridge/index.ts");
// --http HOST:PORT, or unset for stdio.
const HTTP = (() => {