Skip to content

Config errors should only surface details in STDIO mode #781

Closed

Description

@dcramer

Problem

Errors like ConfigurationError and LLMProviderError (invalid keys, missing providers, conflicting config) currently show detailed configuration guidance to all users regardless of transport. In the hosted/Cloudflare deployment (mcp.sentry.dev), users have no ability to fix server-side configuration — these messages are confusing and unhelpful. They should see a generic "feature unavailable" message, while the detailed config error is logged server-side for operators.

In STDIO mode, the user controls their own environment, so detailed config messages are appropriate and should be preserved.

Proposed Solution

  1. Add a field to ServerContext that indicates whether the user can fix config issues (e.g., transport: "stdio" | "http" or similar)
  2. Set it in the STDIO entry point (packages/mcp-server/src/index.ts) and Cloudflare entry point (packages/mcp-cloudflare/src/server/lib/mcp-handler.ts)
  3. Update formatErrorForUser() in packages/mcp-core/src/internal/error-handling.ts to accept this context:
    • For ConfigurationError and LLMProviderError in HTTP mode: return generic "Feature Unavailable" message, log details server-side
    • For ConfigurationError and LLMProviderError in STDIO mode: preserve current detailed guidance
    • For APICallError 4xx in HTTP mode: same generic treatment
  4. Pass the context from server.ts tool error catch block into formatErrorForUser()

Key Files

  • packages/mcp-core/src/types.ts — ServerContext (needs transport/environment awareness)
  • packages/mcp-core/src/internal/error-handling.ts — formatErrorForUser() (needs conditional formatting)
  • packages/mcp-core/src/server.ts — tool error catch block (needs to pass context)
  • packages/mcp-server/src/index.ts — STDIO entry point
  • packages/mcp-cloudflare/src/server/lib/mcp-handler.ts — Cloudflare entry point

Acceptance Criteria

  • STDIO users see detailed config error messages (current behavior preserved)
  • HTTP/Cloudflare users see generic "feature unavailable" message for config/provider errors
  • Detailed error info is logged server-side for operators in HTTP mode
  • Tests cover both transport modes

Related to #779

Activity

  1. added a commit that references this issue on Feb 7, 2026
    a74b685
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions