Skip to content

feat(ai-proxy): distinguish MCP connection errors from configuration errors in logs#1440

Open
Scra3 wants to merge 1 commit intomainfrom
feat/ai-proxy-mcp-log-levels
Open

feat(ai-proxy): distinguish MCP connection errors from configuration errors in logs#1440
Scra3 wants to merge 1 commit intomainfrom
feat/ai-proxy-mcp-log-levels

Conversation

@Scra3
Copy link
Member

@Scra3 Scra3 commented Jan 30, 2026

Summary

  • Add error classification to distinguish connection errors from configuration errors in MCP client logs
  • Connection errors (server down, timeout, network issues) are now logged as Warn instead of Error
  • Configuration errors (auth failures, invalid params) remain logged as Error

This reduces log noise when MCP servers are temporarily unavailable, which is a common scenario when customers configure MCP servers but don't remove them when they go down.

Connection error patterns detected:

  • Network errors: ECONNREFUSED, ENOTFOUND, ETIMEDOUT, ECONNRESET, ENETUNREACH, EHOSTUNREACH, EPIPE, ECONNABORTED
  • Fetch errors: fetch failed, socket hang up, network error
  • MCP protocol errors: MCP error -32000 (ConnectionClosed), MCP error -32001 (RequestTimeout)
  • Process errors: spawn ENOENT, spawn EACCES
  • Transient HTTP status codes: 502, 503, 504, 408, 429

Test plan

  • Unit tests added for connection error detection
  • Unit tests added for configuration error detection
  • Unit tests added for mixed error scenarios
  • Parameterized tests covering 10 different connection error patterns
  • Build passes
  • All tests pass
  • Lint passes

🤖 Generated with Claude Code

@qltysh
Copy link

qltysh bot commented Jan 30, 2026

All good ✅

@qltysh
Copy link

qltysh bot commented Jan 30, 2026

Qlty

Coverage Impact

This PR will not change total coverage.

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@Scra3 Scra3 force-pushed the feat/ai-proxy-mcp-log-levels branch from d269629 to edc89f5 Compare January 30, 2026 16:23
…Error

When MCP servers are unreachable (connection refused, DNS not found, timeout,
network unreachable), log as 'Warn' instead of 'Error' to reduce noise.

All other errors (authentication, configuration, protocol errors) remain as 'Error'.

Unreachable error codes: ECONNREFUSED, ENOTFOUND, ETIMEDOUT, ENETUNREACH, EHOSTUNREACH

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Scra3 Scra3 force-pushed the feat/ai-proxy-mcp-log-levels branch from edc89f5 to 9d5c638 Compare January 30, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant