mcp-unknowncheatz 0.3.7 → 0.3.8

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
@@ -132,6 +132,8 @@ Browsing or crawling a subforum records its visible listing in the local index.
132
132
 
133
133
  ## Development
134
134
 
135
+ If a tool returns `connect ECONNREFUSED 127.0.0.1:<port>` while Chrome stays on a blank page, update to a build containing the explicit debugging-port fix. `chrome-launcher 1.2.2` can select an old port from the dedicated profile's accumulated log on restart. The server now allocates a fresh loopback port for each launch. Close any abandoned Chrome window using the dedicated MCP profile before restarting the server; keep your ordinary Chrome windows open. A profile must be used by only one server instance at a time. This startup error occurs before forum navigation and is separate from a Cloudflare verification loop.
136
+
135
137
  ```sh
136
138
  bun run typecheck
137
139
  bun run test
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-unknowncheatz",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "type": "module",
5
5
  "description": "MCP server for searching and reading the UnknownCheats forum",
6
6
  "bin": {
@@ -0,0 +1,19 @@
1
+ import { createServer } from "node:net";
2
+
3
+ // Give chrome-launcher an explicit port. Its dynamic-port discovery can read a
4
+ // stale DevTools entry from the persistent profile's append-only chrome-err.log.
5
+ // Release the reservation before Chrome binds; never expose debugging remotely.
6
+ export function getAvailableDebuggingPort(): Promise<number> {
7
+ return new Promise((resolve, reject) => {
8
+ const server = createServer();
9
+ server.once("error", reject);
10
+ server.listen(0, "127.0.0.1", () => {
11
+ const address = server.address();
12
+ if (!address || typeof address === "string" || address.port === 0) {
13
+ server.close(() => reject(new Error("Could not allocate Chrome debugging port")));
14
+ return;
15
+ }
16
+ server.close((error) => error ? reject(error) : resolve(address.port));
17
+ });
18
+ });
19
+ }
package/src/browser.ts CHANGED
@@ -4,6 +4,7 @@ import os from "node:os";
4
4
  import path from "path";
5
5
  import { fileURLToPath } from "url";
6
6
  import { isApacheNotFoundPage, normalizeThreadUrl } from "./forum-url.js";
7
+ import { getAvailableDebuggingPort } from "./browser-port.js";
7
8
 
8
9
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
10
  const COOKIES_PATH = path.join(__dirname, "..", "cookies.json");
@@ -102,6 +103,7 @@ async function launchBrowser(): Promise<BrowserInstance> {
102
103
  const executablePath = process.env.UC_CHROME_PATH?.trim();
103
104
  const existingProfile = existsSync(PROFILE_DIR);
104
105
  mkdirSync(PROFILE_DIR, { recursive: true });
106
+ const debuggingPort = await getAvailableDebuggingPort();
105
107
  const { browser, page } = await connect({
106
108
  headless: useHeadless(),
107
109
  turnstile: true,
@@ -109,6 +111,7 @@ async function launchBrowser(): Promise<BrowserInstance> {
109
111
  customConfig: {
110
112
  ...(executablePath ? { chromePath: executablePath } : {}),
111
113
  userDataDir: PROFILE_DIR,
114
+ port: debuggingPort,
112
115
  },
113
116
  connectOption: { defaultViewport: null },
114
117
  disableXvfb: useRealDisplay(),
package/src/index.ts CHANGED
File without changes