tiny-http-mcp-server 0.1.59 → 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.
@@ -18,7 +18,7 @@
18
18
  },
19
19
  {
20
20
  "name": "tiny-http-mcp-server",
21
- "version": "0.1.59",
21
+ "version": "0.1.60",
22
22
  "license": "MIT"
23
23
  },
24
24
  {
@@ -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 = resolveBackend(input);
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
- function resolveBackend(input) {
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";
@@ -64,6 +64,8 @@ aborting the original signal still cancels authorization.
64
64
  Native session and client persistence factories also capture file paths, salts,
65
65
  Keychain identities, lock locations and selected filesystem/command handles.
66
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.
67
69
 
68
70
  `createJwksTokenVerifier(options)` accepts:
69
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";
@@ -83,7 +83,7 @@ export function createAuthStoreClientStore(options, namespace) {
83
83
  }
84
84
  function snapshotPersistenceOptions(options) {
85
85
  return {
86
- ...options,
86
+ ...options, backend: resolveSecretStoreBackend(options),
87
87
  ...(options.fileStore === undefined ? {} : { fileStore: { ...options.fileStore } }),
88
88
  ...(options.keychainStore === undefined ? {} : { keychainStore: { ...options.keychainStore,
89
89
  ...(options.keychainStore.lock === undefined ? {} : { lock: { ...options.keychainStore.lock } }) } })
@@ -4526,7 +4526,7 @@ var storeFactories = {
4526
4526
  }
4527
4527
  };
4528
4528
  function createSecretStore(input) {
4529
- const backend = resolveBackend(input);
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 resolveBackend(input) {
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();
@@ -4640,6 +4640,7 @@ function createAuthStoreClientStore(options, namespace) {
4640
4640
  function snapshotPersistenceOptions(options) {
4641
4641
  return {
4642
4642
  ...options,
4643
+ backend: resolveSecretStoreBackend(options),
4643
4644
  ...options.fileStore === void 0 ? {} : { fileStore: { ...options.fileStore } },
4644
4645
  ...options.keychainStore === void 0 ? {} : { keychainStore: {
4645
4646
  ...options.keychainStore,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiny-http-mcp-server",
3
- "version": "0.1.59",
3
+ "version": "0.1.60",
4
4
  "description": "Minimal MCP server over HTTP built on tiny-stdio-mcp-server",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",