@midscene/shared 1.0.1-beta-20251208031856.0 → 1.0.1-beta-20251208033501.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.
|
@@ -56,6 +56,15 @@ class BaseMCPServer {
|
|
|
56
56
|
this.toolsManager?.closeBrowser?.().catch(console.error);
|
|
57
57
|
}
|
|
58
58
|
async launch() {
|
|
59
|
+
console.log = (...args)=>{
|
|
60
|
+
console.error('[LOG]', ...args);
|
|
61
|
+
};
|
|
62
|
+
console.info = (...args)=>{
|
|
63
|
+
console.error('[INFO]', ...args);
|
|
64
|
+
};
|
|
65
|
+
console.debug = (...args)=>{
|
|
66
|
+
console.error('[DEBUG]', ...args);
|
|
67
|
+
};
|
|
59
68
|
await this.initializeToolsManager();
|
|
60
69
|
const transport = new StdioServerTransport();
|
|
61
70
|
try {
|
|
@@ -86,6 +86,15 @@ class BaseMCPServer {
|
|
|
86
86
|
this.toolsManager?.closeBrowser?.().catch(console.error);
|
|
87
87
|
}
|
|
88
88
|
async launch() {
|
|
89
|
+
console.log = (...args)=>{
|
|
90
|
+
console.error('[LOG]', ...args);
|
|
91
|
+
};
|
|
92
|
+
console.info = (...args)=>{
|
|
93
|
+
console.error('[INFO]', ...args);
|
|
94
|
+
};
|
|
95
|
+
console.debug = (...args)=>{
|
|
96
|
+
console.error('[DEBUG]', ...args);
|
|
97
|
+
};
|
|
89
98
|
await this.initializeToolsManager();
|
|
90
99
|
const transport = new stdio_js_namespaceObject.StdioServerTransport();
|
|
91
100
|
try {
|
package/package.json
CHANGED
package/src/mcp/base-server.ts
CHANGED
|
@@ -114,6 +114,19 @@ export abstract class BaseMCPServer {
|
|
|
114
114
|
* Initialize and launch the MCP server with stdio transport
|
|
115
115
|
*/
|
|
116
116
|
public async launch(): Promise<void> {
|
|
117
|
+
// Hijack stdout-based console methods to stderr for stdio mode
|
|
118
|
+
// This prevents them from breaking MCP JSON-RPC protocol on stdout
|
|
119
|
+
// Note: console.warn and console.error already output to stderr
|
|
120
|
+
console.log = (...args: unknown[]) => {
|
|
121
|
+
console.error('[LOG]', ...args);
|
|
122
|
+
};
|
|
123
|
+
console.info = (...args: unknown[]) => {
|
|
124
|
+
console.error('[INFO]', ...args);
|
|
125
|
+
};
|
|
126
|
+
console.debug = (...args: unknown[]) => {
|
|
127
|
+
console.error('[DEBUG]', ...args);
|
|
128
|
+
};
|
|
129
|
+
|
|
117
130
|
await this.initializeToolsManager();
|
|
118
131
|
|
|
119
132
|
const transport = new StdioServerTransport();
|