Uh oh!
There was an error while loading. Please reload this page.
Make McpAgent extend Agent + Streaming HTTP protocol features - #415
Conversation
🦋 Changeset detectedLatest commit: 4e1794f The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| * @returns An error response object with status code and message | ||
| */ | ||
| onError(error: Error): { status: number; message: string } { | ||
| onMcpError(error: Error): { status: number; message: string } { |
There was a problem hiding this comment.
This seems to be a breaking change. The old McpAgent had a custom onError method that clashes with the base Agent method with the same name once we extend it.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
commit: |
whoiskatrin
commented
Aug 27, 2025
this is some really good stuff! @deathbyknowledge great work |
threepointone
left a comment
There was a problem hiding this comment.
tentative approval pending nits and notes
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| onmessage?: (message: JSONRPCMessage) => void; | ||
| sessionId?: string; | ||
| async setInitialized() { | ||
| await this.ctx.storage.put("initialized", true); |
There was a problem hiding this comment.
| awaitthis.ctx.storage.put("initialized",true); | |
| // todo: move to sync api once https://github.com/cloudflare/workerd/pull/4895 lands | |
| awaitthis.ctx.storage.put("initialized",true); |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
c26e919 to
969371cComparekentcdodds
commented
Sep 9, 2025
How confident are we that this is going to be merged? Can I safely prepare teaching material based on this PR? |
deathbyknowledge
commented
Sep 9, 2025
We're waiting to release the AI SDK v5 changes to merge this. Should land this week |
kentcdodds
commented
Sep 9, 2025
That is helpful context. Do you have an idea/recommendation for getting:
I know that the |
deathbyknowledge
commented
Sep 9, 2025
The comment I left here #426 (comment) should cover all of those |
kentcdodds
commented
Sep 9, 2025
Just saw your message on my PR: #426 (comment) Thanks for that! So I take it from your message that it is fine/encouraged/recommended for me to modify |
deathbyknowledge
commented
Sep 9, 2025
It is fine in the context of |
kentcdodds
commented
Sep 9, 2025
Sounds good. Thank you for your help! |
kentcdodds
commented
Sep 9, 2025
deathbyknowledge
commented
Sep 9, 2025
That still needs to be thought out, it might not be directly though an |
kentcdodds
commented
Sep 10, 2025
That's fine. Just my 2¢, I think it would be good for the ecosystem if Cloudflare's implementation either supported the full TypeScript SDK (preferred) or built its own. Supporting part of the SDK will lead to confusion for folks I think. |
Uh oh!
There was an error while loading. Please reload this page.
remorses
commented
Sep 11, 2025
LFG |

Lib changes:
McpAgentnow extends the baseAgentclass extend McpAgent from Agent #235Agentand PartykitServerprimitives. Depends on Allow routing ctx props to Server partykit#268Tests:
@modelcontextprotocol/sdk. They include authless and OAuth MCP examples.Streamable HTTP changes adapted from the TS SDK
Run the E2E from
/packages/agentswith