@solomonneas/adguard-mcp 0.3.1 → 0.3.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 +116 -1
- package/dist/cli.js +1214 -260
- package/dist/index.js +786 -129
- package/dist/mcp-bin.js +2018 -584
- package/dist/mcp-server.js +1994 -571
- package/openclaw.plugin.json +1 -1
- package/package.json +7 -9
package/README.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
<img src="docs/assets/adguardctrl-social-preview.jpg" alt="adguardctrl banner" width="900">
|
|
4
4
|
</p>
|
|
5
5
|
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://lidless.dev"><img src="docs/assets/marks/adguardctrl-circle.png" width="48" alt="Lidless Labs"></a>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
6
10
|
<h1 align="center">adguardctrl</h1>
|
|
7
11
|
|
|
8
12
|
<p align="center">
|
|
@@ -129,6 +133,9 @@ ADGUARD_SECONDARY_PASSWORD=<password>
|
|
|
129
133
|
|
|
130
134
|
# Optional: which instance is default when a tool omits the `instance` arg:
|
|
131
135
|
ADGUARD_DEFAULT_INSTANCE=primary
|
|
136
|
+
|
|
137
|
+
# Optional: per-request HTTP timeout in milliseconds (default 30000; minimum 1000):
|
|
138
|
+
ADGUARD_REQUEST_TIMEOUT_MS=30000
|
|
132
139
|
```
|
|
133
140
|
|
|
134
141
|
Instance names are derived from the env-var middle segment (case-insensitive). Add `ADGUARD_LIVINGROOM_URL/USERNAME/PASSWORD` and the MCP picks it up on next start.
|
|
@@ -258,12 +265,120 @@ ADGUARD_PRIMARY_PASSWORD = "your-password"
|
|
|
258
265
|
|
|
259
266
|
It does not:
|
|
260
267
|
|
|
261
|
-
-
|
|
268
|
+
- install or manage background services automatically
|
|
262
269
|
- store or proxy your DNS traffic
|
|
263
270
|
- make any write without an explicit `confirm: true` flag from the caller
|
|
264
271
|
- perform a destructive operation without `confirm: true` and `destructive: true` together
|
|
265
272
|
- talk to AdGuard's hosted DNS product; it targets self-hosted AdGuard Home instances you run
|
|
266
273
|
|
|
274
|
+
## HTTP mode
|
|
275
|
+
|
|
276
|
+
Run one process shared by multiple MCP clients, alongside the existing stdio mode:
|
|
277
|
+
|
|
278
|
+
```sh
|
|
279
|
+
node dist/mcp-server.js --http
|
|
280
|
+
# Also: adguardctrl mcp --http or adguard-mcp --http
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Configure the usual `ADGUARD_<NAME>_URL`, `_USERNAME`, and `_PASSWORD` variables
|
|
284
|
+
and optional AdGuardHome Sync credentials on the server. Generate a separate
|
|
285
|
+
HTTP token with `openssl rand -hex 32`.
|
|
286
|
+
|
|
287
|
+
| Variable | Default | Purpose |
|
|
288
|
+
| --- | --- | --- |
|
|
289
|
+
| `ADGUARD_MCP_HTTP_TOKEN` | Required | Independent bearer credential, at least 32 characters |
|
|
290
|
+
| `ADGUARD_MCP_HTTP_HOST` | IPv4 loopback | Listener bind address. Wildcards (`0.0.0.0`, `::`, `[::]`) are refused |
|
|
291
|
+
| `ADGUARD_MCP_HTTP_PORT` | `3111` | TCP port, or `0` for a free port |
|
|
292
|
+
|
|
293
|
+
Startup rejects a missing or blank token, or a token equal to any configured
|
|
294
|
+
AdGuard Home or Sync username, password, credential pair, Base64 credential
|
|
295
|
+
pair, Basic authorization value, or URL userinfo credential. Sync aliases are
|
|
296
|
+
resolved using the existing `ADGUARDHOME_SYNC_*` / `ADGUARD_SYNC_*` precedence.
|
|
297
|
+
Token comparisons use SHA-256 digests and constant-time comparison. The token is
|
|
298
|
+
registered with the secret redactor.
|
|
299
|
+
|
|
300
|
+
The resolved listener address is printed to stderr. `/mcp` accepts Streamable
|
|
301
|
+
HTTP POST, GET, and DELETE with bearer authentication on every request.
|
|
302
|
+
`GET /healthz` requires no token and returns only `{"status":"ok"}`.
|
|
303
|
+
Host and Origin checks run before authentication. Host must match the bound host
|
|
304
|
+
or a loopback alias. A supplied Origin must be an HTTP or HTTPS loopback origin.
|
|
305
|
+
The listener limits bodies to 1 MiB, request receipt to 30 seconds, headers to 10 seconds,
|
|
306
|
+
and sessions to 128. Sessions idle for 30 minutes expire on a minute timer.
|
|
307
|
+
Active POST requests prevent idle expiry. An open SSE channel alone does not.
|
|
308
|
+
SIGTERM and SIGINT close the sessions and listener. Clients must initialize again
|
|
309
|
+
after expiry or restart.
|
|
310
|
+
|
|
311
|
+
Each session owns a fresh MCP server, tool objects, and request handlers. Write
|
|
312
|
+
gates have no pending approvals or process-wide write-enable flag: every call
|
|
313
|
+
requires `confirm:true`, plus `destructive:true` for destructive tools. A confirmed
|
|
314
|
+
call cannot authorize a later call or another session. There are no deferred tool
|
|
315
|
+
sets, client caches, or shared rate limiters. Only the secret masking registry is
|
|
316
|
+
shared. All clients with the token share the configured upstream privileges and
|
|
317
|
+
can modify the same upstream resources. Session IDs route connections and do not
|
|
318
|
+
identify separate users.
|
|
319
|
+
|
|
320
|
+
Keep the default loopback binding for local clients. Remote access needs a
|
|
321
|
+
trusted TLS proxy or tunnel and network access controls. This listener provides
|
|
322
|
+
no TLS, OAuth, browser CORS access, or per-client upstream accounts. Preserve the
|
|
323
|
+
allowed Host header through a proxy. A wildcard bind does not allow arbitrary
|
|
324
|
+
Host headers.
|
|
325
|
+
|
|
326
|
+
### Claude Code
|
|
327
|
+
|
|
328
|
+
Add an HTTP entry under `mcpServers` in the client configuration:
|
|
329
|
+
|
|
330
|
+
```json
|
|
331
|
+
{
|
|
332
|
+
"mcpServers": {
|
|
333
|
+
"adguard": {
|
|
334
|
+
"type": "http",
|
|
335
|
+
"url": "http://localhost:3111/mcp",
|
|
336
|
+
"headersHelper": "/path/to/helper ADGUARD_MCP_HTTP_TOKEN"
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
The executable helper reads the named environment variable and prints an
|
|
343
|
+
Authorization JSON object. For example:
|
|
344
|
+
|
|
345
|
+
```js
|
|
346
|
+
#!/usr/bin/env node
|
|
347
|
+
const token = process.env[process.argv[2]];
|
|
348
|
+
if (!token) process.exit(1);
|
|
349
|
+
console.log(JSON.stringify({ Authorization: `Bearer ${token}` }));
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
Provide `ADGUARD_MCP_HTTP_TOKEN` to the helper through the client environment.
|
|
353
|
+
Keep the token out of client configuration files and version control.
|
|
354
|
+
|
|
355
|
+
### Codex
|
|
356
|
+
|
|
357
|
+
```toml
|
|
358
|
+
[mcp_servers.adguard]
|
|
359
|
+
url = "http://localhost:3111/mcp"
|
|
360
|
+
bearer_token_env_var = "ADGUARD_MCP_HTTP_TOKEN"
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
Export the token in the Codex process environment. The URL selects Streamable
|
|
364
|
+
HTTP, with the bearer token supplied from the named variable.
|
|
365
|
+
|
|
366
|
+
### systemd user service
|
|
367
|
+
|
|
368
|
+
[Example unit](docs/systemd/adguard-mcp-http.service) uses an installation under
|
|
369
|
+
`/opt/adguardctrl`. Adjust its paths before installing it. Its EnvironmentFile is
|
|
370
|
+
`%h/.config/adguard-mcp/http.env`. Create that file with mode `0600`, containing
|
|
371
|
+
the server's upstream configuration and HTTP token. The unit uses
|
|
372
|
+
`NoNewPrivileges=true`, `PrivateTmp=true`, and `UMask=0077`.
|
|
373
|
+
|
|
267
374
|
## License
|
|
268
375
|
|
|
269
376
|
MIT. See [LICENSE](LICENSE).
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
<p align="center"><a href="https://lidless.dev">Part of <strong>Lidless Labs</strong></a> · the eye does not close</p>
|
|
381
|
+
|
|
382
|
+
<p align="center"><sub><strong>Homelab:</strong> <a href="https://github.com/lidless-labs/proxmox-mcp">proxmox-mcp</a> · <a href="https://github.com/lidless-labs/immichctrl">immichctrl</a> · <a href="https://github.com/lidless-labs/jellyctrl">jellyctrl</a> · <a href="https://github.com/lidless-labs/proxguard">proxguard</a></sub></p>
|
|
383
|
+
|
|
384
|
+
<p align="center"><sub><a href="https://lidless.dev">All tools</a> · <a href="https://github.com/lidless-labs">Lidless Labs on GitHub</a></sub></p>
|