MCPcopy
hub / github.com/claude-code-best/claude-code / logMCPErrorImpl

Function logMCPErrorImpl

src/utils/errorLogSink.ts:183–199  ·  view source on GitHub ↗

* Implementation for logMCPError - writes MCP error to debug log and file.

(serverName: string, error: unknown)

Source from the content-addressed store, hash-verified

181 * Implementation for logMCPError - writes MCP error to debug log and file.
182 */
183function logMCPErrorImpl(serverName: string, error: unknown): void {
184 // Not themed, to avoid having to pipe theme all the way down
185 logForDebugging(`MCP server "${serverName}" ${error}`, { level: 'error' })
186
187 const logFile = getMCPLogsPath(serverName)
188 const errorStr =
189 error instanceof Error ? error.stack || error.message : String(error)
190
191 const errorInfo = {
192 error: errorStr,
193 timestamp: new Date().toISOString(),
194 sessionId: getSessionId(),
195 cwd: getFsImplementation().cwd(),
196 }
197
198 getLogWriter(logFile).write(errorInfo)
199}
200
201/**
202 * Implementation for logMCPDebug - writes MCP debug message to log file.

Callers

nothing calls this directly

Calls 6

getMCPLogsPathFunction · 0.85
getSessionIdFunction · 0.85
getFsImplementationFunction · 0.85
getLogWriterFunction · 0.85
logForDebuggingFunction · 0.70
writeMethod · 0.45

Tested by

no test coverage detected