toolcraft 0.0.346 → 0.0.347
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/composition.json +3 -3
- package/dist/composition.json +3 -3
- package/node_modules/tiny-http-mcp-server/dist/composition.json +1 -1
- package/node_modules/tiny-http-mcp-server/package.json +1 -1
- package/node_modules/tiny-mcp-client/README.md +6 -0
- package/node_modules/tiny-mcp-client/dist/index.d.ts +2 -1
- package/node_modules/tiny-mcp-client/dist/index.js +23 -14
- package/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
- package/node_modules/toolcraft-schema/package.json +1 -1
- package/package.json +2 -2
package/composition.json
CHANGED
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"name": "tiny-http-mcp-server",
|
|
101
|
-
"version": "0.1.
|
|
101
|
+
"version": "0.1.75",
|
|
102
102
|
"license": "MIT"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "toolcraft",
|
|
116
|
-
"version": "0.0.
|
|
116
|
+
"version": "0.0.347",
|
|
117
117
|
"license": "MIT"
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"name": "toolcraft-schema",
|
|
126
|
-
"version": "0.0.
|
|
126
|
+
"version": "0.0.347",
|
|
127
127
|
"license": "MIT"
|
|
128
128
|
},
|
|
129
129
|
{
|
package/dist/composition.json
CHANGED
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"name": "tiny-http-mcp-server",
|
|
101
|
-
"version": "0.1.
|
|
101
|
+
"version": "0.1.75",
|
|
102
102
|
"license": "MIT"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "toolcraft",
|
|
116
|
-
"version": "0.0.
|
|
116
|
+
"version": "0.0.347",
|
|
117
117
|
"license": "MIT"
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"name": "toolcraft-schema",
|
|
126
|
-
"version": "0.0.
|
|
126
|
+
"version": "0.0.347",
|
|
127
127
|
"license": "MIT"
|
|
128
128
|
},
|
|
129
129
|
{
|
|
@@ -110,7 +110,13 @@ const transport = new HttpTransport({
|
|
|
110
110
|
You can also call `discoverOAuthMetadata(resourceUrl, options)` directly, or instantiate `OAuthMetadataDiscovery` with a custom `fetch` implementation and shared cache. An explicit `resourceMetadataUrl` requires fresh network discovery without reading either cache; validated results still populate both caches. Lookup options accept `signal`; cancellation stops metadata fetches and body reads without trying another discovery candidate. It also settles while shared-cache reads, writes or eviction wait. Host cache work may finish afterward; its late rejection remains observed, and canceled discovery does not start another candidate.
|
|
111
111
|
Resource/issuer binding mismatches and exhausted authorization-server discovery
|
|
112
112
|
expose `OAuthMetadataError.phase` while retaining complete SDK messages.
|
|
113
|
+
Protected-resource metadata HTTP failures also expose their numeric `status`.
|
|
114
|
+
Rejected metadata bodies start cleanup without delaying failure or caller
|
|
115
|
+
cancellation. Host cleanup may finish later; its rejection remains observed.
|
|
113
116
|
`OAuthMetadataError.is(value)` recognizes separately bundled native copies.
|
|
117
|
+
Bearer challenges with repeated case-insensitive parameters fail before OAuth
|
|
118
|
+
recovery, including identical repeats. Their rejected response bodies are released
|
|
119
|
+
without reflecting parameter values in the diagnostic.
|
|
114
120
|
|
|
115
121
|
OAuth provider inputs receive the originating request's `signal`, covering header authorization and unauthorized handling. Modern request cancellation stops its OAuth work while leaving other requests usable; transport disposal cancels all pending OAuth operations. The default provider propagates this signal to callback, registration and token work. Custom providers must observe it for their own operations.
|
|
116
122
|
|
|
@@ -307,8 +307,9 @@ interface OAuthMetadataLookupOptions {
|
|
|
307
307
|
/** Native metadata failure with complete SDK diagnostics and a safe phase. */
|
|
308
308
|
declare class OAuthMetadataError extends Error {
|
|
309
309
|
readonly phase: "protected-resource" | "authorization-server";
|
|
310
|
+
readonly status?: number | undefined;
|
|
310
311
|
static is(value: unknown): value is OAuthMetadataError;
|
|
311
|
-
constructor(phase: "protected-resource" | "authorization-server", message: string);
|
|
312
|
+
constructor(phase: "protected-resource" | "authorization-server", message: string, status?: number | undefined);
|
|
312
313
|
}
|
|
313
314
|
declare class OAuthMetadataDiscovery {
|
|
314
315
|
private readonly fetchImpl;
|
|
@@ -6246,13 +6246,15 @@ function createParameterHeaders(definitions, argumentsValue) {
|
|
|
6246
6246
|
import { isIP as isIP2 } from "node:net";
|
|
6247
6247
|
var metadataErrorBrand = /* @__PURE__ */ Symbol.for("poe-platform.tiny-mcp-client.OAuthMetadataError");
|
|
6248
6248
|
var OAuthMetadataError = class extends Error {
|
|
6249
|
-
constructor(phase, message) {
|
|
6249
|
+
constructor(phase, message, status) {
|
|
6250
6250
|
super(message);
|
|
6251
6251
|
this.phase = phase;
|
|
6252
|
+
this.status = status;
|
|
6252
6253
|
this.name = "OAuthMetadataError";
|
|
6253
6254
|
Object.defineProperty(this, metadataErrorBrand, { value: true });
|
|
6254
6255
|
}
|
|
6255
6256
|
phase;
|
|
6257
|
+
status;
|
|
6256
6258
|
static is(value) {
|
|
6257
6259
|
return value instanceof Error && Object.getOwnPropertyDescriptor(value, metadataErrorBrand)?.value === true;
|
|
6258
6260
|
}
|
|
@@ -6360,11 +6362,12 @@ function validateAuthorizationServerMetadata(value, issuer) {
|
|
|
6360
6362
|
}
|
|
6361
6363
|
return value;
|
|
6362
6364
|
}
|
|
6363
|
-
async function readJsonResponse(response,
|
|
6365
|
+
async function readJsonResponse(response, phase, signal) {
|
|
6366
|
+
const label = phase === "protected-resource" ? "Protected resource metadata" : "Authorization server metadata";
|
|
6364
6367
|
if (!response.ok) {
|
|
6365
|
-
|
|
6368
|
+
void response.body?.cancel().catch(() => void 0);
|
|
6366
6369
|
const statusDescriptor = `${response.status} ${response.statusText}`.trim();
|
|
6367
|
-
throw new
|
|
6370
|
+
throw new OAuthMetadataError(phase, `${label} request failed (${statusDescriptor})`, response.status);
|
|
6368
6371
|
}
|
|
6369
6372
|
const text = await readBoundedResponseText(response, 1024 * 1024, void 0, signal);
|
|
6370
6373
|
try {
|
|
@@ -6373,7 +6376,7 @@ async function readJsonResponse(response, label, signal) {
|
|
|
6373
6376
|
throw new Error(`${label} response must be valid JSON`);
|
|
6374
6377
|
}
|
|
6375
6378
|
}
|
|
6376
|
-
async function fetchMetadata(fetch2, location,
|
|
6379
|
+
async function fetchMetadata(fetch2, location, phase, parentSignal) {
|
|
6377
6380
|
parentSignal?.throwIfAborted();
|
|
6378
6381
|
const deadline = AbortSignal.timeout(1e4);
|
|
6379
6382
|
const signal = parentSignal === void 0 ? deadline : AbortSignal.any([deadline, parentSignal]);
|
|
@@ -6382,7 +6385,7 @@ async function fetchMetadata(fetch2, location, label, parentSignal) {
|
|
|
6382
6385
|
headers: { Accept: "application/json" },
|
|
6383
6386
|
signal
|
|
6384
6387
|
});
|
|
6385
|
-
return readJsonResponse(response,
|
|
6388
|
+
return readJsonResponse(response, phase, signal);
|
|
6386
6389
|
}
|
|
6387
6390
|
function resolveWellKnownMetadataUrl(inputUrl, suffix) {
|
|
6388
6391
|
const url = new URL(typeof inputUrl === "string" ? inputUrl : inputUrl.toString());
|
|
@@ -6501,7 +6504,7 @@ var OAuthMetadataDiscovery = class {
|
|
|
6501
6504
|
for (const location of locations) {
|
|
6502
6505
|
try {
|
|
6503
6506
|
const metadata = validateProtectedResourceMetadata(
|
|
6504
|
-
await fetchMetadata(this.fetchImpl, location, "
|
|
6507
|
+
await fetchMetadata(this.fetchImpl, location, "protected-resource", signal),
|
|
6505
6508
|
resource
|
|
6506
6509
|
);
|
|
6507
6510
|
return { location, metadata };
|
|
@@ -6539,7 +6542,7 @@ var OAuthMetadataDiscovery = class {
|
|
|
6539
6542
|
for (const authorizationServerMetadataUrl of metadataLocations) {
|
|
6540
6543
|
try {
|
|
6541
6544
|
const authorizationServerMetadata = validateAuthorizationServerMetadata(
|
|
6542
|
-
await fetchMetadata(this.fetchImpl, authorizationServerMetadataUrl, "
|
|
6545
|
+
await fetchMetadata(this.fetchImpl, authorizationServerMetadataUrl, "authorization-server", signal),
|
|
6543
6546
|
normalizedAuthorizationServer
|
|
6544
6547
|
);
|
|
6545
6548
|
const result = {
|
|
@@ -6728,7 +6731,11 @@ function parseBearerWwwAuthenticateHeader(headerValue) {
|
|
|
6728
6731
|
if (parsedParam === null) {
|
|
6729
6732
|
break;
|
|
6730
6733
|
}
|
|
6731
|
-
|
|
6734
|
+
const parameterName = parsedParam.name.toLowerCase();
|
|
6735
|
+
if (scheme.token.toLowerCase() === "bearer" && Object.hasOwn(params, parameterName)) {
|
|
6736
|
+
throw new Error("Bearer challenge must not repeat authentication parameters");
|
|
6737
|
+
}
|
|
6738
|
+
params[parameterName] = parsedParam.value;
|
|
6732
6739
|
index = skipOptionalWhitespace(headerValue, parsedParam.nextIndex);
|
|
6733
6740
|
if (headerValue[index] !== ",") {
|
|
6734
6741
|
break;
|
|
@@ -8194,9 +8201,9 @@ var HttpTransport = class {
|
|
|
8194
8201
|
if (discoveryClient === void 0) {
|
|
8195
8202
|
return false;
|
|
8196
8203
|
}
|
|
8197
|
-
const challenge = parseBearerWwwAuthenticateHeader(response.headers.get("WWW-Authenticate"));
|
|
8198
|
-
const resourceMetadataUrl = challenge?.params.resource_metadata;
|
|
8199
8204
|
try {
|
|
8205
|
+
const challenge = parseBearerWwwAuthenticateHeader(response.headers.get("WWW-Authenticate"));
|
|
8206
|
+
const resourceMetadataUrl = challenge?.params.resource_metadata;
|
|
8200
8207
|
const discovery = await discoveryClient.discover(this.url, { resourceMetadataUrl, signal });
|
|
8201
8208
|
const providerResponse = response.clone();
|
|
8202
8209
|
let result;
|
|
@@ -8378,10 +8385,12 @@ var HttpTransport = class {
|
|
|
8378
8385
|
let attempt = await request();
|
|
8379
8386
|
if (await this.maybeHandleUnauthorizedResponse(attempt.response, controller.signal, attempt.headers, attempt.tokens)) attempt = await request();
|
|
8380
8387
|
const response = attempt.response;
|
|
8381
|
-
|
|
8382
|
-
|
|
8388
|
+
try {
|
|
8389
|
+
const oauthError = this.oauthProvider === void 0 ? null : this.readOAuthChallengeError(response);
|
|
8390
|
+
if (oauthError !== null) throw oauthError;
|
|
8391
|
+
} catch (error) {
|
|
8383
8392
|
void response.body?.cancel().catch(() => void 0);
|
|
8384
|
-
throw
|
|
8393
|
+
throw error;
|
|
8385
8394
|
}
|
|
8386
8395
|
return response;
|
|
8387
8396
|
} finally {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolcraft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.347",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"yaml"
|
|
159
159
|
],
|
|
160
160
|
"optionalDependencies": {
|
|
161
|
-
"toolcraft-schema": "0.0.
|
|
161
|
+
"toolcraft-schema": "0.0.347",
|
|
162
162
|
"toolcraft-design": "*",
|
|
163
163
|
"@poe-code/frontmatter": "*",
|
|
164
164
|
"@poe-code/agent-mcp-config": "*",
|