Skip to content

Commit 5339bcc

Browse files
committed
fix: update @mcpc/core version to 0.2.5 and modify logger to always use console.error for logging
1 parent a3eb72c commit 5339bcc

File tree

5 files changed

+11
-18
lines changed

5 files changed

+11
-18
lines changed

deno.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cli/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"./app": "./src/app.ts"
1313
},
1414
"imports": {
15-
"@mcpc/core": "jsr:@mcpc/core@^0.2.4",
15+
"@mcpc/core": "jsr:@mcpc/core@^0.2.5",
1616
"@mcpc/utils": "jsr:@mcpc/utils@^0.2.2",
1717
"@modelcontextprotocol/sdk": "npm:@modelcontextprotocol/sdk@^1.8.0",
1818
"@mcpc-tech/ripgrep-napi": "npm:@mcpc-tech/ripgrep-napi@^0.0.4",

packages/core/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mcpc/core",
3-
"version": "0.2.4",
3+
"version": "0.2.5",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/mcpc-tech/mcpc.git"

packages/core/src/utils/logger.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,10 @@ export class MCPLogger {
7474

7575
private logToConsole(level: LogLevel, data: unknown): void {
7676
const message = typeof data === "string" ? data : JSON.stringify(data);
77-
const prefix = `[${this.loggerName}]`;
78-
79-
if (level === "debug") {
80-
console.debug(prefix, message);
81-
} else if (level === "info" || level === "notice") {
82-
console.info(prefix, message);
83-
} else if (level === "warning") {
84-
console.warn(prefix, message);
85-
} else {
86-
console.error(prefix, message);
87-
}
77+
const prefix = `[${this.loggerName}:${level}]`;
78+
79+
// Always use console.error to avoid interfering with JSON-RPC on stdout in stdio mode
80+
console.error(prefix, message);
8881
}
8982

9083
debug(data: unknown): Promise<void> {

packages/core/tests/unit/tool_warning_test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Deno.test(
44
"Tool warning system - shows warning for non-existent tools",
55
async () => {
66
// Capture console output
7-
const originalWarn = console.warn;
7+
const originalError = console.error;
88
const warnings: string[] = [];
9-
console.warn = (...args: any[]) => {
9+
console.error = (...args: any[]) => {
1010
warnings.push(args.join(" "));
1111
};
1212

@@ -58,8 +58,8 @@ Deno.test(
5858

5959
await server.close();
6060
} finally {
61-
// Restore console.warn
62-
console.warn = originalWarn;
61+
// Restore console.error
62+
console.error = originalError;
6363
}
6464
},
6565
);

0 commit comments

Comments
 (0)