tiny-http-mcp-server 0.1.23 → 0.1.24
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 +1 -1
- package/node_modules/mcp-oauth/README.md +4 -1
- package/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.js +10 -1
- package/node_modules/mcp-oauth/dist/client/loopback-authorization.d.ts +5 -0
- package/node_modules/mcp-oauth/dist/client/loopback-authorization.js +1 -1
- package/node_modules/tiny-mcp-client/dist/index.js +8 -0
- package/package.json +1 -1
package/dist/composition.json
CHANGED
|
@@ -70,7 +70,10 @@ const verifier = createJwksTokenVerifier({
|
|
|
70
70
|
Fixed redirects support `localhost`, `127.0.0.1`, and `::1` over HTTP. Their
|
|
71
71
|
exact spelling, port, path and query are preserved through registration,
|
|
72
72
|
authorization and code exchange. Credentials, fragments, port zero and reserved
|
|
73
|
-
OAuth callback query parameters are rejected before binding a listener.
|
|
73
|
+
OAuth callback query parameters are rejected before binding a listener.
|
|
74
|
+
`createDefaultOAuthClientProvider` also checks the configured redirect before
|
|
75
|
+
creating the provider. Imported tokens that cannot be sent as HTTP header
|
|
76
|
+
values fail with diagnostics that omit their contents. Omit
|
|
74
77
|
`redirectUri` to allocate a random loopback port. Standalone callback sessions
|
|
75
78
|
accept the same `redirectUri`, `signal` and `timeoutMs` options. Cancellation,
|
|
76
79
|
timeout and explicit close settle pending code waits and release listeners.
|
|
@@ -2,7 +2,7 @@ import { isIP } from "node:net";
|
|
|
2
2
|
import { fetchMcpResponse } from "../http-fetch.js";
|
|
3
3
|
import { URL } from "node:url";
|
|
4
4
|
import { createAuthStoreClientStore, createAuthStoreSessionStore } from "./auth-store-session-store.js";
|
|
5
|
-
import { createLoopbackAuthorizationSession } from "./loopback-authorization.js";
|
|
5
|
+
import { createLoopbackAuthorizationSession, loopbackTarget } from "./loopback-authorization.js";
|
|
6
6
|
import { createAuthorizationState } from "./authorization-state.js";
|
|
7
7
|
import { generateCodeChallenge, generateCodeVerifier } from "./pkce.js";
|
|
8
8
|
import { exchangeAuthorizationCode, OAuthError, refreshAccessToken, isRetryableOAuthError, readOAuthJsonObjectResponse } from "./token-endpoint.js";
|
|
@@ -15,6 +15,7 @@ export function createOAuthClientProvider(options) {
|
|
|
15
15
|
return createDefaultOAuthClientProvider(options);
|
|
16
16
|
}
|
|
17
17
|
export function createDefaultOAuthClientProvider(options) {
|
|
18
|
+
loopbackTarget(options.browser);
|
|
18
19
|
const sessionStore = options.sessionStore ?? createAuthStoreSessionStore(options.authStore);
|
|
19
20
|
const clientStore = options.authStore === undefined ? null : createAuthStoreClientStore(options.authStore);
|
|
20
21
|
const now = options.now ?? Date.now;
|
|
@@ -39,6 +40,14 @@ export function createDefaultOAuthClientProvider(options) {
|
|
|
39
40
|
};
|
|
40
41
|
if (initialGrant !== undefined && (initialGrant.tokens === undefined || initialGrant.client === null))
|
|
41
42
|
throw new Error("OAuth initial grant requires valid tokens and the original client ID");
|
|
43
|
+
if (initialGrant?.tokens !== undefined) {
|
|
44
|
+
try {
|
|
45
|
+
new Headers({ Authorization: `Bearer ${initialGrant.tokens.accessToken}` });
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
throw new Error("OAuth initial grant access token is not a valid HTTP header value");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
42
51
|
let initialGrantConsumed = false;
|
|
43
52
|
return {
|
|
44
53
|
async authorizeRequest(input) {
|
|
@@ -21,5 +21,10 @@ export interface LoopbackAuthorizationSession {
|
|
|
21
21
|
close(): void;
|
|
22
22
|
}
|
|
23
23
|
export declare function createLoopbackAuthorizationSession(options?: LoopbackAuthorizationOptions): Promise<LoopbackAuthorizationSession>;
|
|
24
|
+
export declare function loopbackTarget(options: LoopbackAuthorizationOptions): {
|
|
25
|
+
port: number;
|
|
26
|
+
host: string;
|
|
27
|
+
callbackPath: string;
|
|
28
|
+
};
|
|
24
29
|
export declare function extractCodeFromInput(input: string): string | null;
|
|
25
30
|
export declare function buildSuccessPage(landingPage?: OAuthLandingPage): string;
|
|
@@ -4594,6 +4594,7 @@ function createOAuthClientProvider(options) {
|
|
|
4594
4594
|
return createDefaultOAuthClientProvider(options);
|
|
4595
4595
|
}
|
|
4596
4596
|
function createDefaultOAuthClientProvider(options) {
|
|
4597
|
+
loopbackTarget(options.browser);
|
|
4597
4598
|
const sessionStore = options.sessionStore ?? createAuthStoreSessionStore(options.authStore);
|
|
4598
4599
|
const clientStore = options.authStore === void 0 ? null : createAuthStoreClientStore(options.authStore);
|
|
4599
4600
|
const now = options.now ?? Date.now;
|
|
@@ -4617,6 +4618,13 @@ function createDefaultOAuthClientProvider(options) {
|
|
|
4617
4618
|
};
|
|
4618
4619
|
if (initialGrant !== void 0 && (initialGrant.tokens === void 0 || initialGrant.client === null))
|
|
4619
4620
|
throw new Error("OAuth initial grant requires valid tokens and the original client ID");
|
|
4621
|
+
if (initialGrant?.tokens !== void 0) {
|
|
4622
|
+
try {
|
|
4623
|
+
new Headers({ Authorization: `Bearer ${initialGrant.tokens.accessToken}` });
|
|
4624
|
+
} catch {
|
|
4625
|
+
throw new Error("OAuth initial grant access token is not a valid HTTP header value");
|
|
4626
|
+
}
|
|
4627
|
+
}
|
|
4620
4628
|
let initialGrantConsumed = false;
|
|
4621
4629
|
return {
|
|
4622
4630
|
async authorizeRequest(input) {
|