avancement planning
This commit is contained in:
+17
-3
@@ -1,5 +1,19 @@
|
||||
import { JSONRPCMessage, MessageExtraInfo, RequestId } from "../types.js";
|
||||
import { JSONRPCMessage, MessageExtraInfo, RequestId } from '../types.js';
|
||||
export type FetchLike = (url: string | URL, init?: RequestInit) => Promise<Response>;
|
||||
/**
|
||||
* Normalizes HeadersInit to a plain Record<string, string> for manipulation.
|
||||
* Handles Headers objects, arrays of tuples, and plain objects.
|
||||
*/
|
||||
export declare function normalizeHeaders(headers: HeadersInit | undefined): Record<string, string>;
|
||||
/**
|
||||
* Creates a fetch function that includes base RequestInit options.
|
||||
* This ensures requests inherit settings like credentials, mode, headers, etc. from the base init.
|
||||
*
|
||||
* @param baseFetch - The base fetch function to wrap (defaults to global fetch)
|
||||
* @param baseInit - The base RequestInit to merge with each request
|
||||
* @returns A wrapped fetch function that merges base options with call-specific options
|
||||
*/
|
||||
export declare function createFetchWithInit(baseFetch?: FetchLike, baseInit?: RequestInit): FetchLike;
|
||||
/**
|
||||
* Options for sending a JSON-RPC message.
|
||||
*/
|
||||
@@ -22,7 +36,7 @@ export type TransportSendOptions = {
|
||||
onresumptiontoken?: (token: string) => void;
|
||||
};
|
||||
/**
|
||||
* Describes the minimal contract for a MCP transport that a client or server can communicate over.
|
||||
* Describes the minimal contract for an MCP transport that a client or server can communicate over.
|
||||
*/
|
||||
export interface Transport {
|
||||
/**
|
||||
@@ -62,7 +76,7 @@ export interface Transport {
|
||||
*
|
||||
* The requestInfo can be used to get the original request information (headers, etc.)
|
||||
*/
|
||||
onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void;
|
||||
onmessage?: <T extends JSONRPCMessage>(message: T, extra?: MessageExtraInfo) => void;
|
||||
/**
|
||||
* The session ID generated for this connection.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user