@graphty/remote-logger 1.2.2 → 1.2.3
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 +1 -1
- package/dist/client/RemoteLogClient.d.ts +2 -1
- package/dist/client/RemoteLogClient.d.ts.map +1 -1
- package/dist/client/RemoteLogClient.js +20 -10
- package/dist/client/RemoteLogClient.js.map +1 -1
- package/dist/client/types.d.ts +6 -0
- package/dist/client/types.d.ts.map +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +20 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/mcp-server.d.ts +5 -0
- package/dist/mcp/mcp-server.d.ts.map +1 -1
- package/dist/mcp/mcp-server.js +6 -5
- package/dist/mcp/mcp-server.js.map +1 -1
- package/dist/mcp/tools/index.d.ts +6 -6
- package/dist/mcp/tools/index.d.ts.map +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/logs-clear.d.ts +1 -2
- package/dist/mcp/tools/logs-clear.d.ts.map +1 -1
- package/dist/mcp/tools/logs-get-all.d.ts +1 -2
- package/dist/mcp/tools/logs-get-all.d.ts.map +1 -1
- package/dist/mcp/tools/logs-get-errors.d.ts +1 -2
- package/dist/mcp/tools/logs-get-errors.d.ts.map +1 -1
- package/dist/mcp/tools/logs-get-file-path.d.ts +8 -2
- package/dist/mcp/tools/logs-get-file-path.d.ts.map +1 -1
- package/dist/mcp/tools/logs-get-file-path.js +1 -1
- package/dist/mcp/tools/logs-get-file-path.js.map +1 -1
- package/dist/mcp/tools/logs-receive.d.ts +1 -2
- package/dist/mcp/tools/logs-receive.d.ts.map +1 -1
- package/dist/mcp/tools/logs-search.d.ts +1 -2
- package/dist/mcp/tools/logs-search.d.ts.map +1 -1
- package/dist/server/dual-server.d.ts +7 -4
- package/dist/server/dual-server.d.ts.map +1 -1
- package/dist/server/dual-server.js +108 -46
- package/dist/server/dual-server.js.map +1 -1
- package/dist/server/log-server.d.ts +2 -2
- package/dist/server/log-server.d.ts.map +1 -1
- package/dist/server/log-server.js +32 -55
- package/dist/server/log-server.js.map +1 -1
- package/dist/server/self-signed-cert.d.ts +9 -0
- package/dist/server/self-signed-cert.d.ts.map +1 -1
- package/dist/server/self-signed-cert.js +9 -0
- package/dist/server/self-signed-cert.js.map +1 -1
- package/dist/ui/ConsoleCaptureUI.d.ts.map +1 -1
- package/dist/ui/ConsoleCaptureUI.js +6 -1
- package/dist/ui/ConsoleCaptureUI.js.map +1 -1
- package/package.json +2 -1
- package/src/client/RemoteLogClient.ts +22 -11
- package/src/client/types.ts +6 -0
- package/src/mcp/index.ts +42 -0
- package/src/mcp/mcp-server.ts +6 -5
- package/src/mcp/tools/index.ts +7 -0
- package/src/mcp/tools/logs-clear.ts +1 -1
- package/src/mcp/tools/logs-get-all.ts +1 -1
- package/src/mcp/tools/logs-get-errors.ts +1 -1
- package/src/mcp/tools/logs-get-file-path.ts +2 -2
- package/src/mcp/tools/logs-receive.ts +1 -1
- package/src/mcp/tools/logs-search.ts +1 -1
- package/src/server/dual-server.ts +146 -53
- package/src/server/log-server.ts +35 -60
- package/src/server/self-signed-cert.ts +9 -0
- package/src/ui/ConsoleCaptureUI.ts +6 -1
package/src/server/log-server.ts
CHANGED
|
@@ -81,7 +81,7 @@ const colors = {
|
|
|
81
81
|
export interface LogServerOptions {
|
|
82
82
|
/** Port to listen on (default: 9080) */
|
|
83
83
|
port?: number;
|
|
84
|
-
/** Hostname to bind to (default:
|
|
84
|
+
/** Hostname to bind to (default: 0.0.0.0) */
|
|
85
85
|
host?: string;
|
|
86
86
|
/** Path to SSL certificate file (HTTPS only used if both certPath and keyPath provided) */
|
|
87
87
|
certPath?: string;
|
|
@@ -477,7 +477,7 @@ export function createLogServer(options: CreateLogServerOptions): CreateLogServe
|
|
|
477
477
|
*/
|
|
478
478
|
export function startLogServer(options: LogServerOptions = {}): http.Server | https.Server {
|
|
479
479
|
const port = options.port ?? 9080;
|
|
480
|
-
const host = options.host ?? "
|
|
480
|
+
const host = options.host ?? "0.0.0.0";
|
|
481
481
|
const quiet = options.quiet ?? false;
|
|
482
482
|
|
|
483
483
|
// Set up log file if specified
|
|
@@ -555,7 +555,7 @@ Usage:
|
|
|
555
555
|
|
|
556
556
|
Options:
|
|
557
557
|
--port, -p <port> Port to listen on (default: 9080)
|
|
558
|
-
--host, -h <host> Hostname to bind to (default:
|
|
558
|
+
--host, -h <host> Hostname to bind to (default: 0.0.0.0)
|
|
559
559
|
--cert, -c <path> Path to SSL certificate file (enables HTTPS)
|
|
560
560
|
--key, -k <path> Path to SSL private key file (enables HTTPS)
|
|
561
561
|
--log-file, -l <path> Write logs to file
|
|
@@ -677,87 +677,62 @@ export async function main(): Promise<void> {
|
|
|
677
677
|
|
|
678
678
|
const { options } = result;
|
|
679
679
|
|
|
680
|
+
// Common server options shared across all modes
|
|
681
|
+
const baseOptions = {
|
|
682
|
+
httpPort: options.port ?? 9080,
|
|
683
|
+
httpHost: options.host ?? "0.0.0.0",
|
|
684
|
+
quiet: options.quiet ?? false,
|
|
685
|
+
certPath: options.certPath,
|
|
686
|
+
keyPath: options.keyPath,
|
|
687
|
+
};
|
|
688
|
+
|
|
680
689
|
// Determine mode: mcp-only, http-only, or dual (default)
|
|
681
690
|
// All modes now use createDualServer with different options
|
|
682
691
|
const { createDualServer } = await import("./dual-server.js");
|
|
683
692
|
|
|
693
|
+
let dualServer;
|
|
694
|
+
let modeMessage: string;
|
|
695
|
+
|
|
684
696
|
if (options.mcpOnly) {
|
|
685
697
|
// MCP-only mode: HTTP only serves /log endpoint, MCP enabled
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
httpHost: options.host ?? "localhost",
|
|
698
|
+
dualServer = await createDualServer({
|
|
699
|
+
...baseOptions,
|
|
689
700
|
httpEnabled: true,
|
|
690
701
|
mcpEnabled: true,
|
|
691
|
-
quiet: options.quiet ?? false,
|
|
692
702
|
logReceiveOnly: true, // Only serve /log and /health endpoints
|
|
693
|
-
certPath: options.certPath,
|
|
694
|
-
keyPath: options.keyPath,
|
|
695
|
-
});
|
|
696
|
-
|
|
697
|
-
// Handle graceful shutdown
|
|
698
|
-
process.on("SIGINT", () => {
|
|
699
|
-
// eslint-disable-next-line no-console
|
|
700
|
-
console.log("\nShutting down...");
|
|
701
|
-
void dualServer.shutdown().then(() => {
|
|
702
|
-
process.exit(0);
|
|
703
|
-
});
|
|
704
703
|
});
|
|
705
|
-
|
|
706
|
-
if (!options.quiet) {
|
|
707
|
-
// eslint-disable-next-line no-console
|
|
708
|
-
console.log("MCP mode: Log receive endpoint and MCP tools running");
|
|
709
|
-
}
|
|
704
|
+
modeMessage = "MCP mode: Log receive endpoint and MCP tools running";
|
|
710
705
|
} else if (options.httpOnly) {
|
|
711
706
|
// HTTP-only mode: All HTTP endpoints, no MCP
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
httpHost: options.host ?? "localhost",
|
|
707
|
+
dualServer = await createDualServer({
|
|
708
|
+
...baseOptions,
|
|
715
709
|
httpEnabled: true,
|
|
716
710
|
mcpEnabled: false,
|
|
717
|
-
quiet: options.quiet ?? false,
|
|
718
|
-
certPath: options.certPath,
|
|
719
|
-
keyPath: options.keyPath,
|
|
720
711
|
logFile: options.logFile,
|
|
721
712
|
});
|
|
722
|
-
|
|
723
|
-
// Handle graceful shutdown
|
|
724
|
-
process.on("SIGINT", () => {
|
|
725
|
-
// eslint-disable-next-line no-console
|
|
726
|
-
console.log("\nShutting down...");
|
|
727
|
-
void dualServer.shutdown().then(() => {
|
|
728
|
-
process.exit(0);
|
|
729
|
-
});
|
|
730
|
-
});
|
|
731
|
-
|
|
732
|
-
if (!options.quiet) {
|
|
733
|
-
// eslint-disable-next-line no-console
|
|
734
|
-
console.log("HTTP-only mode: All HTTP endpoints running");
|
|
735
|
-
}
|
|
713
|
+
modeMessage = "HTTP-only mode: All HTTP endpoints running";
|
|
736
714
|
} else {
|
|
737
715
|
// Dual mode (default): All HTTP endpoints and MCP
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
httpHost: options.host ?? "localhost",
|
|
716
|
+
dualServer = await createDualServer({
|
|
717
|
+
...baseOptions,
|
|
741
718
|
httpEnabled: true,
|
|
742
719
|
mcpEnabled: true,
|
|
743
|
-
quiet: options.quiet ?? false,
|
|
744
|
-
certPath: options.certPath,
|
|
745
|
-
keyPath: options.keyPath,
|
|
746
720
|
logFile: options.logFile,
|
|
747
721
|
});
|
|
722
|
+
modeMessage = "Dual mode: HTTP and MCP servers running";
|
|
723
|
+
}
|
|
748
724
|
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
});
|
|
725
|
+
// Single SIGINT handler for all modes
|
|
726
|
+
process.on("SIGINT", () => {
|
|
727
|
+
// eslint-disable-next-line no-console
|
|
728
|
+
console.log("\nShutting down...");
|
|
729
|
+
void dualServer.shutdown().then(() => {
|
|
730
|
+
process.exit(0);
|
|
756
731
|
});
|
|
732
|
+
});
|
|
757
733
|
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}
|
|
734
|
+
if (!options.quiet) {
|
|
735
|
+
// eslint-disable-next-line no-console
|
|
736
|
+
console.log(modeMessage);
|
|
762
737
|
}
|
|
763
738
|
}
|
|
@@ -14,8 +14,17 @@ export interface GeneratedCert {
|
|
|
14
14
|
/**
|
|
15
15
|
* Generate a self-signed certificate for HTTPS.
|
|
16
16
|
* The certificate is valid for localhost and common local development hostnames.
|
|
17
|
+
*
|
|
18
|
+
* NOTE: This function is currently unused because modern browsers reject
|
|
19
|
+
* self-signed certificates by default. It is retained for potential use cases:
|
|
20
|
+
* - Node.js clients that can disable certificate verification
|
|
21
|
+
* - Testing environments
|
|
22
|
+
* - Development setups where users manually trust the certificate
|
|
23
|
+
*
|
|
24
|
+
* For browser use, provide valid certificates via --cert and --key flags.
|
|
17
25
|
* @param hostname - Optional hostname to include in the certificate (default: localhost)
|
|
18
26
|
* @returns Object containing PEM-encoded certificate and private key
|
|
27
|
+
* @internal
|
|
19
28
|
*/
|
|
20
29
|
export function generateSelfSignedCert(hostname = "localhost"): GeneratedCert {
|
|
21
30
|
const attrs = [
|
|
@@ -313,6 +313,8 @@ export class ConsoleCaptureUI {
|
|
|
313
313
|
*/
|
|
314
314
|
private setupGlobalMethods(): void {
|
|
315
315
|
if (typeof window !== "undefined") {
|
|
316
|
+
// Create a function that returns current logs to avoid stale reference
|
|
317
|
+
const getCurrentLogs = (): CapturedLogEntry[] => [...this.logs];
|
|
316
318
|
window.__console__ = {
|
|
317
319
|
copy: () => this.copyLogs(),
|
|
318
320
|
download: () => {
|
|
@@ -322,7 +324,10 @@ export class ConsoleCaptureUI {
|
|
|
322
324
|
this.clearLogs();
|
|
323
325
|
},
|
|
324
326
|
get: () => this.getLogs(),
|
|
325
|
-
|
|
327
|
+
// Use getter to always return fresh copy of current logs
|
|
328
|
+
get logs() {
|
|
329
|
+
return getCurrentLogs();
|
|
330
|
+
},
|
|
326
331
|
};
|
|
327
332
|
}
|
|
328
333
|
}
|