Skip to content

Conversation

aayush-kapoor
Copy link
Contributor

Background

The JSONRPC spec (for MCP) has a data field which is important for doing x402 over mcp
The AI-SDK didn't expose error.data, only error.message

Summary

added the data property to the MCPClientError to capture the error.data from the response

Manual Verification

Added unit test

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • Formatting issues have been fixed (run pnpm prettier-fix in the project root)

Related Issues

Fixes #9248

@aayush-kapoor aayush-kapoor marked this pull request as draft October 8, 2025 22:45
@aayush-kapoor aayush-kapoor marked this pull request as ready for review October 8, 2025 22:45
@aayush-kapoor aayush-kapoor merged commit bb10a89 into main Oct 9, 2025
11 checks passed
@aayush-kapoor aayush-kapoor deleted the aayush/mcp-error branch October 9, 2025 14:28
@vercel-ai-sdk vercel-ai-sdk bot removed the backport label Oct 9, 2025
@vercel-ai-sdk
Copy link
Contributor

vercel-ai-sdk bot commented Oct 9, 2025

✅ Backport PR created: #9335

aayush-kapoor added a commit that referenced this pull request Oct 9, 2025
…compliant (#9335)

This is an automated backport of #9249 to the release-v5.0 branch.

Co-authored-by: Aayush Kapoor <[email protected]>
vercel-ai-sdk bot pushed a commit that referenced this pull request Oct 9, 2025
…9249)

## Background

The JSONRPC spec (for MCP) has a `data` field which is important for
doing [x402 over
mcp](https://github.com/coinbase/x402/blob/main/specs/transports/mcp.md#payment-required-signaling)
The AI-SDK didn't expose `error.data`, only `error.message`

## Summary

added the `data` property to the MCPClientError to capture the
`error.data` from the response

## Manual Verification

Added unit test

## Checklist

- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] Formatting issues have been fixed (run `pnpm prettier-fix` in the
project root)

## Related Issues

Fixes #9248
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.

JSONRPC spec for MCP errors

2 participants