@graphty/remote-logger 1.2.3 → 1.3.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.
- package/README.md +52 -1
- package/dist/bundle/browser-entry.d.ts +34 -0
- package/dist/bundle/browser-entry.d.ts.map +1 -0
- package/dist/bundle/browser-entry.js +129 -0
- package/dist/bundle/browser-entry.js.map +1 -0
- package/dist/mcp/mcp-server.d.ts +1 -1
- package/dist/mcp/mcp-server.d.ts.map +1 -1
- package/dist/mcp/mcp-server.js +48 -3
- package/dist/mcp/mcp-server.js.map +1 -1
- package/dist/mcp/tools/logs-receive.d.ts +8 -8
- package/dist/mcp/tools/logs-status.d.ts.map +1 -1
- package/dist/mcp/tools/logs-status.js +4 -1
- package/dist/mcp/tools/logs-status.js.map +1 -1
- package/dist/remote-logger.browser.js +166 -0
- package/dist/remote-logger.browser.js.map +1 -0
- package/dist/server/dual-server.d.ts.map +1 -1
- package/dist/server/dual-server.js +16 -4
- package/dist/server/dual-server.js.map +1 -1
- package/dist/server/log-server.d.ts +10 -0
- package/dist/server/log-server.d.ts.map +1 -1
- package/dist/server/log-server.js +77 -8
- package/dist/server/log-server.js.map +1 -1
- package/dist/server/log-storage.d.ts +4 -0
- package/dist/server/log-storage.d.ts.map +1 -1
- package/dist/server/log-storage.js.map +1 -1
- package/dist/server/proxy.d.ts +39 -0
- package/dist/server/proxy.d.ts.map +1 -0
- package/dist/server/proxy.js +290 -0
- package/dist/server/proxy.js.map +1 -0
- package/package.json +6 -2
- package/src/bundle/browser-entry.ts +157 -0
- package/src/mcp/mcp-server.ts +48 -3
- package/src/mcp/tools/logs-status.ts +4 -1
- package/src/server/dual-server.ts +19 -4
- package/src/server/log-server.ts +91 -8
- package/src/server/log-storage.ts +4 -0
- package/src/server/proxy.ts +357 -0
package/README.md
CHANGED
|
@@ -48,7 +48,32 @@ npx remote-log-server --port 9080
|
|
|
48
48
|
remote-log-server --port 9080
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
### 2. Add
|
|
51
|
+
### 2. Add Logging to Your Application
|
|
52
|
+
|
|
53
|
+
#### Option A: Script Tag (Zero Install)
|
|
54
|
+
|
|
55
|
+
The server serves a browser-ready script at `/remote-logger.js` that auto-configures itself:
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<script src="http://localhost:9080/remote-logger.js"></script>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or paste in the browser console for quick debugging:
|
|
62
|
+
|
|
63
|
+
```javascript
|
|
64
|
+
var s=document.createElement('script');s.src='http://localhost:9080/remote-logger.js';document.head.appendChild(s);
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The script automatically intercepts all `console.log/warn/error/info/debug` calls and forwards them to the server. It exposes `window.__remoteLogger__` for manual control:
|
|
68
|
+
|
|
69
|
+
```javascript
|
|
70
|
+
// Stop intercepting console
|
|
71
|
+
window.__remoteLogger__.destroy();
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Add `?ui=true` to the script URL to show a floating console capture widget.
|
|
75
|
+
|
|
76
|
+
#### Option B: NPM Package
|
|
52
77
|
|
|
53
78
|
```typescript
|
|
54
79
|
import { RemoteLogClient } from "@graphty/remote-logger";
|
|
@@ -91,6 +116,30 @@ Log levels are displayed with the following colors:
|
|
|
91
116
|
| TRACE | Dim/gray |
|
|
92
117
|
| LOG (default) | Green |
|
|
93
118
|
|
|
119
|
+
## Debugging Third-Party Sites
|
|
120
|
+
|
|
121
|
+
The server includes a reverse proxy that injects the remote logger into any website -- no install required on the target site.
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
http://localhost:9080/proxy/https://example.com
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Point your browser (including iOS Safari) at the proxy URL. The proxy:
|
|
128
|
+
- Fetches the target page and injects the remote-logger script into HTML responses (using parse5 for safe HTML manipulation)
|
|
129
|
+
- Injects a `<base>` tag so relative URLs resolve through the proxy
|
|
130
|
+
- Strips Content-Security-Policy headers that would block the injected script
|
|
131
|
+
- Strips integrity attributes (SRI) from script/link tags
|
|
132
|
+
- Rewrites Set-Cookie Domain/Secure attributes for HTTP proxy compatibility
|
|
133
|
+
- Uses a custom TLS fingerprint to avoid CDN bot detection (Fastly, Akamai)
|
|
134
|
+
- Passes non-HTML resources (CSS, JS, images) through unmodified
|
|
135
|
+
|
|
136
|
+
**Limitations:**
|
|
137
|
+
- Resources using absolute paths (e.g., `/fonts/...`, `/media/...`) bypass the `<base>` tag and return 404
|
|
138
|
+
- JavaScript `fetch()` calls using absolute paths may bypass the proxy
|
|
139
|
+
- OAuth redirect flows that check the origin domain will not work
|
|
140
|
+
- WebSocket connections are not proxied
|
|
141
|
+
- Sites with very aggressive bot detection may still block the proxy
|
|
142
|
+
|
|
94
143
|
## CLI Reference
|
|
95
144
|
|
|
96
145
|
```
|
|
@@ -216,6 +265,8 @@ const server = startLogServer({
|
|
|
216
265
|
| Endpoint | Method | Description |
|
|
217
266
|
|----------|--------|-------------|
|
|
218
267
|
| `/log` | POST | Receive logs from client |
|
|
268
|
+
| `/remote-logger.js` | GET | Browser-ready auto-config script |
|
|
269
|
+
| `/proxy/<url>` | * | Reverse proxy with script injection |
|
|
219
270
|
| `/logs` | GET | Get all logs by session |
|
|
220
271
|
| `/logs/recent` | GET | Get recent logs (`?n=50&errors=true`) |
|
|
221
272
|
| `/logs/errors` | GET | Get error-level logs only |
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser bundle entry point for the remote logger.
|
|
3
|
+
*
|
|
4
|
+
* When loaded as a script tag, this auto-initializes a RemoteLogClient
|
|
5
|
+
* that intercepts console methods and forwards them to the server.
|
|
6
|
+
*
|
|
7
|
+
* Server URL detection priority:
|
|
8
|
+
* 1. window.__REMOTE_LOG_SERVER_URL__ (injected by server when serving this file)
|
|
9
|
+
* 2. document.currentScript.src (parse origin from script tag URL)
|
|
10
|
+
* 3. window.location.origin (fallback)
|
|
11
|
+
*
|
|
12
|
+
* Exposes window.__remoteLogger__ for manual control.
|
|
13
|
+
* @module bundle/browser-entry
|
|
14
|
+
*/
|
|
15
|
+
import { RemoteLogClient } from "../client/RemoteLogClient.js";
|
|
16
|
+
import { ConsoleCaptureUI } from "../ui/ConsoleCaptureUI.js";
|
|
17
|
+
declare global {
|
|
18
|
+
interface Window {
|
|
19
|
+
__REMOTE_LOG_SERVER_URL__?: string;
|
|
20
|
+
__remoteLogger__?: RemoteLoggerGlobal;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export interface RemoteLoggerGlobal {
|
|
24
|
+
client: RemoteLogClient;
|
|
25
|
+
ui?: ConsoleCaptureUI;
|
|
26
|
+
destroy: () => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Initialize the remote logger, intercepting console methods.
|
|
30
|
+
* @returns The remote logger global object, or undefined if no server URL detected
|
|
31
|
+
*/
|
|
32
|
+
export declare function initRemoteLogger(): RemoteLoggerGlobal | undefined;
|
|
33
|
+
export { ConsoleCaptureUI, RemoteLogClient };
|
|
34
|
+
//# sourceMappingURL=browser-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-entry.d.ts","sourceRoot":"","sources":["../../src/bundle/browser-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,yBAAyB,CAAC,EAAE,MAAM,CAAC;QACnC,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;KACzC;CACJ;AAcD,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,eAAe,CAAC;IACxB,EAAE,CAAC,EAAE,gBAAgB,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAoDD;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,GAAG,SAAS,CAqDjE;AAMD,OAAO,EAAE,gBAAgB,EAAC,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser bundle entry point for the remote logger.
|
|
3
|
+
*
|
|
4
|
+
* When loaded as a script tag, this auto-initializes a RemoteLogClient
|
|
5
|
+
* that intercepts console methods and forwards them to the server.
|
|
6
|
+
*
|
|
7
|
+
* Server URL detection priority:
|
|
8
|
+
* 1. window.__REMOTE_LOG_SERVER_URL__ (injected by server when serving this file)
|
|
9
|
+
* 2. document.currentScript.src (parse origin from script tag URL)
|
|
10
|
+
* 3. window.location.origin (fallback)
|
|
11
|
+
*
|
|
12
|
+
* Exposes window.__remoteLogger__ for manual control.
|
|
13
|
+
* @module bundle/browser-entry
|
|
14
|
+
*/
|
|
15
|
+
import { RemoteLogClient } from "../client/RemoteLogClient.js";
|
|
16
|
+
import { ConsoleCaptureUI } from "../ui/ConsoleCaptureUI.js";
|
|
17
|
+
const CONSOLE_LEVEL_MAP = {
|
|
18
|
+
log: "LOG",
|
|
19
|
+
warn: "WARN",
|
|
20
|
+
error: "ERROR",
|
|
21
|
+
info: "INFO",
|
|
22
|
+
debug: "DEBUG",
|
|
23
|
+
};
|
|
24
|
+
const INTERCEPTED_METHODS = ["log", "warn", "error", "info", "debug"];
|
|
25
|
+
function detectServerUrl() {
|
|
26
|
+
if (typeof window !== "undefined" && window.__REMOTE_LOG_SERVER_URL__) {
|
|
27
|
+
return window.__REMOTE_LOG_SERVER_URL__;
|
|
28
|
+
}
|
|
29
|
+
if (typeof document !== "undefined" && document.currentScript) {
|
|
30
|
+
try {
|
|
31
|
+
const scriptUrl = new URL(document.currentScript.src);
|
|
32
|
+
return scriptUrl.origin;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Invalid URL, fall through
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (typeof window !== "undefined" && window.location) {
|
|
39
|
+
return window.location.origin;
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
function shouldShowUI() {
|
|
44
|
+
if (typeof document === "undefined" || !document.currentScript) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const { src } = document.currentScript;
|
|
49
|
+
if (!src) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
const params = new URL(src).searchParams;
|
|
53
|
+
return params.get("ui") === "true";
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function formatArg(arg) {
|
|
60
|
+
if (typeof arg === "string") {
|
|
61
|
+
return arg;
|
|
62
|
+
}
|
|
63
|
+
if (arg instanceof Error) {
|
|
64
|
+
return `${arg.name}: ${arg.message}`;
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
return JSON.stringify(arg);
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return String(arg);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function formatArgs(args) {
|
|
74
|
+
return args.map(formatArg).join(" ");
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Initialize the remote logger, intercepting console methods.
|
|
78
|
+
* @returns The remote logger global object, or undefined if no server URL detected
|
|
79
|
+
*/
|
|
80
|
+
export function initRemoteLogger() {
|
|
81
|
+
const serverUrl = detectServerUrl();
|
|
82
|
+
if (!serverUrl) {
|
|
83
|
+
console.warn("[RemoteLogger] Could not detect server URL. Set window.__REMOTE_LOG_SERVER_URL__ before loading.");
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
const client = new RemoteLogClient({
|
|
87
|
+
serverUrl,
|
|
88
|
+
sessionPrefix: "remote",
|
|
89
|
+
batchIntervalMs: 500,
|
|
90
|
+
});
|
|
91
|
+
const originalMethods = {};
|
|
92
|
+
for (const method of INTERCEPTED_METHODS) {
|
|
93
|
+
// eslint-disable-next-line no-console
|
|
94
|
+
originalMethods[method] = console[method];
|
|
95
|
+
// eslint-disable-next-line no-console
|
|
96
|
+
console[method] = (...args) => {
|
|
97
|
+
originalMethods[method].apply(console, args);
|
|
98
|
+
const message = formatArgs(args);
|
|
99
|
+
client.log(CONSOLE_LEVEL_MAP[method], message);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
let ui;
|
|
103
|
+
if (shouldShowUI()) {
|
|
104
|
+
ui = new ConsoleCaptureUI();
|
|
105
|
+
}
|
|
106
|
+
const destroy = () => {
|
|
107
|
+
for (const method of INTERCEPTED_METHODS) {
|
|
108
|
+
// eslint-disable-next-line no-console
|
|
109
|
+
console[method] = originalMethods[method];
|
|
110
|
+
}
|
|
111
|
+
void client.close();
|
|
112
|
+
if (ui) {
|
|
113
|
+
ui.destroy();
|
|
114
|
+
}
|
|
115
|
+
if (typeof window !== "undefined") {
|
|
116
|
+
delete window.__remoteLogger__;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const global = { client, ui, destroy };
|
|
120
|
+
if (typeof window !== "undefined") {
|
|
121
|
+
window.__remoteLogger__ = global;
|
|
122
|
+
}
|
|
123
|
+
return global;
|
|
124
|
+
}
|
|
125
|
+
// Auto-initialize on load
|
|
126
|
+
initRemoteLogger();
|
|
127
|
+
// Re-export for manual use via the IIFE global
|
|
128
|
+
export { ConsoleCaptureUI, RemoteLogClient };
|
|
129
|
+
//# sourceMappingURL=browser-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-entry.js","sourceRoot":"","sources":["../../src/bundle/browser-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAW7D,MAAM,iBAAiB,GAAkC;IACrD,GAAG,EAA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,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC7C,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;YACjC,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;QACnD,CAAC,CAAC;IACN,CAAC;IAED,IAAI,EAAgC,CAAC;IACrC,IAAI,YAAY,EAAE,EAAE,CAAC;QACjB,EAAE,GAAG,IAAI,gBAAgB,EAAE,CAAC;IAChC,CAAC;IAED,MAAM,OAAO,GAAG,GAAS,EAAE;QACvB,KAAK,MAAM,MAAM,IAAI,mBAAmB,EAAE,CAAC;YACvC,sCAAsC;YACtC,OAAO,CAAC,MAAM,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QAC9C,CAAC;QACD,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,EAAE,EAAE,CAAC;YACL,EAAE,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC;QACD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAChC,OAAO,MAAM,CAAC,gBAAgB,CAAC;QACnC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,MAAM,GAAuB,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;IAE3D,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAChC,MAAM,CAAC,gBAAgB,GAAG,MAAM,CAAC;IACrC,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,0BAA0B;AAC1B,gBAAgB,EAAE,CAAC;AAEnB,+CAA+C;AAC/C,OAAO,EAAE,gBAAgB,EAAC,eAAe,EAAE,CAAC"}
|
package/dist/mcp/mcp-server.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare function getToolNames(): string[];
|
|
|
17
17
|
* Server instructions for LLMs describing the overall purpose and usage.
|
|
18
18
|
* Exported for testing purposes.
|
|
19
19
|
*/
|
|
20
|
-
export declare const SERVER_INSTRUCTIONS = "Remote Logger MCP Server - View console.log output from browser applications.\n\n## What is Remote Logging?\n\nBrowser applications run in a sandbox - their console.log() output appears in browser DevTools but is NOT visible to CLI tools or this assistant. Remote logging bridges this gap by sending browser logs to a server where they can be queried.\n\n## When to Use Remote Logging\n\nUse this when debugging applications where developer tools aren't easily accessible:\n- Storybook components (stories running in browser)\n- Web applications during development\n- Mobile web apps (phones, tablets) where DevTools requires USB debugging\n- VR/AR applications where you can't see a console while wearing a headset\n- Embedded devices, kiosks, or smart displays without keyboard access\n- Any JavaScript running in a browser context\n\nRemote logging is especially valuable for LLM assistants like this one - it enables reading, interpreting, and acting on application logs without requiring user interaction with browser DevTools.\n\n## Architecture\n\nBrowser App \u2192 HTTP POST to /log \u2192 Log Server (stores in memory + JSONL files) \u2192 MCP Tools (query logs)\n\n## Setting Up a Browser App to Send Logs\n\nFirst, get the server endpoint URL by calling logs_status - look for server.httpEndpoint in the response.\n\n### Option 1: Using the RemoteLogClient SDK (Recommended)\n\nInstall: npm install @graphty/remote-logger\n\n```typescript\nimport { RemoteLogClient } from \"@graphty/remote-logger\";\n\nconst logger = new RemoteLogClient({\n serverUrl: \"http://localhost:9080\", // Get this from logs_status (client appends /log)\n projectMarker: \"my-project\", // Optional: for filtering\n});\n\n// Intercept all console.log/warn/error calls\nlogger.interceptConsole();\n\n// Or log manually\nlogger.log(\"INFO\", \"Hello from browser!\");\n```\n\n### Option 2: Raw fetch() calls\n\n```typescript\nfetch(\"http://localhost:9080/log\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n sessionId: \"unique-session-id\",\n logs: [\n { time: new Date().toISOString(), level: \"INFO\", message: \"Hello!\" }\n ]\n })\n});\n```\n\n## Querying Logs (MCP Tools)\n\nOnce browser logs are flowing to the server:\n\n1. logs_status - Check server health, get endpoint URL, see retention settings\n2. logs_get_recent - View recent logs (primary tool, sorted chronologically)\n3. logs_get_errors - Quick filter for ERROR level only\n4. logs_search - Find specific text (supports regex)\n5. logs_list_sessions - See all browser sessions\n6. logs_get_all - Get all logs grouped by session\n7. logs_get_file_path - Get JSONL file path for Grep/Read tools\n8. logs_clear - Delete logs (requires confirmation)\n\n## Typical Debugging Workflow\n\n1. Call logs_status to verify server is running and get the endpoint URL\n2.
|
|
20
|
+
export declare const SERVER_INSTRUCTIONS = "Remote Logger MCP Server - View console.log output from browser applications.\n\n## What is Remote Logging?\n\nBrowser applications run in a sandbox - their console.log() output appears in browser DevTools but is NOT visible to CLI tools or this assistant. Remote logging bridges this gap by sending browser logs to a server where they can be queried.\n\n## When to Use Remote Logging\n\nUse this when debugging applications where developer tools aren't easily accessible:\n- Storybook components (stories running in browser)\n- Web applications during development\n- Mobile web apps (phones, tablets) where DevTools requires USB debugging\n- VR/AR applications where you can't see a console while wearing a headset\n- Embedded devices, kiosks, or smart displays without keyboard access\n- Any JavaScript running in a browser context\n\nRemote logging is especially valuable for LLM assistants like this one - it enables reading, interpreting, and acting on application logs without requiring user interaction with browser DevTools.\n\n## Architecture\n\nBrowser App \u2192 HTTP POST to /log \u2192 Log Server (stores in memory + JSONL files) \u2192 MCP Tools (query logs)\n\n## Setting Up a Browser App to Send Logs\n\nFirst, get the server endpoint URL by calling logs_status - look for server.httpEndpoint in the response.\n\n### Option 1: Using the RemoteLogClient SDK (Recommended)\n\nInstall: npm install @graphty/remote-logger\n\n```typescript\nimport { RemoteLogClient } from \"@graphty/remote-logger\";\n\nconst logger = new RemoteLogClient({\n serverUrl: \"http://localhost:9080\", // Get this from logs_status (client appends /log)\n projectMarker: \"my-project\", // Optional: for filtering\n});\n\n// Intercept all console.log/warn/error calls\nlogger.interceptConsole();\n\n// Or log manually\nlogger.log(\"INFO\", \"Hello from browser!\");\n```\n\n### Option 2: Script tag (zero install)\n\nThe server serves a browser-ready script that auto-configures itself.\nGet the script URL from logs_status - look for server.scriptUrl in the response.\n\nAdd to HTML:\n```html\n<script src=\"http://localhost:9080/remote-logger.js\"></script>\n```\n\nOr paste in browser console:\n```javascript\nvar s=document.createElement('script');s.src='http://localhost:9080/remote-logger.js';document.head.appendChild(s);\n```\n\nThe script automatically:\n- Intercepts all console.log/warn/error/info/debug calls\n- Sends them to the server it was loaded from (zero config)\n- Exposes window.__remoteLogger__ for manual control (e.g., window.__remoteLogger__.destroy())\n\nAdd ?ui=true to the script URL to show a floating console capture widget.\n\n### Option 3: Raw fetch() calls\n\n```typescript\nfetch(\"http://localhost:9080/log\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n sessionId: \"unique-session-id\",\n logs: [\n { time: new Date().toISOString(), level: \"INFO\", message: \"Hello!\" }\n ]\n })\n});\n```\n\n## Debugging Third-Party Websites\n\nThe server includes a reverse proxy that injects the remote logger into any website.\nGet the proxy base URL from logs_status - look for server.proxyBaseUrl.\n\nTo debug a third-party site, prepend the proxy base URL to the target URL:\n {proxyBaseUrl}https://example.com/page\n\nExample: http://192.168.1.x:9080/proxy/https://example.com\n\nThe proxy automatically:\n- Injects the remote-logger script into HTML responses\n- Strips Content-Security-Policy headers that would block the script\n- Forwards cookies, auth headers, and other request data\n- Passes non-HTML resources (CSS, JS, images) through unmodified\n\nLimitations:\n- Resources using absolute paths (e.g., /fonts/..., /media/...) bypass the base tag and return 404\n- JavaScript fetch() calls using absolute paths may bypass the proxy\n- OAuth redirect flows that check the origin domain will not work\n- WebSocket connections are not proxied (future enhancement)\n\n## Querying Logs (MCP Tools)\n\nOnce browser logs are flowing to the server:\n\n1. logs_status - Check server health, get endpoint URL, see retention settings\n2. logs_get_recent - View recent logs (primary tool, sorted chronologically)\n3. logs_get_errors - Quick filter for ERROR level only\n4. logs_search - Find specific text (supports regex)\n5. logs_list_sessions - See all browser sessions\n6. logs_get_all - Get all logs grouped by session\n7. logs_get_file_path - Get JSONL file path for Grep/Read tools\n8. logs_clear - Delete logs (requires confirmation)\n\n## Typical Debugging Workflow\n\n1. Call logs_status to verify server is running and get the endpoint URL, script URL, and proxy URL\n2. Add logging to the browser app using one of the options above (script tag is simplest)\n - For third-party sites, use the proxy: navigate to {proxyBaseUrl}https://target-site.com\n3. Trigger the action in the browser you want to debug\n4. Call logs_get_recent to see what happened\n5. Use logs_search if looking for specific errors or messages";
|
|
21
21
|
/**
|
|
22
22
|
* Create an MCP server with logging tools.
|
|
23
23
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAyC3D;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAEvC;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../src/mcp/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAyC3D;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAEvC;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,86JA4H8B,CAAC;AAE/D;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAkM9D;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAQvE"}
|
package/dist/mcp/mcp-server.js
CHANGED
|
@@ -67,7 +67,29 @@ logger.interceptConsole();
|
|
|
67
67
|
logger.log("INFO", "Hello from browser!");
|
|
68
68
|
\`\`\`
|
|
69
69
|
|
|
70
|
-
### Option 2:
|
|
70
|
+
### Option 2: Script tag (zero install)
|
|
71
|
+
|
|
72
|
+
The server serves a browser-ready script that auto-configures itself.
|
|
73
|
+
Get the script URL from logs_status - look for server.scriptUrl in the response.
|
|
74
|
+
|
|
75
|
+
Add to HTML:
|
|
76
|
+
\`\`\`html
|
|
77
|
+
<script src="http://localhost:9080/remote-logger.js"></script>
|
|
78
|
+
\`\`\`
|
|
79
|
+
|
|
80
|
+
Or paste in browser console:
|
|
81
|
+
\`\`\`javascript
|
|
82
|
+
var s=document.createElement('script');s.src='http://localhost:9080/remote-logger.js';document.head.appendChild(s);
|
|
83
|
+
\`\`\`
|
|
84
|
+
|
|
85
|
+
The script automatically:
|
|
86
|
+
- Intercepts all console.log/warn/error/info/debug calls
|
|
87
|
+
- Sends them to the server it was loaded from (zero config)
|
|
88
|
+
- Exposes window.__remoteLogger__ for manual control (e.g., window.__remoteLogger__.destroy())
|
|
89
|
+
|
|
90
|
+
Add ?ui=true to the script URL to show a floating console capture widget.
|
|
91
|
+
|
|
92
|
+
### Option 3: Raw fetch() calls
|
|
71
93
|
|
|
72
94
|
\`\`\`typescript
|
|
73
95
|
fetch("http://localhost:9080/log", {
|
|
@@ -82,6 +104,28 @@ fetch("http://localhost:9080/log", {
|
|
|
82
104
|
});
|
|
83
105
|
\`\`\`
|
|
84
106
|
|
|
107
|
+
## Debugging Third-Party Websites
|
|
108
|
+
|
|
109
|
+
The server includes a reverse proxy that injects the remote logger into any website.
|
|
110
|
+
Get the proxy base URL from logs_status - look for server.proxyBaseUrl.
|
|
111
|
+
|
|
112
|
+
To debug a third-party site, prepend the proxy base URL to the target URL:
|
|
113
|
+
{proxyBaseUrl}https://example.com/page
|
|
114
|
+
|
|
115
|
+
Example: http://192.168.1.x:9080/proxy/https://example.com
|
|
116
|
+
|
|
117
|
+
The proxy automatically:
|
|
118
|
+
- Injects the remote-logger script into HTML responses
|
|
119
|
+
- Strips Content-Security-Policy headers that would block the script
|
|
120
|
+
- Forwards cookies, auth headers, and other request data
|
|
121
|
+
- Passes non-HTML resources (CSS, JS, images) through unmodified
|
|
122
|
+
|
|
123
|
+
Limitations:
|
|
124
|
+
- Resources using absolute paths (e.g., /fonts/..., /media/...) bypass the base tag and return 404
|
|
125
|
+
- JavaScript fetch() calls using absolute paths may bypass the proxy
|
|
126
|
+
- OAuth redirect flows that check the origin domain will not work
|
|
127
|
+
- WebSocket connections are not proxied (future enhancement)
|
|
128
|
+
|
|
85
129
|
## Querying Logs (MCP Tools)
|
|
86
130
|
|
|
87
131
|
Once browser logs are flowing to the server:
|
|
@@ -97,8 +141,9 @@ Once browser logs are flowing to the server:
|
|
|
97
141
|
|
|
98
142
|
## Typical Debugging Workflow
|
|
99
143
|
|
|
100
|
-
1. Call logs_status to verify server is running and get the endpoint URL
|
|
101
|
-
2.
|
|
144
|
+
1. Call logs_status to verify server is running and get the endpoint URL, script URL, and proxy URL
|
|
145
|
+
2. Add logging to the browser app using one of the options above (script tag is simplest)
|
|
146
|
+
- For third-party sites, use the proxy: navigate to {proxyBaseUrl}https://target-site.com
|
|
102
147
|
3. Trigger the action in the browser you want to debug
|
|
103
148
|
4. Call logs_get_recent to see what happened
|
|
104
149
|
5. Use logs_search if looking for specific errors or messages`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../../src/mcp/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAGjF,OAAO,EACH,gBAAgB,EAEhB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EAEjB,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EAEpB,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EAEtB,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,EAEpB,wBAAwB,EACxB,iBAAiB,EACjB,uBAAuB,EAEvB,2BAA2B,EAC3B,oB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,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAE/C,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAmB;IACpD,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAE7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,yBAAyB;IACzB,uDAAuD;AAC3D,CAAC"}
|
|
@@ -23,14 +23,14 @@ export declare const logsReceiveInputSchema: z.ZodObject<{
|
|
|
23
23
|
/** Additional structured data to attach to the log entry. */
|
|
24
24
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
25
25
|
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
time: string;
|
|
26
27
|
level: string;
|
|
27
28
|
message: string;
|
|
28
|
-
time: string;
|
|
29
29
|
data?: Record<string, unknown> | undefined;
|
|
30
30
|
}, {
|
|
31
|
+
time: string;
|
|
31
32
|
level: string;
|
|
32
33
|
message: string;
|
|
33
|
-
time: string;
|
|
34
34
|
data?: Record<string, unknown> | undefined;
|
|
35
35
|
}>, "many">;
|
|
36
36
|
/** Project identifier for filtering. Derived from sessionId prefix if not provided. */
|
|
@@ -42,9 +42,9 @@ export declare const logsReceiveInputSchema: z.ZodObject<{
|
|
|
42
42
|
}, "strip", z.ZodTypeAny, {
|
|
43
43
|
sessionId: string;
|
|
44
44
|
logs: {
|
|
45
|
+
time: string;
|
|
45
46
|
level: string;
|
|
46
47
|
message: string;
|
|
47
|
-
time: string;
|
|
48
48
|
data?: Record<string, unknown> | undefined;
|
|
49
49
|
}[];
|
|
50
50
|
projectMarker?: string | undefined;
|
|
@@ -53,9 +53,9 @@ export declare const logsReceiveInputSchema: z.ZodObject<{
|
|
|
53
53
|
}, {
|
|
54
54
|
sessionId: string;
|
|
55
55
|
logs: {
|
|
56
|
+
time: string;
|
|
56
57
|
level: string;
|
|
57
58
|
message: string;
|
|
58
|
-
time: string;
|
|
59
59
|
data?: Record<string, unknown> | undefined;
|
|
60
60
|
}[];
|
|
61
61
|
projectMarker?: string | undefined;
|
|
@@ -107,14 +107,14 @@ export declare const logsReceiveTool: {
|
|
|
107
107
|
/** Additional structured data to attach to the log entry. */
|
|
108
108
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
109
109
|
}, "strip", z.ZodTypeAny, {
|
|
110
|
+
time: string;
|
|
110
111
|
level: string;
|
|
111
112
|
message: string;
|
|
112
|
-
time: string;
|
|
113
113
|
data?: Record<string, unknown> | undefined;
|
|
114
114
|
}, {
|
|
115
|
+
time: string;
|
|
115
116
|
level: string;
|
|
116
117
|
message: string;
|
|
117
|
-
time: string;
|
|
118
118
|
data?: Record<string, unknown> | undefined;
|
|
119
119
|
}>, "many">;
|
|
120
120
|
/** Project identifier for filtering. Derived from sessionId prefix if not provided. */
|
|
@@ -126,9 +126,9 @@ export declare const logsReceiveTool: {
|
|
|
126
126
|
}, "strip", z.ZodTypeAny, {
|
|
127
127
|
sessionId: string;
|
|
128
128
|
logs: {
|
|
129
|
+
time: string;
|
|
129
130
|
level: string;
|
|
130
131
|
message: string;
|
|
131
|
-
time: string;
|
|
132
132
|
data?: Record<string, unknown> | undefined;
|
|
133
133
|
}[];
|
|
134
134
|
projectMarker?: string | undefined;
|
|
@@ -137,9 +137,9 @@ export declare const logsReceiveTool: {
|
|
|
137
137
|
}, {
|
|
138
138
|
sessionId: string;
|
|
139
139
|
logs: {
|
|
140
|
+
time: string;
|
|
140
141
|
level: string;
|
|
141
142
|
message: string;
|
|
142
|
-
time: string;
|
|
143
143
|
data?: Record<string, unknown> | undefined;
|
|
144
144
|
}[];
|
|
145
145
|
projectMarker?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs-status.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/logs-status.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,qBAAqB,gDAAe,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IAClD,+BAA+B;IAC/B,WAAW,EAAE;QACT,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,GAAG,EAAE,MAAM,CAAC;KACf,CAAC;CACL;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAYhF;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;;;;
|
|
1
|
+
{"version":3,"file":"logs-status.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/logs-status.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,qBAAqB,gDAAe,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IAClD,+BAA+B;IAC/B,WAAW,EAAE;QACT,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,GAAG,EAAE,MAAM,CAAC;KACf,CAAC;CACL;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAYhF;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;;;;CAa1B,CAAC"}
|
|
@@ -36,9 +36,12 @@ export const logsStatusTool = {
|
|
|
36
36
|
name: "logs_status",
|
|
37
37
|
description: "Get the status of the remote log server. " +
|
|
38
38
|
"Returns health metrics (uptime, session count, log count, memory usage), " +
|
|
39
|
-
"HTTP endpoint configuration (port, host, URL for browser clients
|
|
39
|
+
"HTTP endpoint configuration (port, host, URL for browser clients, script URL for zero-config injection, " +
|
|
40
|
+
"proxy base URL for debugging third-party sites), " +
|
|
40
41
|
"and retention settings (how long logs are kept before automatic cleanup). " +
|
|
41
42
|
"Use this to verify the server is running, find the endpoint URL for configuring browser clients, " +
|
|
43
|
+
"get the script URL (server.scriptUrl) for injecting via a script tag, " +
|
|
44
|
+
"get the proxy URL (server.proxyBaseUrl) for debugging third-party sites, " +
|
|
42
45
|
"or check server configuration.",
|
|
43
46
|
inputSchema: logsStatusInputSchema,
|
|
44
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs-status.js","sourceRoot":"","sources":["../../../src/mcp/tools/logs-status.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAI5B;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAmBlD;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAmB;IACjD,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IACnC,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAEvC,OAAO,OAAO,CAAC,OAAO,CAAC;QACnB,GAAG,MAAM;QACT,WAAW,EAAE;YACT,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,SAAS,EAAE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