(request: NextRequest)
| 128 | } |
| 129 | |
| 130 | async function readJsonRpcBody(request: NextRequest): Promise<unknown> { |
| 131 | assertContentLengthWithinLimit(request.headers, MAX_MCP_SERVE_BODY_BYTES, 'MCP request body') |
| 132 | const buffer = await readStreamToBufferWithLimit(request.body, { |
| 133 | maxBytes: MAX_MCP_SERVE_BODY_BYTES, |
| 134 | label: 'MCP request body', |
| 135 | signal: request.signal, |
| 136 | }) |
| 137 | return JSON.parse(buffer.toString('utf-8')) |
| 138 | } |
| 139 | |
| 140 | interface ManagedAbortSignal { |
| 141 | signal: AbortSignal |
no test coverage detected