local-mcp-bridge-server 0.0.0-stage → 0.7.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +133 -2
  3. package/dist/cli.js +1213 -0
  4. package/package.json +50 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 somebodil
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,134 @@
1
- # Temporary Holding Version
1
+ # local-mcp-bridge-server
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The local MCP server for [Gemini MCP Bridge](https://github.com/somebodil/gemini-mcp-bridge), the Chrome extension that lets Gemini on the web ([gemini.google.com](https://gemini.google.com)) use the tools of your computer. Until 0.6.0 this server was called `gemini-mcp-bridge-server`: see [From gemini-mcp-bridge-server](#from-gemini-mcp-bridge-server).
4
+
5
+ The extension runs in Chrome and cannot touch your computer by itself. This server is the part that can: it runs commands, reads and writes files, and passes calls through to the other MCP servers you list. The extension reaches it at `http://127.0.0.1:7341/mcp`, or at the address of the computer the server runs on.
6
+
7
+ ```bash
8
+ npx local-mcp-bridge-server
9
+ ```
10
+
11
+ Node.js 20 or later. The first start creates the config file with a random token, then prints what to enter in the extension's options:
12
+
13
+ ```
14
+ local-mcp-bridge-server 0.7.0
15
+ URL: http://127.0.0.1:7341/mcp
16
+ Token: 3q2-...
17
+ Config: /home/you/.config/local-mcp-bridge-server/config.json (new)
18
+ Perf: /home/you/.config/local-mcp-bridge-server/perf.log (when the extension's performance log is on)
19
+ Tools: run_command, read_file, list_directory
20
+ ```
21
+
22
+ Leave the window open while you use the extension. Every request shows up there as it comes (see *Log* below).
23
+
24
+ ## Start it when you log in
25
+
26
+ Install it once, then let your system start it:
27
+
28
+ ```bash
29
+ npm install -g local-mcp-bridge-server
30
+ local-mcp-bridge-server install-service
31
+ ```
32
+
33
+ It starts at once and at every login: a LaunchAgent on macOS (log: `~/Library/Logs/local-mcp-bridge-server.log`), a systemd user service on Linux (log: `journalctl --user -u local-mcp-bridge-server`), a hidden script in the Startup folder on Windows (log: `%LOCALAPPDATA%\local-mcp-bridge-server\server.log`). No administrator rights are needed. `--port`, `--no-shell` and `--no-files` given here are saved in the config.
34
+
35
+ - `local-mcp-bridge-server token` shows the URL and the token again (the service does not write the token into its log).
36
+ - `local-mcp-bridge-server perf-log` shows the extension's performance log (below).
37
+ - `local-mcp-bridge-server uninstall-service` stops it and removes it.
38
+ - The service runs the Node.js that installed it, with the `PATH` of the terminal you installed it from (so that `npx` and your tools are found): after removing that Node.js version (with nvm, say) or changing your `PATH`, run `install-service` again.
39
+
40
+ ## From gemini-mcp-bridge-server
41
+
42
+ Until 0.6.0 this server was called `gemini-mcp-bridge-server`. The new name takes over what the old one left, so the URL and the token in the extension stay as they are:
43
+
44
+ - **The config:** without `--config`, the first start (or `token`, `install-service`) copies the old config file (`~/.config/gemini-mcp-bridge-server/config.json`, on Windows `%APPDATA%\gemini-mcp-bridge-server\config.json`) to the new place, with its token, port and servers.
45
+ - **The service:** `install-service` removes the service of the old name before it installs its own, and `uninstall-service` removes both. When the old service still holds the port, the message of a start that fails says so.
46
+
47
+ If you had installed the old one:
48
+
49
+ ```bash
50
+ npm install -g local-mcp-bridge-server
51
+ local-mcp-bridge-server install-service # replaces the service of the old name
52
+ npm uninstall -g gemini-mcp-bridge-server
53
+ ```
54
+
55
+ ## Tools
56
+
57
+ | Tool | What it does |
58
+ |---|---|
59
+ | `run_command` | Runs a command line with `bash -c` (`cmd.exe` on Windows; `$SHELL` only when there is no bash), with a time limit (60 s by default, at most 600 s). Returns the exit code, stdout and stderr. Gemini is told to write bash syntax only. It writes files with it too: a here-document (`cat > FILE <<'GMB_EOF'` ... `GMB_EOF`) writes each line as it is, and code in another language goes into a file this way and runs in the same command, one round instead of two. A command line over 100 KB runs from a temporary script file (Linux takes at most 128 KiB in one argument). |
60
+ | `read_file` | Reads a text file, whole or some of its lines. |
61
+ | `list_directory` | Lists a folder (at most 1000 entries); links show as what they point to. |
62
+ | `write_file` | Only where `run_command` cannot write a file: without bash (`cmd.exe` on Windows) and with `--no-shell`. Writes a text file, or adds to its end. Missing folders are created. |
63
+
64
+ Paths may be absolute, start with `~`, or be relative to your home folder. The server also tells Gemini, in its MCP instructions, your operating system, your home folder and your shell, so that Gemini writes paths and commands that work.
65
+
66
+ ## Options
67
+
68
+ ```
69
+ local-mcp-bridge-server [--port <n>] [--config <file>] [--no-shell] [--no-files] [--new-token]
70
+ local-mcp-bridge-server token | perf-log | install-service | uninstall-service
71
+ ```
72
+
73
+ The config file is `~/.config/local-mcp-bridge-server/config.json` (on Windows `%APPDATA%\local-mcp-bridge-server\config.json`). Only your user can read it.
74
+
75
+ ```json
76
+ {
77
+ "port": 7341,
78
+ "token": "…",
79
+ "tools": { "shell": true, "files": true },
80
+ "mcpServers": {
81
+ "playwright": { "command": "npx", "args": ["@playwright/mcp@latest"] },
82
+ "other": { "url": "http://127.0.0.1:9000/mcp", "headers": { "Authorization": "Bearer …" } }
83
+ }
84
+ }
85
+ ```
86
+
87
+ The server writes this file only on the first start and with a new token; keys it does not know stay in it. A wrong value (a port that is not a number, a server without `command` or `url`) stops the start with a message that names it.
88
+
89
+ `mcpServers` has the shape other MCP clients use, so an existing list can be copied in: stdio servers (`command`, `args`, `env`, `cwd`) and Streamable HTTP servers (`url`, `headers`). Their tools appear with the server's name in front, as `playwright__browser_navigate`. `"disabled": true` leaves one out. A server that stops is started again at its next call (after a short wait that grows while it keeps failing).
90
+
91
+ ## Log
92
+
93
+ While it runs, the server writes to stdout (the service: to its log, above) each request as it comes, each step of the work, and the reply as it goes out, all under the number of the request. Something going wrong is a `WARN` or `ERROR` line at once: a tool that failed (with why), wrong arguments, a body that is not JSON (HTTP 400), any reply with an error status (with what it said), a refused request, a file tool still running after 5 seconds, a call the extension gave up on, a reply that had nowhere to go.
94
+
95
+ ```
96
+ 14:33:50.923 INFO #1 ← tools/call run_command {"command":"mkdir -p /tmp/job && cat > /tmp/job/main.py <<'GMB_EOF' && python3 /tmp/job/main.py\nprint(\"hello\")\nGMB_EOF"} · 215 bytes from 127.0.0.1
97
+ 14:33:50.929 INFO #1 running with /bin/bash in /home/you, time limit 60 s: mkdir -p /tmp/job && cat > /tmp/job/main.py <<'GMB_EOF' && python3 /tmp/job/main.py print("hello") GMB_EOF
98
+ 14:33:50.930 INFO #1 started: process 49314
99
+ 14:33:51.084 INFO #1 run_command done (155 ms): 33 characters: exit code: 0 --- stdout --- hello
100
+ 14:33:51.086 INFO #1 → HTTP 200, 108 bytes, 164 ms
101
+ 14:33:51.090 INFO #2 ← tools/call read_file {} · 91 bytes from 127.0.0.1
102
+ 14:33:51.090 ERROR #2 read_file failed (0 ms): "path" must be a string; it was nothing.
103
+ 14:33:52.143 ERROR #8 the connection closed after 1011 ms, before the reply was sent: the extension gave up or went away
104
+ ```
105
+
106
+ A string argument over 200 characters (the content of a file) shows as its start and its length; a result, as its length and its start.
107
+
108
+ ## Performance log
109
+
110
+ When the extension's *Performance log* option is on (off by default; it is for finding out why a page is slow), the extension sends its lines to this server every ten seconds, and the server appends them to `perf.log` next to the config file. `local-mcp-bridge-server perf-log` shows the file. Past 1 MB it becomes `perf.log.1` and a new one begins. Only your user can read it.
111
+
112
+ The lines say which clicks, keys and frames took long on the page and how much of that time was the extension's own work, and every minute how much time the extension took. They carry names and numbers only, no text of the page. The same lines are on the extension's options page, with **Copy**.
113
+
114
+ ## Safety
115
+
116
+ - The server listens on every address of the computer, not on `127.0.0.1` alone: a browser elsewhere reaches it too (on the host of a virtual machine through a forwarded port, through an SSH tunnel, on another computer of your network). It does not look at where a request comes from. It refuses a request unless both hold:
117
+ - It carries the token: `Authorization: Bearer <token>`.
118
+ - It has no `Origin`, or a `chrome-extension://` one. Web pages always send their own `Origin`.
119
+ - Whoever has the token can run commands as you. Keep it like a password. `--new-token` replaces it.
120
+ - The token is the only lock, and it travels unencrypted. On a network you do not trust (a café, a shared office), close the port to other computers with the firewall of your system, or send it through an SSH tunnel.
121
+ - The extension asks before each call by default. What Gemini writes can come from a web page or a document it read ("prompt injection"): keep `run_command` (and `write_file`, where it is there) on *Ask* in the extension unless you watch closely. `--no-shell` and `--no-files` turn the tools off on this side.
122
+
123
+ ## Development
124
+
125
+ ```bash
126
+ npm install
127
+ npm run check # types, lint, tests (tools, HTTP checks, pass-through servers, config, command line, service files)
128
+ npm run smoke # build, then run dist/cli.js as users do: --version, token, start, tools/list
129
+ npm start # build and run dist/cli.js
130
+ ```
131
+
132
+ ## License
133
+
134
+ MIT