tiny-http-mcp-server 0.1.54 → 0.1.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/composition.json
CHANGED
|
@@ -64,6 +64,12 @@ make transport decisions without parsing error messages. Legacy HTTP/SSE
|
|
|
64
64
|
reporting ready. Completion failures reject the connection and expose
|
|
65
65
|
`rpcMethod: "notifications/initialized"`; they are not setup transport mismatches.
|
|
66
66
|
|
|
67
|
+
`HttpTransport.closeReason` resolves with the original failure as disposal begins.
|
|
68
|
+
Client requests retain that reason even if session deletion is slow or fails.
|
|
69
|
+
Await `transport.closed` to finish cleanup; its reason reports a deletion failure
|
|
70
|
+
when cleanup fails, otherwise the original reason. Custom transports can expose
|
|
71
|
+
the same optional `closeReason` promise when closing requires asynchronous work.
|
|
72
|
+
|
|
67
73
|
## OAuth HTTP support
|
|
68
74
|
|
|
69
75
|
`HttpTransport` accepts `oauth` options from `mcp-oauth`. When a protected server returns a Bearer `WWW-Authenticate` challenge, the transport discovers protected-resource metadata, loads authorization-server metadata, lets the OAuth provider handle authorization, and retries the request when credentials are available.
|
|
@@ -651,6 +651,8 @@ interface McpTransport {
|
|
|
651
651
|
readable: Readable;
|
|
652
652
|
writable: Writable;
|
|
653
653
|
closed: Promise<McpTransportClosedEvent>;
|
|
654
|
+
/** Primary close reason, available before asynchronous transport cleanup finishes. */
|
|
655
|
+
readonly closeReason?: Promise<Error>;
|
|
654
656
|
dispose(reason?: Error): void;
|
|
655
657
|
filterTools?(tools: Tool[], reset?: boolean): Tool[];
|
|
656
658
|
/** Complete a legacy initialization handshake before the client reports ready. */
|
|
@@ -725,6 +727,8 @@ declare class HttpTransport implements McpTransport {
|
|
|
725
727
|
readonly readable: Readable;
|
|
726
728
|
readonly writable: Writable;
|
|
727
729
|
readonly closed: Promise<McpTransportClosedEvent>;
|
|
730
|
+
readonly closeReason: Promise<Error>;
|
|
731
|
+
private resolveCloseReason;
|
|
728
732
|
private readonly url;
|
|
729
733
|
private readonly mode;
|
|
730
734
|
private legacyEndpoint;
|
|
@@ -6697,9 +6697,13 @@ var McpClient = class {
|
|
|
6697
6697
|
this.currentInstructions = void 0;
|
|
6698
6698
|
this.subscribedResourceUris.clear();
|
|
6699
6699
|
this.activeProgressTokens.clear();
|
|
6700
|
-
const transportClosedReason = transport.closed.then((closedEvent) => closedEvent.reason).catch(
|
|
6700
|
+
const transportClosedReason = (transport.closeReason ?? transport.closed.then((closedEvent) => closedEvent.reason)).catch(
|
|
6701
6701
|
(error) => error instanceof Error ? error : new Error(String(error))
|
|
6702
6702
|
);
|
|
6703
|
+
let primaryCloseReason;
|
|
6704
|
+
void transportClosedReason.then((reason) => {
|
|
6705
|
+
primaryCloseReason = reason;
|
|
6706
|
+
});
|
|
6703
6707
|
const messageLayer = new JsonRpcMessageLayer(
|
|
6704
6708
|
transport.readable,
|
|
6705
6709
|
transport.writable,
|
|
@@ -6816,7 +6820,7 @@ var McpClient = class {
|
|
|
6816
6820
|
if (this.transport !== transport) {
|
|
6817
6821
|
return;
|
|
6818
6822
|
}
|
|
6819
|
-
this.messageLayer?.dispose(closedEvent.reason);
|
|
6823
|
+
this.messageLayer?.dispose(primaryCloseReason ?? closedEvent.reason);
|
|
6820
6824
|
this.messageLayer = null;
|
|
6821
6825
|
this.transport = null;
|
|
6822
6826
|
this.currentState = "closed";
|
|
@@ -7559,6 +7563,8 @@ var HttpTransport = class {
|
|
|
7559
7563
|
readable;
|
|
7560
7564
|
writable;
|
|
7561
7565
|
closed;
|
|
7566
|
+
closeReason;
|
|
7567
|
+
resolveCloseReason;
|
|
7562
7568
|
url;
|
|
7563
7569
|
mode;
|
|
7564
7570
|
legacyEndpoint;
|
|
@@ -7612,6 +7618,9 @@ var HttpTransport = class {
|
|
|
7612
7618
|
});
|
|
7613
7619
|
this.readable = this.readStream;
|
|
7614
7620
|
this.writable = this.writeStream;
|
|
7621
|
+
this.closeReason = new Promise((resolve) => {
|
|
7622
|
+
this.resolveCloseReason = resolve;
|
|
7623
|
+
});
|
|
7615
7624
|
this.closed = new Promise((resolve) => {
|
|
7616
7625
|
this.resolveClosed = resolve;
|
|
7617
7626
|
});
|
|
@@ -7667,6 +7676,8 @@ var HttpTransport = class {
|
|
|
7667
7676
|
this.rejectLegacyEndpoint?.(reason);
|
|
7668
7677
|
this.rejectLegacyEndpoint = void 0;
|
|
7669
7678
|
this.resolveLegacyEndpoint = void 0;
|
|
7679
|
+
this.resolveCloseReason?.(reason);
|
|
7680
|
+
this.resolveCloseReason = void 0;
|
|
7670
7681
|
this.toolParameterHeaders.clear();
|
|
7671
7682
|
this.abortInFlightFetches(reason);
|
|
7672
7683
|
this.cancelOpenResponseReaders();
|