Skip to content

Commit 4cf72f2

Browse files
committed
Fix: Resolve TypeScript error in McpHub.ts by fixing level parameter type compatibility
1 parent 5396310 commit 4cf72f2

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/services/mcp/McpHub.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,9 @@ export class McpHub {
500500
// Log normal informational messages
501501
console.log(`Server "${name}" info:`, output)
502502
// Tag the message with stdout_info so we can identify it in the UI
503-
// but map it to "info" level for type compatibility
504503
const connection = this.findConnection(name, source)
505504
if (connection) {
506-
// Add a prefix to identify this as a stdout message that's been mapped to info
505+
// Add a prefix to identify this as a stdout message
507506
this.appendErrorMessage(connection, `[STDOUT] ${output}`, "info")
508507
await this.notifyWebviewOfServerChanges()
509508
}
@@ -532,7 +531,7 @@ export class McpHub {
532531
console.log(`Server "${name}" stdout:`, output)
533532
const connection = this.findConnection(name, source)
534533
if (connection) {
535-
// Add a prefix to identify this as a stdout message that's been mapped to info
534+
// Add a prefix to identify this as a stdout message
536535
this.appendErrorMessage(connection, `[STDOUT] ${output}`, "info")
537536
await this.notifyWebviewOfServerChanges()
538537
}
@@ -609,7 +608,7 @@ export class McpHub {
609608
private appendErrorMessage(
610609
connection: McpConnection,
611610
error: string,
612-
level: "error" | "warn" | "info" | "stdout" = "error",
611+
level: "error" | "warn" | "info" = "error",
613612
): void {
614613
const MAX_ERROR_LENGTH = 1000
615614
const truncatedError =
@@ -622,14 +621,13 @@ export class McpHub {
622621
connection.server.errorHistory = []
623622
}
624623

625-
// Note: We no longer need to map "stdout" to "info" here
626-
// as we're now adding the [STDOUT] prefix to the message itself
627-
// and directly using "info" level in the calling code
624+
// Map for McpErrorEntry type compatibility
625+
const mappedLevel: "error" | "warn" | "info" | "stdout" = level
628626

629627
connection.server.errorHistory.push({
630628
message: truncatedError,
631629
timestamp: Date.now(),
632-
level: level,
630+
level: mappedLevel,
633631
})
634632

635633
// Keep only the last 100 errors

0 commit comments

Comments
 (0)