Commit 72f9fc9
committed
fix(mcp): handle URLSearchParams OAuth bodies and copy stream chunks
- toUndiciRequestBody serializes a URLSearchParams body (the MCP SDK's OAuth
token/refresh exchange sends one); undici.request rejects it otherwise.
- Default content-type application/x-www-form-urlencoded when the caller didn't
set one (fetch parity).
- nodeReadableToWebStream enqueues a copy (new Uint8Array(chunk)) not a view, so
undici recycling the pooled source buffer can't corrupt queued chunks.
- Tests for both.1 parent d2e037c commit 72f9fc9
2 files changed
Lines changed: 68 additions & 3 deletions
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
135 | 183 | | |
136 | 184 | | |
137 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
660 | 660 | | |
661 | 661 | | |
662 | 662 | | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
663 | 666 | | |
664 | 667 | | |
665 | 668 | | |
| |||
689 | 692 | | |
690 | 693 | | |
691 | 694 | | |
692 | | - | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
693 | 699 | | |
694 | 700 | | |
695 | 701 | | |
| |||
775 | 781 | | |
776 | 782 | | |
777 | 783 | | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
778 | 795 | | |
779 | 796 | | |
780 | | - | |
781 | | - | |
| 797 | + | |
| 798 | + | |
782 | 799 | | |
783 | 800 | | |
784 | 801 | | |
| |||
0 commit comments