Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/openapi-mcp-server/client/http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,12 @@ export class HttpClient {
}
} catch (error: any) {
if (error.response) {
console.error('Error in http client', error)
// Log safe properties instead of full error to prevent leaking secrets in config/headers
console.error('Error in http client', {
message: error.message,
name: error.name,
status: error.response?.status,
})
const headers = new Headers()
Object.entries(error.response.headers).forEach(([key, value]) => {
if (value) headers.append(key, value.toString())
Expand Down
14 changes: 11 additions & 3 deletions src/openapi-mcp-server/mcp/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,18 @@ export class MCPProxy {
},
],
}
} catch (error) {
console.error('Error in tool call', error)
} catch (error: any) {
// Log safe properties instead of full error to prevent leaking secrets in config/headers
console.error('Error in tool call', {
message: error.message,
name: error.name,
status: error.response?.status || (error instanceof HttpClientError ? error.status : undefined),
})
if (error instanceof HttpClientError) {
console.error('HttpClientError encountered, returning structured error', error)
console.error('HttpClientError encountered, returning structured error', {
message: error.message,
status: error.status,
})
const data = error.data?.response?.data ?? error.data ?? {}
Comment on lines 107 to 112

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This log statement is redundant. The error has already been logged at line 102 with the same information (message, name, and status). Removing this second log will reduce noise in the log stream while still providing the necessary diagnostic information.

        if (error instanceof HttpClientError) {
          const data = error.data?.response?.data ?? error.data ?? {}

return {
content: [
Expand Down