@chrischall/mcp-utils 2.15.1 → 3.0.0
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/README.md +493 -26
- package/dist/auth/index.d.ts +25 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +105 -14
- package/dist/auth/index.js.map +1 -1
- package/dist/config/index.d.ts +13 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +3 -2
- package/dist/config/index.js.map +1 -1
- package/dist/dates/index.d.ts +45 -5
- package/dist/dates/index.d.ts.map +1 -1
- package/dist/dates/index.js +64 -6
- package/dist/dates/index.js.map +1 -1
- package/dist/errors/index.d.ts +121 -7
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +154 -9
- package/dist/errors/index.js.map +1 -1
- package/dist/fs/output.d.ts +25 -8
- package/dist/fs/output.d.ts.map +1 -1
- package/dist/fs/output.js +27 -5
- package/dist/fs/output.js.map +1 -1
- package/dist/graphql/client.d.ts +8 -1
- package/dist/graphql/client.d.ts.map +1 -1
- package/dist/graphql/client.js +11 -3
- package/dist/graphql/client.js.map +1 -1
- package/dist/healthcheck/index.d.ts +11 -9
- package/dist/healthcheck/index.d.ts.map +1 -1
- package/dist/healthcheck/index.js +39 -23
- package/dist/healthcheck/index.js.map +1 -1
- package/dist/http/body-limit.d.ts +37 -0
- package/dist/http/body-limit.d.ts.map +1 -0
- package/dist/http/body-limit.js +86 -0
- package/dist/http/body-limit.js.map +1 -0
- package/dist/http/fetch-bounded.d.ts +91 -0
- package/dist/http/fetch-bounded.d.ts.map +1 -0
- package/dist/http/fetch-bounded.js +138 -0
- package/dist/http/fetch-bounded.js.map +1 -0
- package/dist/http/index.d.ts +231 -6
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +432 -56
- package/dist/http/index.js.map +1 -1
- package/dist/http/response-cache.d.ts +36 -3
- package/dist/http/response-cache.d.ts.map +1 -1
- package/dist/http/response-cache.js +84 -8
- package/dist/http/response-cache.js.map +1 -1
- package/dist/http/throttle.d.ts +37 -4
- package/dist/http/throttle.d.ts.map +1 -1
- package/dist/http/throttle.js +65 -6
- package/dist/http/throttle.js.map +1 -1
- package/dist/http/url-safety.d.ts +142 -0
- package/dist/http/url-safety.d.ts.map +1 -0
- package/dist/http/url-safety.js +211 -0
- package/dist/http/url-safety.js.map +1 -0
- package/dist/netguard/index.d.ts +196 -0
- package/dist/netguard/index.d.ts.map +1 -0
- package/dist/netguard/index.js +365 -0
- package/dist/netguard/index.js.map +1 -0
- package/dist/server/confirm-env.d.ts +17 -8
- package/dist/server/confirm-env.d.ts.map +1 -1
- package/dist/server/confirm-env.js +22 -13
- package/dist/server/confirm-env.js.map +1 -1
- package/dist/server/confirm-write.js +1 -1
- package/dist/server/confirm-write.js.map +1 -1
- package/dist/server/index.d.ts +6 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +24 -9
- package/dist/server/index.js.map +1 -1
- package/dist/session/index.d.ts +6 -0
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +12 -1
- package/dist/session/index.js.map +1 -1
- package/dist/zod/index.d.ts +6 -0
- package/dist/zod/index.d.ts.map +1 -1
- package/dist/zod/index.js +8 -1
- package/dist/zod/index.js.map +1 -1
- package/package.json +10 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `fetchBounded` — one bounded `fetch` for the clients that cannot use
|
|
3
|
+
* {@link createApiClient}.
|
|
4
|
+
*
|
|
5
|
+
* Fleet audit 2026-09, cluster 1: about twenty servers call `fetch` bare —
|
|
6
|
+
* cookie scrapers, multi-host clients, HTML/RSC readers and file downloads,
|
|
7
|
+
* none of which fit a single-base bearer client. Each one hand-rolled (or
|
|
8
|
+
* forgot) the same four things, and the audit found every combination
|
|
9
|
+
* missing: no timeout (a hung upstream holds the tool call until the host
|
|
10
|
+
* kills it), no cancellation (a cancelled call keeps its request in flight),
|
|
11
|
+
* a timeout that stops at the headers (a body that stalls afterwards is
|
|
12
|
+
* unbounded — #534, #584, #783), and no size cap (#989 and #1026 buffer
|
|
13
|
+
* whole downloads into memory).
|
|
14
|
+
*
|
|
15
|
+
* `createApiClient` already had every piece internally; this exports them as
|
|
16
|
+
* one call:
|
|
17
|
+
* - a timer (default {@link DEFAULT_REQUEST_TIMEOUT_MS}, 30 s) that stays
|
|
18
|
+
* armed until the body has been read, raced rather than trusted to the
|
|
19
|
+
* stream, so a custom `fetchImpl` whose body ignores the abort is bounded
|
|
20
|
+
* too;
|
|
21
|
+
* - the caller's cancellation — `init.signal` and the ambient tool-call
|
|
22
|
+
* signal ({@link currentCallSignal}) — folded in, either one firing aborts;
|
|
23
|
+
* - an optional `maxBytes` cap, checked against `Content-Length` before any
|
|
24
|
+
* read and counted while streaming;
|
|
25
|
+
* - a typed body read (`text`, `json`, `bytes`, or `none`).
|
|
26
|
+
*
|
|
27
|
+
* It does NOT judge the status: a 404 or a 500 comes back like a 200, body
|
|
28
|
+
* read and bounded, because these clients each have their own idea of what a
|
|
29
|
+
* non-2xx means (a login redirect, an edge block, a soft miss).
|
|
30
|
+
*/
|
|
31
|
+
import { withAmbientCancellation } from '../cancel/index.js';
|
|
32
|
+
import { McpToolError } from '../errors/index.js';
|
|
33
|
+
import { cancelStream, readBytesCapped, ResponseTooLargeError } from './body-limit.js';
|
|
34
|
+
import { DEFAULT_REQUEST_TIMEOUT_MS, RequestTimeoutError } from './index.js';
|
|
35
|
+
// The cap and its error are shared with `createApiClient` (`body-limit.ts`).
|
|
36
|
+
export { ResponseTooLargeError };
|
|
37
|
+
/**
|
|
38
|
+
* `fetch` with a timeout that covers the body read, the caller's
|
|
39
|
+
* cancellation (`init.signal` + the ambient tool-call signal), an optional
|
|
40
|
+
* byte cap, and a typed body read. See the module header for why.
|
|
41
|
+
*
|
|
42
|
+
* Errors: {@link RequestTimeoutError} when the timer fires; the caller's own
|
|
43
|
+
* abort reason (as an `Error`) when the caller cancels;
|
|
44
|
+
* {@link ResponseTooLargeError} over `maxBytes`; an {@link McpToolError} for
|
|
45
|
+
* unparseable JSON; anything else `fetch` throws, unchanged.
|
|
46
|
+
*/
|
|
47
|
+
export async function fetchBounded(url, init, opts = {}) {
|
|
48
|
+
const doFetch = opts.fetchImpl ?? fetch;
|
|
49
|
+
const service = opts.service ?? hostOf(url);
|
|
50
|
+
const read = opts.read ?? 'text';
|
|
51
|
+
const timeoutMs = opts.timeoutMs === false ? 0 : (opts.timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS);
|
|
52
|
+
// The caller's side: its own signal and the ambient tool-call signal.
|
|
53
|
+
const caller = withAmbientCancellation(init?.signal ?? undefined);
|
|
54
|
+
if (caller?.aborted)
|
|
55
|
+
throw reasonOf(caller);
|
|
56
|
+
const timer = timeoutMs > 0 ? new AbortController() : undefined;
|
|
57
|
+
const signal = combine(timer?.signal, caller);
|
|
58
|
+
let handle;
|
|
59
|
+
let detach = () => { };
|
|
60
|
+
// Rejects the moment either side gives up; raced against every await.
|
|
61
|
+
const stop = signal
|
|
62
|
+
? new Promise((_resolve, reject) => {
|
|
63
|
+
const onAbort = () => reject(timer?.signal.aborted ? new RequestTimeoutError(service, timeoutMs) : reasonOf(caller));
|
|
64
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
65
|
+
detach = () => signal.removeEventListener('abort', onAbort);
|
|
66
|
+
})
|
|
67
|
+
: undefined;
|
|
68
|
+
stop?.catch(() => { });
|
|
69
|
+
const bounded = (p) => (stop ? Promise.race([p, stop]) : p);
|
|
70
|
+
if (timer)
|
|
71
|
+
handle = setTimeout(() => timer.abort(), timeoutMs);
|
|
72
|
+
try {
|
|
73
|
+
let res;
|
|
74
|
+
try {
|
|
75
|
+
res = await bounded(doFetch(url, { ...init, ...(signal ? { signal } : {}) }));
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
// An abort surfaces from fetch as an AbortError whichever side caused
|
|
79
|
+
// it; name it by WHICH side fired, so a caller's cancellation is never
|
|
80
|
+
// reported as this upstream timing out.
|
|
81
|
+
if (timer?.signal.aborted)
|
|
82
|
+
throw new RequestTimeoutError(service, timeoutMs);
|
|
83
|
+
if (caller?.aborted)
|
|
84
|
+
throw reasonOf(caller);
|
|
85
|
+
throw err;
|
|
86
|
+
}
|
|
87
|
+
if (read === 'none') {
|
|
88
|
+
cancelStream(res.body);
|
|
89
|
+
return done(res, undefined);
|
|
90
|
+
}
|
|
91
|
+
const bytes = await readBytesCapped(res, opts.maxBytes, service, bounded);
|
|
92
|
+
if (read === 'bytes')
|
|
93
|
+
return done(res, bytes);
|
|
94
|
+
const text = new TextDecoder().decode(bytes);
|
|
95
|
+
if (read === 'text')
|
|
96
|
+
return done(res, text);
|
|
97
|
+
if (text.length === 0)
|
|
98
|
+
return done(res, undefined);
|
|
99
|
+
try {
|
|
100
|
+
return done(res, JSON.parse(text));
|
|
101
|
+
}
|
|
102
|
+
catch (cause) {
|
|
103
|
+
const type = res.headers.get('content-type') ?? 'no content-type';
|
|
104
|
+
throw new McpToolError(`${service} returned a non-JSON response (HTTP ${res.status}, ${type}).`, {
|
|
105
|
+
hint: 'The upstream may have served an error or sign-in page instead of data.',
|
|
106
|
+
cause,
|
|
107
|
+
status: res.status,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
clearTimeout(handle);
|
|
113
|
+
detach();
|
|
114
|
+
}
|
|
115
|
+
function done(res, body) {
|
|
116
|
+
return { res, status: res.status, ok: res.ok, headers: res.headers, body: body };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/** One signal for "either fired", or whichever exists. */
|
|
120
|
+
function combine(a, b) {
|
|
121
|
+
if (a && b)
|
|
122
|
+
return AbortSignal.any([a, b]);
|
|
123
|
+
return a ?? b;
|
|
124
|
+
}
|
|
125
|
+
/** The signal's own reason as an Error, as `throwIfCancelled` reports it. */
|
|
126
|
+
function reasonOf(signal) {
|
|
127
|
+
const reason = signal.reason;
|
|
128
|
+
return reason instanceof Error ? reason : new Error(String(reason));
|
|
129
|
+
}
|
|
130
|
+
function hostOf(url) {
|
|
131
|
+
try {
|
|
132
|
+
return new URL(url).host;
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
return String(url);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=fetch-bounded.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-bounded.js","sourceRoot":"","sources":["../../src/http/fetch-bounded.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AA2D7E,6EAA6E;AAC7E,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,GAAiB,EACjB,IAAkB,EAClB,IAAI,GAA2B,EAAE;IAEjC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC;IACxC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAgB,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC;IAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,0BAA0B,CAAC,CAAC;IAEhG,sEAAsE;IACtE,MAAM,MAAM,GAAG,uBAAuB,CAAC,IAAI,EAAE,MAA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AiB;IAC/B,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;AACH,CAAC"}
|
package/dist/http/index.d.ts
CHANGED
|
@@ -16,9 +16,13 @@
|
|
|
16
16
|
* - {@link createApiClient} never embeds the token in a thrown message; a 401
|
|
17
17
|
* yields a fixed "unauthorized" string, not the credential.
|
|
18
18
|
*/
|
|
19
|
+
import { McpToolError } from '../errors/index.js';
|
|
20
|
+
import type { ExpectedJsonShape, McpToolErrorKind } from '../errors/index.js';
|
|
19
21
|
export * from './throttle.js';
|
|
20
22
|
export * from './response-cache.js';
|
|
21
23
|
export * from './net-atoms.js';
|
|
24
|
+
export * from './fetch-bounded.js';
|
|
25
|
+
export * from './url-safety.js';
|
|
22
26
|
/** Retry policy for transient responses (HTTP 429 by default). */
|
|
23
27
|
export interface RetryPolicy {
|
|
24
28
|
/** Number of retries after the initial attempt. The fleet default is 1. */
|
|
@@ -128,10 +132,75 @@ export interface ApiClientOptions {
|
|
|
128
132
|
* bounded by an {@link AbortController} — from the request until its body
|
|
129
133
|
* has been read, so a body that stalls after the headers is bounded too; on
|
|
130
134
|
* expiry it throws a {@link RequestTimeoutError} instead of hanging until the
|
|
131
|
-
* host kills the tool call
|
|
132
|
-
*
|
|
135
|
+
* host kills the tool call (a {@link WriteOutcomeUnknownError} for a sent
|
|
136
|
+
* write — see {@link writeOutcomeUnknown}). A 429 retry gets a fresh timeout.
|
|
137
|
+
*
|
|
138
|
+
* Defaults to {@link DEFAULT_REQUEST_TIMEOUT_MS} (30 s), matching
|
|
139
|
+
* `createGraphqlClient`. Before 2.16 the default was unbounded, and the
|
|
140
|
+
* clients that never passed one (gemini, simplisafe, tripadvisor's web
|
|
141
|
+
* client — fleet audit 2026-09, cluster 1) held a tool call open on a hung
|
|
142
|
+
* upstream until the host killed it. Pass `0` or `false` to disable — the
|
|
143
|
+
* caller's cancellation still applies either way. A download that
|
|
144
|
+
* legitimately takes longer passes a larger value.
|
|
133
145
|
*/
|
|
134
|
-
timeout?: number;
|
|
146
|
+
timeout?: number | false;
|
|
147
|
+
/**
|
|
148
|
+
* How redirects are handled. Omitted (the default) leaves `fetch`'s own
|
|
149
|
+
* behaviour unchanged: it follows them, re-sending the credential to
|
|
150
|
+
* wherever they point. `'manual'` and `'error'` are passed straight to
|
|
151
|
+
* `fetch`.
|
|
152
|
+
*
|
|
153
|
+
* `'same-origin'` follows redirects itself (`fetch` is called with
|
|
154
|
+
* `redirect: 'manual'`) and re-checks every `Location` against the base
|
|
155
|
+
* origin BEFORE re-sending: a hop to another origin, a scheme downgrade or
|
|
156
|
+
* a hop that adds userinfo throws {@link RedirectRefusedError} and nothing
|
|
157
|
+
* is sent to it (fleet audit 2026-09, cluster 6: accessoticketing #322,
|
|
158
|
+
* thumbtack #768). A 303, or a 301/302 answering a POST, becomes a
|
|
159
|
+
* body-less GET; 307/308 keep the method and body. Needs a server-side
|
|
160
|
+
* `fetch` (Node/undici) that exposes the 3xx and its `Location`.
|
|
161
|
+
*/
|
|
162
|
+
redirect?: 'same-origin' | 'manual' | 'error' | 'follow';
|
|
163
|
+
/**
|
|
164
|
+
* With `redirect: 'same-origin'`, the most hops followed per request.
|
|
165
|
+
* Default 5. Must be a non-negative integer (a `TypeError` otherwise).
|
|
166
|
+
*/
|
|
167
|
+
maxRedirects?: number;
|
|
168
|
+
/**
|
|
169
|
+
* Report a write whose outcome is unknown as such. On (the default), a
|
|
170
|
+
* request whose method is not safe (anything but GET / HEAD / OPTIONS /
|
|
171
|
+
* TRACE) that was SENT but timed out, lost its connection, or broke off
|
|
172
|
+
* while its response body was read throws {@link WriteOutcomeUnknownError}
|
|
173
|
+
* instead of a plain {@link RequestTimeoutError} or `fetch`'s raw
|
|
174
|
+
* `TypeError` — both of which read as "safe to retry", and the model
|
|
175
|
+
* re-sent the email or booking (fleet audit 2026-09, cluster 7). Mirrors
|
|
176
|
+
* `createGraphqlClient`'s `outcomeUnknown`. Pass `false` to keep the plain
|
|
177
|
+
* errors for every request; {@link RequestOptions.idempotent} does it for
|
|
178
|
+
* one (a search sent as POST).
|
|
179
|
+
*/
|
|
180
|
+
writeOutcomeUnknown?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* The `hint` on a {@link WriteOutcomeUnknownError}, e.g. to name the read
|
|
183
|
+
* tool that checks whether the write landed. Defaults to
|
|
184
|
+
* {@link DEFAULT_WRITE_OUTCOME_HINT}.
|
|
185
|
+
*/
|
|
186
|
+
writeOutcomeHint?: string;
|
|
187
|
+
/**
|
|
188
|
+
* Default byte cap on every response body this client reads, overridden per
|
|
189
|
+
* call by {@link RequestOptions.maxBytes}. A `Content-Length` over it is
|
|
190
|
+
* refused before reading; a body that grows past it is cancelled mid-stream.
|
|
191
|
+
* Either way {@link ResponseTooLargeError} (`kind: 'too_large'`), which never
|
|
192
|
+
* echoes the body — except on an error status, where the status error
|
|
193
|
+
* still throws and an over-cap body is dropped (see
|
|
194
|
+
* {@link RequestOptions.maxBytes}). Omitted (the default), bodies are
|
|
195
|
+
* unlimited, as before.
|
|
196
|
+
* Must be a non-negative number (a `TypeError` otherwise); `Infinity` is
|
|
197
|
+
* the same as omitting it.
|
|
198
|
+
*
|
|
199
|
+
* Fleet audit 2026-09 (#733): `fetchRaw` buffered whole downloads — a
|
|
200
|
+
* splitwise receipt, then base64-encoded — with no cap. Same implementation
|
|
201
|
+
* as {@link fetchBounded}'s `maxBytes`.
|
|
202
|
+
*/
|
|
203
|
+
maxResponseBytes?: number;
|
|
135
204
|
}
|
|
136
205
|
/**
|
|
137
206
|
* What {@link ApiClientOptions.onRateLimited} is told about the 429 that
|
|
@@ -198,13 +267,46 @@ export interface RequestOptions {
|
|
|
198
267
|
headers?: Record<string, string>;
|
|
199
268
|
/** Query params appended via {@link buildQueryString} when present. */
|
|
200
269
|
query?: Record<string, unknown>;
|
|
270
|
+
/**
|
|
271
|
+
* `fetchJson` only: the JSON shape the body must have. When set, a `null`,
|
|
272
|
+
* a scalar, the other container, an empty body or a 204 throws
|
|
273
|
+
* {@link UpstreamFormatError} instead of being returned. Omitted (the
|
|
274
|
+
* default), any valid JSON is returned and an empty body or 204 resolves
|
|
275
|
+
* `undefined`, exactly as before. Never sent upstream; `fetchHtml` and
|
|
276
|
+
* `fetchRaw` ignore it. Shape validation beyond the container kind belongs
|
|
277
|
+
* to `parseLenient`.
|
|
278
|
+
*/
|
|
279
|
+
expect?: ExpectedJsonShape;
|
|
280
|
+
/**
|
|
281
|
+
* This request is safe to repeat even though its method is not (a search or
|
|
282
|
+
* lookup sent as POST): a timeout or dropped connection then throws the
|
|
283
|
+
* plain {@link RequestTimeoutError} / `fetch` error, as a read does, never
|
|
284
|
+
* {@link WriteOutcomeUnknownError}. Never sent upstream.
|
|
285
|
+
*/
|
|
286
|
+
idempotent?: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Largest response body, in bytes, this call will read; overrides the
|
|
289
|
+
* client's {@link ApiClientOptions.maxResponseBytes} (larger or smaller).
|
|
290
|
+
* Over it: {@link ResponseTooLargeError}, refused on `Content-Length`
|
|
291
|
+
* before reading or cancelled mid-stream. The timeout still covers the
|
|
292
|
+
* whole read. A non-2xx whose error body is over the cap still throws its
|
|
293
|
+
* {@link ApiError}, with the body dropped; a 401 / 429 body (read only to
|
|
294
|
+
* spot an edge refusal page) is capped the same way, and over the cap is
|
|
295
|
+
* treated as no page, so {@link UnauthorizedError} /
|
|
296
|
+
* {@link RateLimitedError} (or the hooks' errors) still throw. Must be a non-negative number (a
|
|
297
|
+
* `TypeError` otherwise). Never sent upstream.
|
|
298
|
+
*/
|
|
299
|
+
maxBytes?: number;
|
|
201
300
|
}
|
|
202
301
|
/** The minimal client surface returned by {@link createApiClient}. */
|
|
203
302
|
export interface ApiClient {
|
|
204
303
|
/**
|
|
205
304
|
* Authenticated JSON request. Returns the parsed body, or `undefined` for a
|
|
206
305
|
* 204 / empty body. Throws on 401 (unauthorized), exhausted-429, and other
|
|
207
|
-
* non-2xx responses (with a redacted, truncated message).
|
|
306
|
+
* non-2xx responses (with a redacted, truncated message). A 2xx body is read
|
|
307
|
+
* by {@link parseJsonBody}: a non-JSON body throws {@link UpstreamFormatError}
|
|
308
|
+
* (or {@link EdgeBlockedError} for a CDN challenge), and `opts.expect`
|
|
309
|
+
* rejects a body of the wrong shape the same way.
|
|
208
310
|
*/
|
|
209
311
|
fetchJson: <T = unknown>(method: string, path: string, opts?: RequestOptions) => Promise<T>;
|
|
210
312
|
/** Authenticated request returning the raw response body as text (e.g. HTML scrapes). */
|
|
@@ -230,9 +332,24 @@ export interface RawApiResponse {
|
|
|
230
332
|
/** The response body bytes. */
|
|
231
333
|
bytes: Uint8Array;
|
|
232
334
|
}
|
|
233
|
-
/**
|
|
335
|
+
/**
|
|
336
|
+
* The per-attempt timeout {@link createApiClient} (and {@link fetchBounded})
|
|
337
|
+
* apply when the caller names none: 30 s, the same budget
|
|
338
|
+
* `createGraphqlClient` has always used, so every fleet transport bounds a
|
|
339
|
+
* hung upstream the same way.
|
|
340
|
+
*/
|
|
341
|
+
export declare const DEFAULT_REQUEST_TIMEOUT_MS = 30000;
|
|
342
|
+
/** Default hop limit for `createApiClient({ redirect: 'same-origin' })`. */
|
|
343
|
+
export declare const DEFAULT_MAX_REDIRECTS = 5;
|
|
344
|
+
/**
|
|
345
|
+
* Thrown for an upstream 401. Carries the status so callers can trigger a
|
|
346
|
+
* re-auth, and `kind: 'credential_rejected'` (an `McpToolErrorKind`) so a
|
|
347
|
+
* classifier reads it without matching the message.
|
|
348
|
+
*/
|
|
234
349
|
export declare class UnauthorizedError extends Error {
|
|
235
350
|
readonly status = 401;
|
|
351
|
+
/** Always `'credential_rejected'` unless a subclass says otherwise. */
|
|
352
|
+
readonly kind: McpToolErrorKind;
|
|
236
353
|
constructor(service: string);
|
|
237
354
|
}
|
|
238
355
|
/**
|
|
@@ -242,14 +359,56 @@ export declare class UnauthorizedError extends Error {
|
|
|
242
359
|
*/
|
|
243
360
|
export declare class RateLimitedError extends Error {
|
|
244
361
|
readonly status = 429;
|
|
362
|
+
/** `'http'`: the far side answered, with a 429 (see `status`). */
|
|
363
|
+
readonly kind: McpToolErrorKind;
|
|
245
364
|
readonly retryAfterMs: number | undefined;
|
|
246
365
|
constructor(service: string, retryAfterMs?: number);
|
|
247
366
|
}
|
|
248
|
-
/** Thrown when a request exceeds {@link ApiClientOptions.timeout}. */
|
|
367
|
+
/** Thrown when a request exceeds {@link ApiClientOptions.timeout}. Its `kind` is `'timeout'`. */
|
|
249
368
|
export declare class RequestTimeoutError extends Error {
|
|
250
369
|
readonly timeoutMs: number;
|
|
370
|
+
/** Always `'timeout'` unless a subclass says otherwise. */
|
|
371
|
+
readonly kind: McpToolErrorKind;
|
|
251
372
|
constructor(service: string, timeoutMs: number);
|
|
252
373
|
}
|
|
374
|
+
/** The default `hint` on a {@link WriteOutcomeUnknownError}. */
|
|
375
|
+
export declare const DEFAULT_WRITE_OUTCOME_HINT = "The write may have happened \u2014 check before retrying; do not resend blindly.";
|
|
376
|
+
/**
|
|
377
|
+
* A write (a request whose method is not safe) was SENT, but no usable
|
|
378
|
+
* response came back: it timed out, the connection dropped, or the response
|
|
379
|
+
* body broke off. The server may already have committed it, so the outcome is
|
|
380
|
+
* UNKNOWN, and re-sending it blindly can duplicate an email, a booking or a
|
|
381
|
+
* payment (fleet audit 2026-09, cluster 7: opentable #632, honeybook #1023,
|
|
382
|
+
* office-outlook #1073, vibo #1135, untappd #1132).
|
|
383
|
+
*
|
|
384
|
+
* An {@link McpToolError}, so its {@link McpToolError.hint} ("check before
|
|
385
|
+
* retrying") reaches the model through `wrapToolError` / `errorResult`. It
|
|
386
|
+
* still DECLARES a timeout when one caused it (`timedOut: true`, the marker
|
|
387
|
+
* `isTimeoutError` reads), but carries `retrySafe: false`, so
|
|
388
|
+
* `retryOnceOnTimeout` never replays it. Mirrors `GraphqlTransportError`'s
|
|
389
|
+
* `outcomeUnknown` and fetchproxy's `FetchproxyTimeoutError.retrySafe`.
|
|
390
|
+
*
|
|
391
|
+
* Thrown by {@link createApiClient} (see
|
|
392
|
+
* {@link ApiClientOptions.writeOutcomeUnknown}); exported so a hand-rolled
|
|
393
|
+
* client can throw the same thing.
|
|
394
|
+
*/
|
|
395
|
+
export declare class WriteOutcomeUnknownError extends McpToolError {
|
|
396
|
+
/** Always `true`: whether the write happened is not known. */
|
|
397
|
+
readonly outcomeUnknown: true;
|
|
398
|
+
/** Always `false`: never replay this request without checking first. */
|
|
399
|
+
readonly retrySafe: false;
|
|
400
|
+
/** `true` when the request's timeout expired; `false` for a dropped connection or broken body. */
|
|
401
|
+
readonly timedOut: boolean;
|
|
402
|
+
/** The timeout that expired, when {@link timedOut}. */
|
|
403
|
+
readonly timeoutMs: number | undefined;
|
|
404
|
+
/** The request method, upper-cased. */
|
|
405
|
+
readonly method: string;
|
|
406
|
+
constructor(service: string, method: string, opts?: {
|
|
407
|
+
timeoutMs?: number;
|
|
408
|
+
cause?: unknown;
|
|
409
|
+
hint?: string;
|
|
410
|
+
});
|
|
411
|
+
}
|
|
253
412
|
/**
|
|
254
413
|
* Thrown by {@link ApiClient.fetchJson} / {@link ApiClient.fetchHtml} for a
|
|
255
414
|
* non-2xx response that isn't a 401/429 (those map to
|
|
@@ -294,6 +453,8 @@ export declare class UpstreamHttpError extends ApiError {
|
|
|
294
453
|
export declare class EdgeBlockedError extends ApiError {
|
|
295
454
|
/** Which edge refused the request, e.g. `'CloudFront'` or `'Cloudflare'`. */
|
|
296
455
|
readonly vendor: string;
|
|
456
|
+
/** Always `'edge_blocked'`: the credential was never judged. */
|
|
457
|
+
readonly kind: McpToolErrorKind;
|
|
297
458
|
/**
|
|
298
459
|
* @param where The service the request was for, and — when the thrower knows
|
|
299
460
|
* it — the method and path, which the message names.
|
|
@@ -325,6 +486,48 @@ export declare function detectEdgeBlock(input: {
|
|
|
325
486
|
}): {
|
|
326
487
|
vendor: string;
|
|
327
488
|
} | null;
|
|
489
|
+
/** Options for {@link parseJsonBody}. All optional; the request fields only enrich the error message. */
|
|
490
|
+
export interface ParseJsonBodyOptions {
|
|
491
|
+
/**
|
|
492
|
+
* The JSON shape the body must have. When set, `null`, a scalar, the other
|
|
493
|
+
* container or an empty body throws {@link UpstreamFormatError}. Omitted,
|
|
494
|
+
* any valid JSON is returned and an empty body yields `undefined`.
|
|
495
|
+
*/
|
|
496
|
+
expect?: ExpectedJsonShape;
|
|
497
|
+
/** The upstream's display name, for the error message. */
|
|
498
|
+
service?: string;
|
|
499
|
+
/** The request method, for the error message. */
|
|
500
|
+
method?: string;
|
|
501
|
+
/** The request path, for the error message. */
|
|
502
|
+
path?: string;
|
|
503
|
+
/**
|
|
504
|
+
* The response status. Also passed to {@link detectEdgeBlock}, so on a 2xx
|
|
505
|
+
* only a challenge (or `cf-mitigated`) counts as an edge block.
|
|
506
|
+
*/
|
|
507
|
+
status?: number;
|
|
508
|
+
/** The response headers: read for `cf-mitigated` and, absent `contentType`, the `Content-Type`. */
|
|
509
|
+
headers?: EdgeBlockHeaders;
|
|
510
|
+
/** The response `Content-Type`, for the error message. */
|
|
511
|
+
contentType?: string;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Parse an upstream response body as JSON, turning every way it can fail into
|
|
515
|
+
* a typed, message-safe error instead of a raw `SyntaxError` (whose message
|
|
516
|
+
* quotes the body) or a later `TypeError` on `null`:
|
|
517
|
+
*
|
|
518
|
+
* - a body that is not JSON is first checked with {@link detectEdgeBlock}
|
|
519
|
+
* (a Cloudflare challenge served with a 200 becomes {@link EdgeBlockedError});
|
|
520
|
+
* otherwise it throws {@link UpstreamFormatError} with `received: 'non-json'`,
|
|
521
|
+
* naming the service, request, status and content type but never the body;
|
|
522
|
+
* - with `expect`, an empty body, `null`, a scalar or the wrong container
|
|
523
|
+
* throws {@link UpstreamFormatError} too.
|
|
524
|
+
*
|
|
525
|
+
* An empty (or whitespace-only) body without `expect` returns `undefined`, the
|
|
526
|
+
* same contract `fetchJson` has for a 204. `fetchJson` runs every 2xx body
|
|
527
|
+
* through this; export it for hand-rolled clients and OAuth token exchanges
|
|
528
|
+
* that read the body themselves (skylight, ofw).
|
|
529
|
+
*/
|
|
530
|
+
export declare function parseJsonBody<T = unknown>(text: string, opts?: ParseJsonBodyOptions): T;
|
|
328
531
|
/**
|
|
329
532
|
* Build a bearer-auth fetch client with one-shot 429 retry, 401 mapping, 204 /
|
|
330
533
|
* empty-body handling, and redacted error formatting.
|
|
@@ -453,6 +656,28 @@ export type SetCookieSource = string[] | string | null | undefined | {
|
|
|
453
656
|
getSetCookie?: () => string[];
|
|
454
657
|
get(name: string): string | null;
|
|
455
658
|
};
|
|
659
|
+
/**
|
|
660
|
+
* Apply a response's `Set-Cookie`s to a caller-owned name→value jar, in place,
|
|
661
|
+
* and report whether the jar changed (so the caller knows when to persist it).
|
|
662
|
+
*
|
|
663
|
+
* - A deletion marker — `Max-Age <= 0`, an `Expires` before 2000 (comma- or
|
|
664
|
+
* dash-format epoch), or an **empty value** — removes the name. Unlike
|
|
665
|
+
* {@link CookieJar.absorb}, an empty value is a delete here, so a cleared
|
|
666
|
+
* session cookie never lingers in a persisted jar as `name=`.
|
|
667
|
+
* - Any other entry sets the name (later entries win).
|
|
668
|
+
* - Entries with no name (`=v`, `noequals`) are ignored.
|
|
669
|
+
*
|
|
670
|
+
* Returns `true` only when a value was added, replaced with a different value,
|
|
671
|
+
* or removed; re-setting an identical value or deleting an absent name is
|
|
672
|
+
* `false`. Accepts the same sources as {@link CookieJar.absorb}: a `Headers`
|
|
673
|
+
* object (prefers `getSetCookie()`), the `getSetCookie()` array, or a single
|
|
674
|
+
* comma-joined string (split safely around `Expires` commas).
|
|
675
|
+
*
|
|
676
|
+
* Consolidates the hand-rolled `getSetCookie` absorb loops in artsonia,
|
|
677
|
+
* canvas-parent, crowntowncompost, evite, infinitecampus, myatriumhealth, ofw
|
|
678
|
+
* and simplepractice (myatriumhealth's stored deletions as empty values).
|
|
679
|
+
*/
|
|
680
|
+
export declare function mergeSetCookies(jar: Map<string, string>, setCookie: SetCookieSource): boolean;
|
|
456
681
|
/**
|
|
457
682
|
* Stateful cookie jar for multi-step session logins (login page → CSRF prime →
|
|
458
683
|
* credential POST → API calls), built on the {@link parseCookieJar} semantics.
|
package/dist/http/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EAAE,YAAY,EAAwD,MAAM,oBAAoB,CAAC;AACxG,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAoB,MAAM,oBAAoB,CAAC;AAGhG,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAWhC,kEAAkE;AAClE,MAAM,WAAW,WAAW;IAC1B,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,2CAA2C;AAC3C;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC/E;AAED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