tiny-http-mcp-server 0.1.58 → 0.1.60
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/auth-store/README.md +4 -0
- package/node_modules/auth-store/dist/create-secret-store.d.ts +3 -1
- package/node_modules/auth-store/dist/create-secret-store.js +3 -2
- package/node_modules/auth-store/dist/index.d.ts +1 -1
- package/node_modules/auth-store/dist/index.js +1 -1
- package/node_modules/mcp-oauth/README.md +5 -0
- package/node_modules/mcp-oauth/dist/client/auth-store-session-store.js +11 -1
- package/node_modules/tiny-mcp-client/dist/index.js +15 -2
- package/package.json +1 -1
package/dist/composition.json
CHANGED
|
@@ -25,6 +25,10 @@ const value = await store.get(); // "secret-value"
|
|
|
25
25
|
await store.delete();
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
Use `resolveSecretStoreBackend(options)` to select and validate the backend
|
|
29
|
+
without constructing a store or reading credentials. Pass the returned backend
|
|
30
|
+
explicitly when deferred operations must keep the same environment selection.
|
|
31
|
+
|
|
28
32
|
Both built-in backends expose `store.withLock(operation, { signal, timeoutMs })`
|
|
29
33
|
for transactions spanning a read, external operation and write. Independent
|
|
30
34
|
instances and processes serialize the same encrypted file or Keychain
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import type { CreateSecretStoreInput, CreateSecretStoreResult } from "./types.js";
|
|
1
|
+
import type { CreateSecretStoreInput, CreateSecretStoreResult, StoreBackend } from "./types.js";
|
|
2
2
|
export declare function createSecretStore(input: CreateSecretStoreInput): CreateSecretStoreResult;
|
|
3
|
+
/** Select and validate a backend without constructing a store or accessing credentials. */
|
|
4
|
+
export declare function resolveSecretStoreBackend(input: CreateSecretStoreInput): StoreBackend;
|
|
@@ -17,7 +17,7 @@ const storeFactories = {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
export function createSecretStore(input) {
|
|
20
|
-
const backend =
|
|
20
|
+
const backend = resolveSecretStoreBackend(input);
|
|
21
21
|
const platform = input.platform ?? process.platform;
|
|
22
22
|
if (backend === "keychain" && platform !== MACOS_PLATFORM) {
|
|
23
23
|
throw new Error(`Keychain backend is only supported on macOS. Current platform: ${platform}`);
|
|
@@ -25,7 +25,8 @@ export function createSecretStore(input) {
|
|
|
25
25
|
const store = storeFactories[backend](input);
|
|
26
26
|
return { backend, store };
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
/** Select and validate a backend without constructing a store or accessing credentials. */
|
|
29
|
+
export function resolveSecretStoreBackend(input) {
|
|
29
30
|
const envVar = input.backendEnvVar ?? DEFAULT_BACKEND_ENV_VAR;
|
|
30
31
|
const configuredBackend = input.backend ?? getOwnEnvValue(input.env, envVar) ?? getOwnEnvValue(process.env, envVar);
|
|
31
32
|
const backend = configuredBackend?.trim();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createSecretStore } from "./create-secret-store.js";
|
|
1
|
+
export { createSecretStore, resolveSecretStoreBackend } from "./create-secret-store.js";
|
|
2
2
|
export { EncryptedFileStore } from "./encrypted-file-store.js";
|
|
3
3
|
export { KeychainStore } from "./keychain-store.js";
|
|
4
4
|
export type { SecretStoreLockOptions, SecretStoreLockFileSystem } from "./transaction-lock.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createSecretStore } from "./create-secret-store.js";
|
|
1
|
+
export { createSecretStore, resolveSecretStoreBackend } from "./create-secret-store.js";
|
|
2
2
|
export { EncryptedFileStore } from "./encrypted-file-store.js";
|
|
3
3
|
export { KeychainStore } from "./keychain-store.js";
|
|
4
4
|
export { key, MigratingSecretStore } from "./provider-store.js";
|
|
@@ -61,6 +61,11 @@ The default provider captures client, interaction, callback, landing-page and
|
|
|
61
61
|
lock policies when created. Create a new provider to change those settings.
|
|
62
62
|
Selected callbacks, stores, clocks and AbortSignals remain live host dependencies;
|
|
63
63
|
aborting the original signal still cancels authorization.
|
|
64
|
+
Native session and client persistence factories also capture file paths, salts,
|
|
65
|
+
Keychain identities, lock locations and selected filesystem/command handles.
|
|
66
|
+
Mutating these settings cannot redirect a later read or write.
|
|
67
|
+
The factories resolve the selected backend environment variable once at creation;
|
|
68
|
+
later environment changes cannot move a transaction between file and Keychain.
|
|
64
69
|
|
|
65
70
|
`createJwksTokenVerifier(options)` accepts:
|
|
66
71
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizeStoredOAuthClient } from "./client-registration.js";
|
|
2
2
|
import crypto from "node:crypto";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { createSecretStore } from "auth-store";
|
|
4
|
+
import { createSecretStore, resolveSecretStoreBackend } from "auth-store";
|
|
5
5
|
import { canonicalizeResourceIndicator } from "../resource-indicator.js";
|
|
6
6
|
const DEFAULT_FILE_SALT = "poe-code:mcp-oauth:v1";
|
|
7
7
|
const DEFAULT_FILE_DIRECTORY = ".poe-code/mcp-oauth";
|
|
@@ -12,6 +12,7 @@ const DEFAULT_CLIENT_KEYCHAIN_SERVICE = "poe-code-mcp-oauth-clients";
|
|
|
12
12
|
const MAX_JS_DATE_MS = 8_640_000_000_000_000;
|
|
13
13
|
export function createAuthStoreSessionStore(options = {}, namespace) {
|
|
14
14
|
assertPersistenceNamespace(namespace);
|
|
15
|
+
options = snapshotPersistenceOptions(options);
|
|
15
16
|
return {
|
|
16
17
|
async withLock(resource, operation, lockOptions) {
|
|
17
18
|
const store = createResourceSecretStore(resource, options, namespace);
|
|
@@ -49,6 +50,7 @@ export function createAuthStoreSessionStore(options = {}, namespace) {
|
|
|
49
50
|
}
|
|
50
51
|
export function createAuthStoreClientStore(options, namespace) {
|
|
51
52
|
assertPersistenceNamespace(namespace);
|
|
53
|
+
options = snapshotPersistenceOptions(options);
|
|
52
54
|
return {
|
|
53
55
|
async load(issuer) {
|
|
54
56
|
const store = createIssuerSecretStore(issuer, options, namespace);
|
|
@@ -79,6 +81,14 @@ export function createAuthStoreClientStore(options, namespace) {
|
|
|
79
81
|
}
|
|
80
82
|
};
|
|
81
83
|
}
|
|
84
|
+
function snapshotPersistenceOptions(options) {
|
|
85
|
+
return {
|
|
86
|
+
...options, backend: resolveSecretStoreBackend(options),
|
|
87
|
+
...(options.fileStore === undefined ? {} : { fileStore: { ...options.fileStore } }),
|
|
88
|
+
...(options.keychainStore === undefined ? {} : { keychainStore: { ...options.keychainStore,
|
|
89
|
+
...(options.keychainStore.lock === undefined ? {} : { lock: { ...options.keychainStore.lock } }) } })
|
|
90
|
+
};
|
|
91
|
+
}
|
|
82
92
|
export function createNamedSecretStore(key, options, defaults, namespace) {
|
|
83
93
|
const hash = crypto.createHash("sha256").update(namespace === undefined ? key : JSON.stringify([namespace, key])).digest("hex");
|
|
84
94
|
const configuredFilePath = options.fileStore?.filePath;
|
|
@@ -4526,7 +4526,7 @@ var storeFactories = {
|
|
|
4526
4526
|
}
|
|
4527
4527
|
};
|
|
4528
4528
|
function createSecretStore(input) {
|
|
4529
|
-
const backend =
|
|
4529
|
+
const backend = resolveSecretStoreBackend(input);
|
|
4530
4530
|
const platform = input.platform ?? process.platform;
|
|
4531
4531
|
if (backend === "keychain" && platform !== MACOS_PLATFORM) {
|
|
4532
4532
|
throw new Error(`Keychain backend is only supported on macOS. Current platform: ${platform}`);
|
|
@@ -4534,7 +4534,7 @@ function createSecretStore(input) {
|
|
|
4534
4534
|
const store = storeFactories[backend](input);
|
|
4535
4535
|
return { backend, store };
|
|
4536
4536
|
}
|
|
4537
|
-
function
|
|
4537
|
+
function resolveSecretStoreBackend(input) {
|
|
4538
4538
|
const envVar = input.backendEnvVar ?? DEFAULT_BACKEND_ENV_VAR;
|
|
4539
4539
|
const configuredBackend = input.backend ?? getOwnEnvValue(input.env, envVar) ?? getOwnEnvValue(process.env, envVar);
|
|
4540
4540
|
const backend = configuredBackend?.trim();
|
|
@@ -4572,6 +4572,7 @@ var DEFAULT_CLIENT_KEYCHAIN_SERVICE = "poe-code-mcp-oauth-clients";
|
|
|
4572
4572
|
var MAX_JS_DATE_MS = 864e13;
|
|
4573
4573
|
function createAuthStoreSessionStore(options = {}, namespace) {
|
|
4574
4574
|
assertPersistenceNamespace(namespace);
|
|
4575
|
+
options = snapshotPersistenceOptions(options);
|
|
4575
4576
|
return {
|
|
4576
4577
|
async withLock(resource, operation, lockOptions) {
|
|
4577
4578
|
const store = createResourceSecretStore(resource, options, namespace);
|
|
@@ -4608,6 +4609,7 @@ function createAuthStoreSessionStore(options = {}, namespace) {
|
|
|
4608
4609
|
}
|
|
4609
4610
|
function createAuthStoreClientStore(options, namespace) {
|
|
4610
4611
|
assertPersistenceNamespace(namespace);
|
|
4612
|
+
options = snapshotPersistenceOptions(options);
|
|
4611
4613
|
return {
|
|
4612
4614
|
async load(issuer) {
|
|
4613
4615
|
const store = createIssuerSecretStore(issuer, options, namespace);
|
|
@@ -4635,6 +4637,17 @@ function createAuthStoreClientStore(options, namespace) {
|
|
|
4635
4637
|
}
|
|
4636
4638
|
};
|
|
4637
4639
|
}
|
|
4640
|
+
function snapshotPersistenceOptions(options) {
|
|
4641
|
+
return {
|
|
4642
|
+
...options,
|
|
4643
|
+
backend: resolveSecretStoreBackend(options),
|
|
4644
|
+
...options.fileStore === void 0 ? {} : { fileStore: { ...options.fileStore } },
|
|
4645
|
+
...options.keychainStore === void 0 ? {} : { keychainStore: {
|
|
4646
|
+
...options.keychainStore,
|
|
4647
|
+
...options.keychainStore.lock === void 0 ? {} : { lock: { ...options.keychainStore.lock } }
|
|
4648
|
+
} }
|
|
4649
|
+
};
|
|
4650
|
+
}
|
|
4638
4651
|
function createNamedSecretStore(key2, options, defaults, namespace) {
|
|
4639
4652
|
const hash = crypto2.createHash("sha256").update(namespace === void 0 ? key2 : JSON.stringify([namespace, key2])).digest("hex");
|
|
4640
4653
|
const configuredFilePath = options.fileStore?.filePath;
|