@kealthas-dev/opencode-mcp-loki 1.1.3 → 1.1.5

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 CHANGED
@@ -53,7 +53,7 @@ mkdir -p ~/.config/kealthas-dev/opencode-mcp-loki
53
53
  LOKI_CONFIG_ENV=prod opencode-mcp-loki
54
54
  ```
55
55
 
56
- For local dev/testing against this repo's own checkout (this directory, not the published package), same idea — drop a real config file at the default location, or a named `config-<name>.json` (see `config.example.json` for the shape — the sandbox's docker-entrypoint.sh generates the default one automatically, see Testing below):
56
+ For local dev/testing against this repo's own checkout (this directory, not the published package), same idea — drop a real config file at the default location, or a named `config-<name>.json` (see `config.example.json` for the shape — the sandbox's entrypoint.sh generates the default one automatically, see Testing below):
57
57
 
58
58
  ```bash
59
59
  npm install
@@ -74,7 +74,7 @@ docker compose -f docker/docker-compose.loki.yml up -d
74
74
  docker/dev.sh run --rm opencode-dev bash
75
75
  ```
76
76
 
77
- The default config file is already in place inside that shell — `docker-entrypoint.sh` generates `~/.config/kealthas-dev/opencode-mcp-loki/config.json` from the sandbox's `LOKI_BASE_URL` compose env var. `cd mcp-servers/loki && npm install && npm run build && npm start`, then hit `http://localhost:8091/mcp` from an MCP client or `curl`.
77
+ The default config file is already in place inside that shell — `entrypoint.sh` generates `~/.config/kealthas-dev/opencode-mcp-loki/config.json` from the sandbox's `LOKI_BASE_URL` compose env var. `cd mcp-servers/loki && npm install && npm run build && npm start`, then hit `http://localhost:8091/mcp` from an MCP client or `curl`.
78
78
 
79
79
  `loki.test.ts` (see `tests/README.md`) doesn't need this manual dance — it builds its own config files into a fake `$HOME` per spawned server (same pattern as `mcp-servers/oracle/oracle.test.ts`) and starts/stops its own `dist/server.js` process on its own port as part of the test run, seeding its own test log lines by pushing directly to Loki's push API (not through this MCP server, which is read-only by design).
80
80
 
package/dist/server.js CHANGED
@@ -115,6 +115,10 @@ function resolveTimeParam(value, tzOffset) {
115
115
  return `${naive[1]}T${naive[2]}${tzOffset}`;
116
116
  return value;
117
117
  }
118
+ // fetch() has no timeout by default - without this, a Loki/Grafana host
119
+ // that accepts the TCP connection but never responds (e.g. stuck behind a
120
+ // hung reverse proxy) leaves the request pending forever.
121
+ const REQUEST_TIMEOUT_MS = 30_000;
118
122
  // Loki's API is read-only, so unlike Oracle there's no connection lifecycle
119
123
  // or audit gate here - just a stateless GET. Centralizes URL-building, auth
120
124
  // headers, and turning a non-2xx/network failure into {success: false}
@@ -142,7 +146,7 @@ async function lokiFetch(path, params) {
142
146
  // follows that by default, landing on the login page's HTML with a
143
147
  // misleadingly "successful" 200 status - the JSON.parse below would
144
148
  // then fail with an opaque syntax error instead of a diagnosable one.
145
- const response = await fetch(url, { headers, redirect: "manual" });
149
+ const response = await fetch(url, { headers, redirect: "manual", signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS) });
146
150
  if (response.status >= 300 && response.status < 400) {
147
151
  const location = response.headers.get("location") ?? "(no Location header)";
148
152
  const hint = lokiConfig.LOKI_VIA_GRAFANA
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kealthas-dev/opencode-mcp-loki",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "type": "module",
5
5
  "description": "MCP server exposing read-only Loki query/label tools - see README.md for design and the config.json-driven config",
6
6
  "main": "dist/server.js",