Skip to content

fix: surface MCP proxy HTTP errors - #86

Open
RaphaelKhalid wants to merge 1 commit into
amp-labs:mainfrom
RaphaelKhalid:fix/mcp-send-request-errors
Open

RaphaelKhalid wants to merge 1 commit into
amp-labs:mainfrom
RaphaelKhalid:fix/mcp-send-request-errors

Conversation

@RaphaelKhalid

Copy link
Copy Markdown

Summary

  • Route the public MCP send-request tool through the existing callAmpersandProxy helper.
  • Surface JSON 4xx and 5xx proxy responses as MCP errors.
  • Preserve the successful response format and add regression coverage for both paths.

Motivation

The current MCP handler parses any JSON proxy response and returns API call successful, even when the proxy returns a non-2xx status. This makes an upstream failure look like a successful tool invocation to an MCP client or agent. The shared helper already checks response.ok and throws with the status, so this change removes the duplicated request path and aligns MCP behavior with the AI SDK and Mastra adapters.

Related: #40

Testing

  • TypeScript type-check passes.
  • Targeted ESLint passes for the changed adapter.
  • Rebuilt-handler smoke test passes for JSON 502 error classification and unchanged 200 success output.
  • git diff --check passes.
  • The repository build emits the bundles but exits during declaration generation with the existing API Extractor error Unable to follow symbol for "InferPublicSchema" under the workspace's current dependency resolution. Bun is not available in the environment, so the Bun integration suite could not be run locally.

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