toolcraft 0.0.309 → 0.0.311

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.
Files changed (26) hide show
  1. package/composition.json +3 -3
  2. package/dist/composition.json +3 -3
  3. package/node_modules/auth-store/README.md +16 -0
  4. package/node_modules/auth-store/dist/encrypted-file-store.d.ts +3 -0
  5. package/node_modules/auth-store/dist/encrypted-file-store.js +7 -0
  6. package/node_modules/auth-store/dist/index.d.ts +1 -0
  7. package/node_modules/auth-store/dist/keychain-store.d.ts +8 -0
  8. package/node_modules/auth-store/dist/keychain-store.js +13 -0
  9. package/node_modules/auth-store/dist/transaction-lock.d.ts +24 -0
  10. package/node_modules/auth-store/dist/transaction-lock.js +152 -0
  11. package/node_modules/auth-store/dist/types.d.ts +2 -0
  12. package/node_modules/tiny-http-mcp-server/dist/composition.json +1 -1
  13. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/README.md +33 -0
  14. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/auth-store-session-store.js +8 -0
  15. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.js +202 -185
  16. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/session-transaction.d.ts +6 -0
  17. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/session-transaction.js +42 -0
  18. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/token-endpoint.d.ts +3 -1
  19. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/token-endpoint.js +7 -3
  20. package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/types.d.ts +14 -1
  21. package/node_modules/tiny-http-mcp-server/package.json +1 -1
  22. package/node_modules/tiny-mcp-client/dist/index.d.ts +39 -1
  23. package/node_modules/tiny-mcp-client/dist/index.js +503 -254
  24. package/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
  25. package/node_modules/toolcraft-schema/package.json +1 -1
  26. package/package.json +2 -2
@@ -20,11 +20,31 @@ interface McpSubscription {
20
20
  cancel(): void;
21
21
  }
22
22
 
23
+ interface SecretStoreLockFileSystem {
24
+ mkdir(path: string, options?: {
25
+ recursive?: boolean;
26
+ mode?: number;
27
+ }): Promise<unknown>;
28
+ readdir(path: string): Promise<string[]>;
29
+ readFile(path: string, encoding: BufferEncoding): Promise<string>;
30
+ writeFile(path: string, value: string, options: {
31
+ encoding: BufferEncoding;
32
+ flag: string;
33
+ mode: number;
34
+ }): Promise<void>;
35
+ rename(from: string, to: string): Promise<void>;
36
+ unlink(path: string): Promise<void>;
37
+ lstat(path: string): Promise<{
38
+ isSymbolicLink(): boolean;
39
+ }>;
40
+ }
41
+
23
42
  interface MachineIdentity {
24
43
  hostname: string;
25
44
  username: string;
26
45
  }
27
46
  interface EncryptedFileStoreFileSystem {
47
+ readdir?(path: string): Promise<string[]>;
28
48
  readFile(path: string, encoding: BufferEncoding): Promise<string>;
29
49
  writeFile(path: string, data: string | NodeJS.ArrayBufferView, options?: {
30
50
  encoding?: BufferEncoding;
@@ -65,6 +85,10 @@ interface KeychainStoreInput {
65
85
  runCommand?: KeychainCommandRunner;
66
86
  service: string;
67
87
  account: string;
88
+ lock?: {
89
+ fs?: SecretStoreLockFileSystem;
90
+ directory?: string;
91
+ };
68
92
  }
69
93
 
70
94
  type StoreBackend = "file" | "keychain";
@@ -110,7 +134,7 @@ interface OAuthClientProvider {
110
134
  headers: Headers;
111
135
  fetch: OAuthMetadataFetch;
112
136
  signal?: AbortSignal;
113
- }): Promise<void> | void;
137
+ }): Promise<StoredOAuthTokens | void> | StoredOAuthTokens | void;
114
138
  handleUnauthorized(input: {
115
139
  requestUrl: URL;
116
140
  response: Response;
@@ -118,6 +142,10 @@ interface OAuthClientProvider {
118
142
  discovery: OAuthDiscoveryResult;
119
143
  fetch: OAuthMetadataFetch;
120
144
  signal?: AbortSignal;
145
+ /** Headers actually attached to this rejected request. */
146
+ requestHeaders?: Headers;
147
+ /** Owned snapshot returned when this request was authorized, or null if absent. */
148
+ presentedTokens?: StoredOAuthTokens | null;
121
149
  }): Promise<{
122
150
  action: "retry";
123
151
  } | {
@@ -151,6 +179,8 @@ interface StoredOAuthSession {
151
179
  clientSecret?: string;
152
180
  };
153
181
  tokens?: StoredOAuthTokens;
182
+ /** A refresh was begun; its winning response may not have been persisted. */
183
+ refreshState?: "pending";
154
184
  discovery: {
155
185
  resourceMetadataUrl: string;
156
186
  resourceMetadata: Record<string, unknown>;
@@ -161,6 +191,11 @@ interface OAuthSessionStore {
161
191
  load(resource: string): Promise<StoredOAuthSession | null>;
162
192
  save(resource: string, session: StoredOAuthSession): Promise<void>;
163
193
  clear(resource: string): Promise<void>;
194
+ /** Backend-wide lock covering a complete read/redeem/write transaction. */
195
+ withLock?<T>(resource: string, operation: () => Promise<T>, options: {
196
+ signal?: AbortSignal;
197
+ timeoutMs: number;
198
+ }): Promise<T>;
164
199
  }
165
200
  interface DefaultOAuthClientProviderOptions {
166
201
  client: {
@@ -176,6 +211,8 @@ interface DefaultOAuthClientProviderOptions {
176
211
  };
177
212
  /** Disable interactive authorization while allowing cached tokens and silent refresh. */
178
213
  allowInteractive?: boolean;
214
+ /** Maximum wait to acquire a session transaction lock (default 30,000 ms). */
215
+ sessionLockTimeoutMs?: number;
179
216
  /** Import an existing grant for one resource. Persisted sessions take precedence. */
180
217
  initialGrant?: {
181
218
  resource: string;
@@ -649,6 +686,7 @@ declare class HttpTransport implements McpTransport {
649
686
  private readonly oauthMetadataDiscovery;
650
687
  private readonly inFlightFetchAbortControllers;
651
688
  private readonly inFlightOAuthAbortControllers;
689
+ private readonly oauthRequestTokens;
652
690
  private readonly openResponseReaders;
653
691
  private readonly modernRequests;
654
692
  private modernMode;