toolcraft 0.0.343 → 0.0.344
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/node_modules/mcp-oauth/README.md +5 -0
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/loopback-authorization.d.ts +8 -0
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/loopback-authorization.js +19 -5
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/token-endpoint.d.ts +2 -0
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/token-endpoint.js +6 -0
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/index.d.ts +1 -1
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/index.js +1 -1
- package/node_modules/tiny-http-mcp-server/package.json +1 -1
- package/node_modules/tiny-mcp-client/dist/index.js +24 -5
- 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.70",
|
|
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.344",
|
|
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.344",
|
|
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.70",
|
|
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.344",
|
|
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.344",
|
|
127
127
|
"license": "MIT"
|
|
128
128
|
},
|
|
129
129
|
{
|
|
@@ -24,10 +24,15 @@ const verifier = createJwksTokenVerifier({
|
|
|
24
24
|
|
|
25
25
|
## Public API
|
|
26
26
|
|
|
27
|
+
`OAuthError.is(value)` recognizes native token/challenge failures across separately
|
|
28
|
+
bundled package copies while preserving the SDK diagnostic fields. Error names
|
|
29
|
+
alone do not establish either native error type.
|
|
30
|
+
|
|
27
31
|
- `createDefaultOAuthClientProvider(options)`: default MCP OAuth client provider with dynamic or static client registration.
|
|
28
32
|
- `createOAuthClientProvider(options)`: lower-level provider constructor.
|
|
29
33
|
- `createAuthStoreSessionStore(options)`: persisted OAuth session store backed by `auth-store`.
|
|
30
34
|
- `createLoopbackAuthorizationSession(options)`: local callback server for browser authorization.
|
|
35
|
+
- `OAuthAuthorizationError`: a callback denial with its original `error`, `errorDescription` and message for host observers. Use `OAuthAuthorizationError.is(value)` to recognize errors across separately bundled package copies.
|
|
31
36
|
- `generateCodeVerifier()` and `generateCodeChallenge(...)`: PKCE helpers.
|
|
32
37
|
- `normalizeStoredOAuthClient(value)`: normalize a saved client identity, full registration and ownership marker.
|
|
33
38
|
- `normalizeOAuthScope(value)`: validate scope syntax and normalize its case-sensitive set.
|
|
@@ -20,6 +20,14 @@ export interface LoopbackAuthorizationSession {
|
|
|
20
20
|
waitForCode(authorizationUrl: string): Promise<string>;
|
|
21
21
|
close(): void;
|
|
22
22
|
}
|
|
23
|
+
/** Authorization callback denial, retaining the provider diagnostic for host observers. */
|
|
24
|
+
export declare class OAuthAuthorizationError extends Error {
|
|
25
|
+
readonly error: string;
|
|
26
|
+
readonly errorDescription: string;
|
|
27
|
+
/** Recognize errors from separately bundled copies of this package. */
|
|
28
|
+
static is(value: unknown): value is OAuthAuthorizationError;
|
|
29
|
+
constructor(error: string, errorDescription: string);
|
|
30
|
+
}
|
|
23
31
|
export declare function createLoopbackAuthorizationSession(options?: LoopbackAuthorizationOptions): Promise<LoopbackAuthorizationSession>;
|
|
24
32
|
export declare function loopbackTarget(options: LoopbackAuthorizationOptions): {
|
|
25
33
|
port: number;
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import http from "node:http";
|
|
2
2
|
import { parseAuthorizationState } from "./authorization-state.js";
|
|
3
|
+
const authorizationErrorBrand = Symbol.for("poe-platform.mcp-oauth.OAuthAuthorizationError");
|
|
4
|
+
/** Authorization callback denial, retaining the provider diagnostic for host observers. */
|
|
5
|
+
export class OAuthAuthorizationError extends Error {
|
|
6
|
+
error;
|
|
7
|
+
errorDescription;
|
|
8
|
+
/** Recognize errors from separately bundled copies of this package. */
|
|
9
|
+
static is(value) {
|
|
10
|
+
return value instanceof Error && Object.getOwnPropertyDescriptor(value, authorizationErrorBrand)?.value === true;
|
|
11
|
+
}
|
|
12
|
+
constructor(error, errorDescription) {
|
|
13
|
+
super(`OAuth authorization failed: ${error} — ${errorDescription}`);
|
|
14
|
+
this.error = error;
|
|
15
|
+
this.errorDescription = errorDescription;
|
|
16
|
+
this.name = "OAuthAuthorizationError";
|
|
17
|
+
Object.defineProperty(this, authorizationErrorBrand, { value: true });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
3
20
|
export async function createLoopbackAuthorizationSession(options = {}) {
|
|
4
21
|
options.signal?.throwIfAborted();
|
|
5
22
|
const timeoutMs = options.timeoutMs ?? 120_000;
|
|
@@ -144,7 +161,7 @@ function waitForAuthorizationCode(server, authorizationUrl, options, callbackPat
|
|
|
144
161
|
try {
|
|
145
162
|
validateAuthorizationCallbackBinding(callbackParameters, expectedAuthorization);
|
|
146
163
|
if (callbackParameters.error !== null)
|
|
147
|
-
throw
|
|
164
|
+
throw new OAuthAuthorizationError(callbackParameters.error, callbackParameters.errorDescription ?? callbackParameters.error);
|
|
148
165
|
const code = validateAuthorizationCallbackParameters(callbackParameters, expectedAuthorization);
|
|
149
166
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
150
167
|
res.end(buildSuccessPage(options.landingPage));
|
|
@@ -167,7 +184,7 @@ function waitForAuthorizationCode(server, authorizationUrl, options, callbackPat
|
|
|
167
184
|
throw new Error("OAuth callback missing authorization code");
|
|
168
185
|
validateAuthorizationCallbackBinding(callbackParameters, expectedAuthorization);
|
|
169
186
|
if (callbackParameters.error !== null)
|
|
170
|
-
throw
|
|
187
|
+
throw new OAuthAuthorizationError(callbackParameters.error, callbackParameters.errorDescription ?? callbackParameters.error);
|
|
171
188
|
const code = validateAuthorizationCallbackParameters(callbackParameters, expectedAuthorization);
|
|
172
189
|
settle(() => resolve(code));
|
|
173
190
|
}).catch(error => settle(() => reject(error)));
|
|
@@ -244,9 +261,6 @@ function validateAuthorizationCallbackBinding(callback, expected) {
|
|
|
244
261
|
throw new Error("OAuth callback issuer mismatch");
|
|
245
262
|
}
|
|
246
263
|
}
|
|
247
|
-
function createAuthorizationError(error, description) {
|
|
248
|
-
return new Error(`OAuth authorization failed: ${error} — ${description}`);
|
|
249
|
-
}
|
|
250
264
|
function escapeHtml(text) {
|
|
251
265
|
return text
|
|
252
266
|
.replaceAll("&", "&")
|
package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/token-endpoint.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ interface OAuthErrorShape {
|
|
|
5
5
|
error_uri?: string;
|
|
6
6
|
}
|
|
7
7
|
export declare class OAuthError extends Error {
|
|
8
|
+
/** Recognize errors from separately bundled copies of this package. */
|
|
9
|
+
static is(value: unknown): value is OAuthError;
|
|
8
10
|
readonly error: string;
|
|
9
11
|
readonly errorDescription: string | undefined;
|
|
10
12
|
readonly errorUri: string | undefined;
|
package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/token-endpoint.js
CHANGED
|
@@ -4,7 +4,12 @@ import { readBoundedResponseText } from "../http-response.js";
|
|
|
4
4
|
import { fetchMcpResponse } from "../http-fetch.js";
|
|
5
5
|
import { normalizeOAuthScope } from "./scope.js";
|
|
6
6
|
const MAX_JS_DATE_MS = 8_640_000_000_000_000;
|
|
7
|
+
const oauthErrorBrand = Symbol.for("poe-platform.mcp-oauth.OAuthError");
|
|
7
8
|
export class OAuthError extends Error {
|
|
9
|
+
/** Recognize errors from separately bundled copies of this package. */
|
|
10
|
+
static is(value) {
|
|
11
|
+
return value instanceof Error && Object.getOwnPropertyDescriptor(value, oauthErrorBrand)?.value === true;
|
|
12
|
+
}
|
|
8
13
|
error;
|
|
9
14
|
errorDescription;
|
|
10
15
|
errorUri;
|
|
@@ -20,6 +25,7 @@ export class OAuthError extends Error {
|
|
|
20
25
|
const uri = Object.hasOwn(shape, "error_uri") ? shape.error_uri : undefined;
|
|
21
26
|
super(description ?? (outcomeKnown ? shape.error : `OAuth HTTP response did not contain a valid error (HTTP ${status})`));
|
|
22
27
|
this.name = "OAuthError";
|
|
28
|
+
Object.defineProperty(this, oauthErrorBrand, { value: true });
|
|
23
29
|
this.error = shape.error;
|
|
24
30
|
this.errorDescription = description;
|
|
25
31
|
this.errorUri = uri;
|
|
@@ -7,7 +7,7 @@ export { createResourceBoundOAuthStores } from "./client/resource-bound-store.js
|
|
|
7
7
|
export type { ResourceBoundOAuthStores } from "./client/resource-bound-store.js";
|
|
8
8
|
export { parseOAuthClientRegistration, normalizeStoredOAuthClient } from "./client/client-registration.js";
|
|
9
9
|
export { createDefaultOAuthClientProvider, createOAuthClientProvider, } from "./client/default-oauth-client-provider.js";
|
|
10
|
-
export { buildSuccessPage, createLoopbackAuthorizationSession, extractCodeFromInput, } from "./client/loopback-authorization.js";
|
|
10
|
+
export { buildSuccessPage, createLoopbackAuthorizationSession, extractCodeFromInput, OAuthAuthorizationError, } from "./client/loopback-authorization.js";
|
|
11
11
|
export { generateCodeChallenge, generateCodeVerifier, } from "./client/pkce.js";
|
|
12
12
|
export { OAuthError, } from "./client/token-endpoint.js";
|
|
13
13
|
export { canonicalizeResourceIndicator, } from "./resource-indicator.js";
|
|
@@ -5,7 +5,7 @@ export { createAuthStoreSessionStore, } from "./client/auth-store-session-store.
|
|
|
5
5
|
export { createResourceBoundOAuthStores } from "./client/resource-bound-store.js";
|
|
6
6
|
export { parseOAuthClientRegistration, normalizeStoredOAuthClient } from "./client/client-registration.js";
|
|
7
7
|
export { createDefaultOAuthClientProvider, createOAuthClientProvider, } from "./client/default-oauth-client-provider.js";
|
|
8
|
-
export { buildSuccessPage, createLoopbackAuthorizationSession, extractCodeFromInput, } from "./client/loopback-authorization.js";
|
|
8
|
+
export { buildSuccessPage, createLoopbackAuthorizationSession, extractCodeFromInput, OAuthAuthorizationError, } from "./client/loopback-authorization.js";
|
|
9
9
|
export { generateCodeChallenge, generateCodeVerifier, } from "./client/pkce.js";
|
|
10
10
|
export { OAuthError, } from "./client/token-endpoint.js";
|
|
11
11
|
export { canonicalizeResourceIndicator, } from "./resource-indicator.js";
|
|
@@ -3516,6 +3516,22 @@ function getOwnEntry(record2, key2) {
|
|
|
3516
3516
|
}
|
|
3517
3517
|
|
|
3518
3518
|
// ../mcp-oauth/dist/client/loopback-authorization.js
|
|
3519
|
+
var authorizationErrorBrand = /* @__PURE__ */ Symbol.for("poe-platform.mcp-oauth.OAuthAuthorizationError");
|
|
3520
|
+
var OAuthAuthorizationError = class extends Error {
|
|
3521
|
+
error;
|
|
3522
|
+
errorDescription;
|
|
3523
|
+
/** Recognize errors from separately bundled copies of this package. */
|
|
3524
|
+
static is(value) {
|
|
3525
|
+
return value instanceof Error && Object.getOwnPropertyDescriptor(value, authorizationErrorBrand)?.value === true;
|
|
3526
|
+
}
|
|
3527
|
+
constructor(error, errorDescription) {
|
|
3528
|
+
super(`OAuth authorization failed: ${error} \u2014 ${errorDescription}`);
|
|
3529
|
+
this.error = error;
|
|
3530
|
+
this.errorDescription = errorDescription;
|
|
3531
|
+
this.name = "OAuthAuthorizationError";
|
|
3532
|
+
Object.defineProperty(this, authorizationErrorBrand, { value: true });
|
|
3533
|
+
}
|
|
3534
|
+
};
|
|
3519
3535
|
async function createLoopbackAuthorizationSession(options = {}) {
|
|
3520
3536
|
options.signal?.throwIfAborted();
|
|
3521
3537
|
const timeoutMs = options.timeoutMs ?? 12e4;
|
|
@@ -3663,7 +3679,7 @@ function waitForAuthorizationCode(server, authorizationUrl, options, callbackPat
|
|
|
3663
3679
|
try {
|
|
3664
3680
|
validateAuthorizationCallbackBinding(callbackParameters, expectedAuthorization);
|
|
3665
3681
|
if (callbackParameters.error !== null)
|
|
3666
|
-
throw
|
|
3682
|
+
throw new OAuthAuthorizationError(callbackParameters.error, callbackParameters.errorDescription ?? callbackParameters.error);
|
|
3667
3683
|
const code = validateAuthorizationCallbackParameters(callbackParameters, expectedAuthorization);
|
|
3668
3684
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
3669
3685
|
res.end(buildSuccessPage(options.landingPage));
|
|
@@ -3685,7 +3701,7 @@ function waitForAuthorizationCode(server, authorizationUrl, options, callbackPat
|
|
|
3685
3701
|
throw new Error("OAuth callback missing authorization code");
|
|
3686
3702
|
validateAuthorizationCallbackBinding(callbackParameters, expectedAuthorization);
|
|
3687
3703
|
if (callbackParameters.error !== null)
|
|
3688
|
-
throw
|
|
3704
|
+
throw new OAuthAuthorizationError(callbackParameters.error, callbackParameters.errorDescription ?? callbackParameters.error);
|
|
3689
3705
|
const code = validateAuthorizationCallbackParameters(callbackParameters, expectedAuthorization);
|
|
3690
3706
|
settle(() => resolve(code));
|
|
3691
3707
|
}).catch((error) => settle(() => reject(error)));
|
|
@@ -3754,9 +3770,6 @@ function validateAuthorizationCallbackBinding(callback, expected) {
|
|
|
3754
3770
|
throw new Error("OAuth callback issuer mismatch");
|
|
3755
3771
|
}
|
|
3756
3772
|
}
|
|
3757
|
-
function createAuthorizationError(error, description) {
|
|
3758
|
-
return new Error(`OAuth authorization failed: ${error} \u2014 ${description}`);
|
|
3759
|
-
}
|
|
3760
3773
|
function escapeHtml(text) {
|
|
3761
3774
|
return text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
3762
3775
|
}
|
|
@@ -5038,7 +5051,12 @@ async function readBoundedResponseText(response, maxBytes, readers, signal) {
|
|
|
5038
5051
|
|
|
5039
5052
|
// ../mcp-oauth/dist/client/token-endpoint.js
|
|
5040
5053
|
var MAX_JS_DATE_MS2 = 864e13;
|
|
5054
|
+
var oauthErrorBrand = /* @__PURE__ */ Symbol.for("poe-platform.mcp-oauth.OAuthError");
|
|
5041
5055
|
var OAuthError = class extends Error {
|
|
5056
|
+
/** Recognize errors from separately bundled copies of this package. */
|
|
5057
|
+
static is(value) {
|
|
5058
|
+
return value instanceof Error && Object.getOwnPropertyDescriptor(value, oauthErrorBrand)?.value === true;
|
|
5059
|
+
}
|
|
5042
5060
|
error;
|
|
5043
5061
|
errorDescription;
|
|
5044
5062
|
errorUri;
|
|
@@ -5054,6 +5072,7 @@ var OAuthError = class extends Error {
|
|
|
5054
5072
|
const uri = Object.hasOwn(shape, "error_uri") ? shape.error_uri : void 0;
|
|
5055
5073
|
super(description ?? (outcomeKnown ? shape.error : `OAuth HTTP response did not contain a valid error (HTTP ${status})`));
|
|
5056
5074
|
this.name = "OAuthError";
|
|
5075
|
+
Object.defineProperty(this, oauthErrorBrand, { value: true });
|
|
5057
5076
|
this.error = shape.error;
|
|
5058
5077
|
this.errorDescription = description;
|
|
5059
5078
|
this.errorUri = uri;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolcraft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.344",
|
|
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.344",
|
|
162
162
|
"toolcraft-design": "*",
|
|
163
163
|
"@poe-code/frontmatter": "*",
|
|
164
164
|
"@poe-code/agent-mcp-config": "*",
|