(
url: string | URL,
init: { readonly bearer?: string; readonly sessionId?: string; readonly body: unknown },
)
| 61 | }; |
| 62 | |
| 63 | const mcpPost = ( |
| 64 | url: string | URL, |
| 65 | init: { readonly bearer?: string; readonly sessionId?: string; readonly body: unknown }, |
| 66 | ): Promise<Response> => |
| 67 | fetch(url, { |
| 68 | method: "POST", |
| 69 | headers: { |
| 70 | accept: JSON_AND_SSE, |
| 71 | "content-type": "application/json", |
| 72 | ...(init.bearer ? { authorization: `Bearer ${init.bearer}` } : {}), |
| 73 | ...(init.sessionId ? { "mcp-session-id": init.sessionId } : {}), |
| 74 | }, |
| 75 | body: JSON.stringify(init.body), |
| 76 | }); |
| 77 | |
| 78 | /** initialize → session id (asserted present) → notifications/initialized. */ |
| 79 | const openSession = async (mcpUrl: string, bearer: string): Promise<string> => { |
no test coverage detected