@lostgradient/mcp 0.2.5 → 0.3.0

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 (123) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +15 -173
  3. package/dist/http.d.ts +35 -0
  4. package/dist/http.js +251 -0
  5. package/dist/internal/cryptography/encryption.d.ts +108 -0
  6. package/dist/internal/cryptography/encryption.js +241 -0
  7. package/dist/internal/cryptography/hash.d.ts +72 -0
  8. package/dist/internal/cryptography/hash.js +233 -0
  9. package/dist/internal/cryptography/index.d.ts +4 -0
  10. package/dist/internal/cryptography/index.js +2 -0
  11. package/dist/oauth/canonicalize-ip-address.d.ts +0 -6
  12. package/dist/oauth/canonicalize-ip-address.js +113 -0
  13. package/dist/oauth/client-metadata-documents.d.ts +2 -22
  14. package/dist/oauth/client-metadata-documents.js +205 -19
  15. package/dist/oauth/index.d.ts +9 -213
  16. package/dist/oauth/index.js +6 -69
  17. package/dist/oauth/issuer.d.ts +103 -0
  18. package/dist/oauth/issuer.js +564 -0
  19. package/dist/oauth/postgres.d.ts +12 -0
  20. package/dist/oauth/postgres.js +76 -0
  21. package/dist/oauth/safe-public-https-fetch.d.ts +3 -5
  22. package/dist/oauth/safe-public-https-fetch.js +114 -0
  23. package/dist/oauth/security-utilities.d.ts +0 -3
  24. package/dist/oauth/security-utilities.js +93 -0
  25. package/dist/oauth-store.d.ts +108 -0
  26. package/dist/oauth-store.js +321 -0
  27. package/package.json +50 -124
  28. package/dist/chunk-3ek3knfm.js +0 -73
  29. package/dist/chunk-3rr24vhh.js +0 -28
  30. package/dist/chunk-6ekjtvcq.js +0 -273
  31. package/dist/chunk-88nhf6xt.js +0 -449
  32. package/dist/chunk-en76akaq.js +0 -1107
  33. package/dist/chunk-k6fm3cmk.js +0 -132
  34. package/dist/chunk-qxwd8est.js +0 -916
  35. package/dist/chunk-rxnyn7tf.js +0 -19
  36. package/dist/chunk-taxyscge.js +0 -67
  37. package/dist/chunk-wsnfttyg.js +0 -4
  38. package/dist/chunk-xcf742mf.js +0 -14
  39. package/dist/conformance-fixture-registration.d.ts +0 -30
  40. package/dist/conformance-server.d.ts +0 -1
  41. package/dist/conformance.d.ts +0 -43
  42. package/dist/env.d.ts +0 -59
  43. package/dist/env.js +0 -9
  44. package/dist/environment-schema.d.ts +0 -29
  45. package/dist/environment-schema.js +0 -6
  46. package/dist/golden-prompts.d.ts +0 -42
  47. package/dist/handler-context.d.ts +0 -16
  48. package/dist/http/authenticate.d.ts +0 -35
  49. package/dist/http/authorization-header.d.ts +0 -5
  50. package/dist/http/grant-revocation-channel.d.ts +0 -24
  51. package/dist/http/handler.d.ts +0 -32
  52. package/dist/http/index.d.ts +0 -27
  53. package/dist/http/index.js +0 -870
  54. package/dist/http/listen-inspection.d.ts +0 -11
  55. package/dist/http/request-context.d.ts +0 -17
  56. package/dist/http/responses.d.ts +0 -13
  57. package/dist/http/serving-layer.d.ts +0 -25
  58. package/dist/http/user-handler-cache.d.ts +0 -37
  59. package/dist/http/user-server-event-bus.d.ts +0 -35
  60. package/dist/index.d.ts +0 -29
  61. package/dist/index.js +0 -616
  62. package/dist/localhost-request-validation.d.ts +0 -2
  63. package/dist/logger.d.ts +0 -59
  64. package/dist/logger.js +0 -18
  65. package/dist/long-running-operation-support.d.ts +0 -34
  66. package/dist/metrics.d.ts +0 -64
  67. package/dist/metrics.js +0 -6
  68. package/dist/oauth/authorize-endpoint.d.ts +0 -5
  69. package/dist/oauth/client-authentication.d.ts +0 -10
  70. package/dist/oauth/discovery-metadata.d.ts +0 -19
  71. package/dist/oauth/endpoint-rate-limits.d.ts +0 -10
  72. package/dist/oauth/endpoint-responses.d.ts +0 -10
  73. package/dist/oauth/network-identity.d.ts +0 -32
  74. package/dist/oauth/pkce-validation.d.ts +0 -2
  75. package/dist/oauth/postgres/client-store.d.ts +0 -12
  76. package/dist/oauth/postgres/code-store.d.ts +0 -14
  77. package/dist/oauth/postgres/database.d.ts +0 -59
  78. package/dist/oauth/postgres/index.d.ts +0 -11
  79. package/dist/oauth/postgres/index.js +0 -616
  80. package/dist/oauth/postgres/schema.d.ts +0 -1476
  81. package/dist/oauth/postgres/token-store.d.ts +0 -16
  82. package/dist/oauth/postgres/transaction-store.d.ts +0 -14
  83. package/dist/oauth/redirect-uri-matching.d.ts +0 -2
  84. package/dist/oauth/registration-endpoint.d.ts +0 -2
  85. package/dist/oauth/request-body.d.ts +0 -14
  86. package/dist/oauth/revocation-endpoint.d.ts +0 -2
  87. package/dist/oauth/scope-utilities.d.ts +0 -15
  88. package/dist/oauth/stores.d.ts +0 -225
  89. package/dist/oauth/stores.js +0 -0
  90. package/dist/oauth/testing/contract-fixtures.d.ts +0 -134
  91. package/dist/oauth/testing/index.d.ts +0 -56
  92. package/dist/oauth/testing/index.js +0 -330
  93. package/dist/oauth/token-endpoint.d.ts +0 -2
  94. package/dist/oauth-scope-configuration.d.ts +0 -3
  95. package/dist/prompts/index.d.ts +0 -5
  96. package/dist/prompts/summarize.d.ts +0 -4
  97. package/dist/rate-limit/in-memory-sliding-window-store.d.ts +0 -3
  98. package/dist/rate-limit/index.d.ts +0 -23
  99. package/dist/rate-limit/index.js +0 -29
  100. package/dist/rate-limit/mcp-concurrency-limiter.d.ts +0 -26
  101. package/dist/rate-limit/rate-limit-response.d.ts +0 -1
  102. package/dist/rate-limit/redis-sliding-window-store.d.ts +0 -2
  103. package/dist/rate-limit/request-rate-limiter.d.ts +0 -10
  104. package/dist/rate-limit/sliding-window-rate-limiter.d.ts +0 -16
  105. package/dist/resources/index.d.ts +0 -4
  106. package/dist/resources/user-profile.d.ts +0 -1
  107. package/dist/scope-vocabulary.d.ts +0 -127
  108. package/dist/scopes.d.ts +0 -49
  109. package/dist/server.d.ts +0 -113
  110. package/dist/supported-scopes.d.ts +0 -25
  111. package/dist/sveltekit-mount-state.d.ts +0 -4
  112. package/dist/sveltekit-mount.d.ts +0 -43
  113. package/dist/sveltekit-mount.js +0 -344
  114. package/dist/template-registry.d.ts +0 -16
  115. package/dist/tool-response.d.ts +0 -100
  116. package/dist/tools/get-user-profile.d.ts +0 -8
  117. package/dist/tools/index.d.ts +0 -16
  118. package/dist/tools/list-audit-events.d.ts +0 -11
  119. package/dist/type-assertions.d.ts +0 -1
  120. package/dist/types/primitives.d.ts +0 -130
  121. package/dist/ui-extension-support.d.ts +0 -20
  122. package/dist/version.d.ts +0 -23
  123. package/dist/version.js +0 -6
@@ -1,16 +0,0 @@
1
- import type { AccessToken, TokenStore } from '../stores.js';
2
- import { type PostgresOAuthDatabase } from './database.js';
3
- import type { PostgresOAuthSchema } from './schema.js';
4
- export declare class PostgresTokenStore implements TokenStore {
5
- private readonly database;
6
- private readonly schema;
7
- constructor(database: PostgresOAuthDatabase, schema: PostgresOAuthSchema);
8
- issueAuthorizationGrant(input: Parameters<TokenStore['issueAuthorizationGrant']>[0]): Promise<void>;
9
- findByHash(tokenHash: string): Promise<AccessToken | null>;
10
- rotateRefreshToken(input: Parameters<TokenStore['rotateRefreshToken']>[0]): ReturnType<TokenStore['rotateRefreshToken']>;
11
- revokeAccessToken(tokenHash: string, clientId: string): Promise<boolean>;
12
- revokeRefreshToken(tokenHash: string, clientId: string): ReturnType<TokenStore['revokeRefreshToken']>;
13
- revokeFamily(familyId: string): Promise<number>;
14
- deleteAllForUser(userId: string): Promise<number>;
15
- purgeExpired(now: Date): Promise<number>;
16
- }
@@ -1,14 +0,0 @@
1
- import type { ConsumedAuthorizationTransaction, TransactionStore } from '../stores.js';
2
- import { type PostgresOAuthDatabase } from './database.js';
3
- import type { PostgresOAuthSchema } from './schema.js';
4
- export declare class PostgresTransactionStore implements TransactionStore {
5
- private readonly database;
6
- private readonly schema;
7
- constructor(database: PostgresOAuthDatabase, schema: PostgresOAuthSchema);
8
- create(input: Parameters<TransactionStore['create']>[0]): Promise<void>;
9
- consume(transactionId: string, csrfToken: string, binding: string, subjectId: string): Promise<ConsumedAuthorizationTransaction | null>;
10
- unconsume(transactionId: string, consumedAt: Date): Promise<boolean>;
11
- deleteByBinding(value: string): Promise<number>;
12
- deleteAllForUser(userId: string): Promise<number>;
13
- purgeExpired(now: Date): Promise<number>;
14
- }
@@ -1,2 +0,0 @@
1
- /** RFC 8252 port-flexible matching for native loopback redirects; every other URI matches exactly. */
2
- export declare function redirectUriMatchesRegistered(requestedUri: string, registeredUris: readonly string[]): boolean;
@@ -1,2 +0,0 @@
1
- import type { OAuthRequestContext, OAuthStatelessHostSeams } from './index.js';
2
- export declare function handleOauthRegisterPost<Scope extends string>(context: OAuthRequestContext, seams: OAuthStatelessHostSeams<Scope>): Promise<Response>;
@@ -1,14 +0,0 @@
1
- export declare const oauthRegisterMaximumBodyBytes: number;
2
- export declare const oauthTokenMaximumBodyBytes: number;
3
- export declare const oauthRevokeMaximumBodyBytes: number;
4
- export declare const oauthAuthorizeApproveMaximumBodyBytes: number;
5
- export declare const oauthAuthorizeDenyMaximumBodyBytes: number;
6
- export declare class PayloadTooLargeError extends Error {
7
- }
8
- export declare class InvalidOauthRequestBodyError extends Error {
9
- readonly kind: 'unsupported_content_type' | 'invalid_request';
10
- constructor(message: string, kind?: 'unsupported_content_type' | 'invalid_request');
11
- }
12
- export declare function readBoundedText(request: Request, maximumBytes: number): Promise<string>;
13
- export declare function readOauthJson(request: Request, maximumBytes: number): Promise<unknown>;
14
- export declare function readOauthParameters(request: Request, maximumBytes: number): Promise<Record<string, string>>;
@@ -1,2 +0,0 @@
1
- import type { OAuthRequestContext, OAuthStatelessHostSeams } from './index.js';
2
- export declare function handleOauthRevokePost<Scope extends string>(context: OAuthRequestContext, seams: OAuthStatelessHostSeams<Scope>): Promise<Response>;
@@ -1,15 +0,0 @@
1
- export declare function splitScopes(value: string): string[];
2
- export declare function canonicalizeScopes(values: readonly string[]): string;
3
- export declare function parseRequestedScope<Scope extends string>(value: string | null, supportedScopes: readonly Scope[]): {
4
- ok: true;
5
- scope: string;
6
- } | {
7
- ok: false;
8
- unknownScopes: string[];
9
- };
10
- export declare function parseRefreshScope<Scope extends string>(value: string | undefined, supportedScopes: readonly Scope[]): {
11
- ok: true;
12
- requestedScope?: string;
13
- } | {
14
- ok: false;
15
- };
@@ -1,225 +0,0 @@
1
- export type AuthorizationTransaction = {
2
- /** Store-derived hash of the opaque transaction identifier. */
3
- transactionIdHash: string;
4
- userId: string;
5
- clientId: string;
6
- redirectUri: string;
7
- codeChallenge: string;
8
- codeChallengeMethod: string;
9
- state: string | null;
10
- issuer: string;
11
- resource: string;
12
- scope: string;
13
- expiresAt: Date;
14
- consumedAt: Date | null;
15
- createdAt: Date;
16
- };
17
- export type AuthorizationCode = {
18
- /** Hash of the one-time credential; plaintext authorization codes are never persisted. */
19
- codeHash: string;
20
- clientId: string;
21
- userId: string;
22
- redirectUri: string;
23
- codeChallenge: string;
24
- codeChallengeMethod: string;
25
- scope: string | null;
26
- state: string | null;
27
- resource: string;
28
- expiresAt: Date;
29
- usedAt: Date | null;
30
- createdAt: Date;
31
- };
32
- export type AccessToken = {
33
- /** Hash of the bearer credential; plaintext access tokens are never persisted. */
34
- accessTokenHash: string;
35
- clientId: string;
36
- userId: string;
37
- scope: string | null;
38
- resource: string;
39
- expiresAt: Date;
40
- revokedAt: Date | null;
41
- createdAt: Date;
42
- };
43
- export type RefreshToken = {
44
- /** Hash of the bearer credential; plaintext refresh tokens are never persisted. */
45
- refreshTokenHash: string;
46
- clientId: string;
47
- userId: string;
48
- scope: string | null;
49
- resource: string;
50
- accessTokenHash: string;
51
- familyId: string;
52
- expiresAt: Date;
53
- revokedAt: Date | null;
54
- createdAt: Date;
55
- };
56
- export type RegisteredClient = {
57
- clientId: string;
58
- /** Hash of the client credential; null for public clients. */
59
- clientSecretHash: string | null;
60
- clientName: string;
61
- clientType: string;
62
- tokenEndpointAuthMethod: string;
63
- applicationType: string | null;
64
- redirectUris: string[];
65
- grantTypes: string[];
66
- responseTypes: string[];
67
- clientIdMetadataUrl: string | null;
68
- /** Null preserves the legacy meaning that no client-secret expiry is enforced. */
69
- clientSecretExpiresAt: Date | null;
70
- createdAt: Date;
71
- updatedAt: Date;
72
- };
73
- export type ConsumedAuthorizationTransaction = AuthorizationTransaction & {
74
- consumedAt: Date;
75
- };
76
- export type ConsumedAuthorizationCode = AuthorizationCode & {
77
- usedAt: Date;
78
- };
79
- export interface TransactionStore {
80
- /**
81
- * Persists hashes of both plaintext secrets using one store-owned hashing
82
- * scheme. The plaintext values must never be retained in the record.
83
- */
84
- create(input: {
85
- record: Omit<AuthorizationTransaction, 'transactionIdHash'>;
86
- transactionId: string;
87
- csrfToken: string;
88
- consentBinding: string;
89
- }): Promise<void>;
90
- /**
91
- * Atomically consumes a live, unused transaction matching the transaction
92
- * identifier, CSRF token, durable subject, and identity binding. The implementation must
93
- * enforce every predicate in one operation; read-then-write stores are
94
- * non-conforming because concurrent approvals could both succeed.
95
- */
96
- consume(transactionId: string, csrfToken: string, binding: string, subjectId: string): Promise<ConsumedAuthorizationTransaction | null>;
97
- /** Reopens only the exact consumption returned by `consume`. */
98
- unconsume(transactionId: string, consumedAt: Date): Promise<boolean>;
99
- /**
100
- * Deletes every transaction whose opaque consent binding equals `value`.
101
- * The store compares the value for equality and must never parse or infer
102
- * identity granularity from it.
103
- */
104
- deleteByBinding(value: string): Promise<number>;
105
- /** Deletes every authorization transaction attributed to the durable subject. */
106
- deleteAllForUser(userId: string): Promise<number>;
107
- purgeExpired(now: Date): Promise<number>;
108
- }
109
- export interface CodeStore {
110
- /** Persists an authorization-code record containing only the code hash. */
111
- issue(record: AuthorizationCode): Promise<void>;
112
- /** Reads validation predicates by hash without spending the code. */
113
- findByHash(codeHash: string): Promise<AuthorizationCode | null>;
114
- /**
115
- * Atomically consumes an unused code whose expiry is later than `now`. A
116
- * second consume call for the same hash, or a call at or after expiry,
117
- * returns null.
118
- */
119
- consume(codeHash: string, now: Date): Promise<ConsumedAuthorizationCode | null>;
120
- /** Reopens only the exact consumption returned by `consume`. */
121
- unconsume(codeHash: string, usedAt: Date): Promise<boolean>;
122
- /** Deletes every authorization code attributed to the durable subject. */
123
- deleteAllForUser(userId: string): Promise<number>;
124
- purgeExpired(now: Date): Promise<number>;
125
- }
126
- export type RefreshTokenRevocationTarget = {
127
- /** Subject whose live MCP streams must be disconnected after revocation. */
128
- userId: string;
129
- /** Token family whose replay was detected or whose grant was revoked. */
130
- familyId: string;
131
- };
132
- export interface TokenStore {
133
- /** Atomically persists the hashed access token and optional hashed root refresh token. */
134
- issueAuthorizationGrant(input: {
135
- accessToken: AccessToken;
136
- refreshToken?: RefreshToken;
137
- }): Promise<void>;
138
- findByHash(tokenHash: string): Promise<AccessToken | null>;
139
- /**
140
- * Loads and validates the prior opaque token, then derives subject, scope,
141
- * resource, and family fields for both replacements inside one operation.
142
- * Successful rotation also revokes the access token paired with the prior
143
- * refresh token before returning the replacement credentials.
144
- * A requested scope must be a subset of the stored grant and is rejected
145
- * without consuming the prior token otherwise. Replaying an already-rotated
146
- * token atomically revokes its family before returning `replay_revoked`.
147
- */
148
- rotateRefreshToken(input: {
149
- priorHash: string;
150
- clientId: string;
151
- resource: string;
152
- /** Optional normalized scope request; the store rejects any non-subset. */
153
- requestedScope?: string;
154
- nextAccessTokenHash: string;
155
- nextRefreshTokenHash: string;
156
- accessTokenExpiresAt: Date;
157
- refreshTokenExpiresAt: Date;
158
- createdAt: Date;
159
- }): Promise<{
160
- status: 'rotated';
161
- accessToken: AccessToken;
162
- refreshToken: RefreshToken;
163
- } | ({
164
- status: 'replay_revoked';
165
- } & RefreshTokenRevocationTarget) | {
166
- status: 'scope_rejected';
167
- } | {
168
- status: 'invalid';
169
- }>;
170
- /** Revokes a client-owned access token and its paired refresh token, if any. */
171
- revokeAccessToken(tokenHash: string, clientId: string): Promise<boolean>;
172
- /**
173
- * Revokes a client-owned refresh token and its paired access token. Replaying
174
- * a rotated token atomically revokes its family and returns `replay_revoked`.
175
- */
176
- revokeRefreshToken(tokenHash: string, clientId: string): Promise<({
177
- status: 'revoked' | 'replay_revoked';
178
- } & RefreshTokenRevocationTarget) | {
179
- status: 'invalid';
180
- }>;
181
- /**
182
- * Revokes the refresh-token family and all access tokens descended from it
183
- * in one atomic statement or an equivalently non-interleavable operation.
184
- */
185
- revokeFamily(familyId: string): Promise<number>;
186
- /** Deletes every access and refresh token attributed to the durable subject. */
187
- deleteAllForUser(userId: string): Promise<number>;
188
- /**
189
- * Deletes expired access tokens and refresh tokens whose `expiresAt` is at
190
- * or before `now`. A rotated refresh token remains observable until its own
191
- * expiry so presenting it again can still trigger family replay revocation;
192
- * rotation alone never makes a refresh token eligible for this purge.
193
- */
194
- purgeExpired(now: Date): Promise<number>;
195
- }
196
- /**
197
- * Client registrations are not user-owned and therefore have no
198
- * `deleteAllForUser` operation. Secret expiry is enforced when the client
199
- * authenticates; deleting the registration would prevent secret rotation.
200
- */
201
- export interface ClientStore {
202
- register(record: RegisteredClient): Promise<void>;
203
- /** Atomically creates or replaces a client sourced from refreshed metadata. */
204
- upsert(record: RegisteredClient): Promise<void>;
205
- findById(clientId: string): Promise<RegisteredClient | null>;
206
- update(clientId: string, patch: Partial<RegisteredClient>): Promise<void>;
207
- }
208
- export type OAuthUserDeletionResult = {
209
- transactions: number;
210
- codes: number;
211
- tokens: number;
212
- };
213
- export type OAuthStores = {
214
- transactions: TransactionStore;
215
- codes: CodeStore;
216
- tokens: TokenStore;
217
- clients: ClientStore;
218
- /**
219
- * Deletes all user-owned OAuth state across the transaction, code, and token
220
- * stores. A Postgres adapter may satisfy this through referential cascade;
221
- * a backing store without referential integrity must explicitly fan out to
222
- * all three stores.
223
- */
224
- deleteAllForUser(userId: string): Promise<OAuthUserDeletionResult>;
225
- };
File without changes
@@ -1,134 +0,0 @@
1
- import type { MinimalRedisClient } from '../index.js';
2
- import type { ClientStore } from '../stores.js';
3
- type ClientStoreOmitsUserDeletion = 'deleteAllForUser' extends keyof ClientStore ? never : true;
4
- export declare const clientStoreOmitsUserDeletionContractFixture: ClientStoreOmitsUserDeletion;
5
- export declare const storeContractFixture: {
6
- transactions: {
7
- create: () => Promise<void>;
8
- consume: () => Promise<null>;
9
- unconsume: () => Promise<boolean>;
10
- deleteByBinding: () => Promise<number>;
11
- deleteAllForUser: () => Promise<number>;
12
- purgeExpired: () => Promise<number>;
13
- };
14
- codes: {
15
- issue: () => Promise<void>;
16
- findByHash: () => Promise<null>;
17
- consume: () => Promise<null>;
18
- unconsume: () => Promise<boolean>;
19
- deleteAllForUser: () => Promise<number>;
20
- purgeExpired: () => Promise<number>;
21
- };
22
- tokens: {
23
- issueAuthorizationGrant: () => Promise<void>;
24
- findByHash: () => Promise<null>;
25
- rotateRefreshToken: () => Promise<{
26
- status: "invalid";
27
- }>;
28
- revokeAccessToken: () => Promise<boolean>;
29
- revokeRefreshToken: () => Promise<{
30
- status: "invalid";
31
- }>;
32
- revokeFamily: () => Promise<number>;
33
- deleteAllForUser: () => Promise<number>;
34
- purgeExpired: () => Promise<number>;
35
- };
36
- clients: {
37
- register: () => Promise<void>;
38
- upsert: () => Promise<void>;
39
- findById: () => Promise<null>;
40
- update: () => Promise<void>;
41
- };
42
- deleteAllForUser: () => Promise<{
43
- transactions: number;
44
- codes: number;
45
- tokens: number;
46
- }>;
47
- };
48
- export declare const identityContractFixture: () => Promise<null>;
49
- export declare const userProfileContractFixture: () => Promise<null>;
50
- export declare const unauthenticatedAuthorizationContractFixture: () => Response;
51
- export declare const consentContractFixture: () => Response;
52
- export declare const scopeContractFixture: import("../index.js").OAuthScopeConfiguration<"repositories:read">;
53
- export declare const configurationContractFixture: {
54
- issuer: string;
55
- baseUrl: URL;
56
- resource: URL;
57
- accessTokenTtlSeconds: number;
58
- refreshTokenTtlSeconds: number;
59
- clientSecretTtlSeconds: number;
60
- isTrustedOrigin: () => true;
61
- trustedProxy: {
62
- trustedProxyCidrs: never[];
63
- trustedProxyHeader: undefined;
64
- trustedProxyHopCount: number;
65
- };
66
- rateLimits: {
67
- categories: {
68
- oauth_authorize: {
69
- maximumRequests: number;
70
- windowSeconds: number;
71
- };
72
- oauth_register: {
73
- maximumRequests: number;
74
- windowSeconds: number;
75
- };
76
- oauth_token_network: {
77
- maximumRequests: number;
78
- windowSeconds: number;
79
- };
80
- oauth_token_client: {
81
- maximumRequests: number;
82
- windowSeconds: number;
83
- };
84
- oauth_revoke: {
85
- maximumRequests: number;
86
- windowSeconds: number;
87
- };
88
- mcp_network: {
89
- maximumRequests: number;
90
- windowSeconds: number;
91
- };
92
- mcp_user: {
93
- maximumRequests: number;
94
- windowSeconds: number;
95
- };
96
- failed_authentication: {
97
- maximumRequests: number;
98
- windowSeconds: number;
99
- };
100
- };
101
- maximumConcurrent: number;
102
- };
103
- mcpUiExtension: {
104
- enabled: true;
105
- };
106
- rateLimitStores: {
107
- slidingWindow: {
108
- consume: () => Promise<{
109
- allowed: true;
110
- retryAfterMilliseconds: number;
111
- remainingRequests: number;
112
- }>;
113
- peek: () => Promise<number>;
114
- };
115
- concurrencySlots: {
116
- acquire: () => Promise<null>;
117
- renew: () => Promise<boolean>;
118
- release: () => Promise<void>;
119
- };
120
- };
121
- };
122
- export declare const crossInstanceMessagingContractFixture: {
123
- publish: () => Promise<void>;
124
- subscribe: () => Promise<() => Promise<void>>;
125
- };
126
- export declare const requestContextContractFixture: {
127
- request: Request;
128
- requestUrl: URL;
129
- requestId: string;
130
- socketAddress: string;
131
- identity: null;
132
- };
133
- export declare const structuralRedisClientContractFixture: MinimalRedisClient;
134
- export {};
@@ -1,56 +0,0 @@
1
- import type { AccessToken, AuthorizationCode, AuthorizationTransaction, ClientStore, CodeStore, ConsumedAuthorizationCode, ConsumedAuthorizationTransaction, OAuthStores, RefreshToken, RegisteredClient, TokenStore, TransactionStore } from '../stores.js';
2
- export declare class InMemoryTransactionStore implements TransactionStore {
3
- #private;
4
- create(input: {
5
- record: Omit<AuthorizationTransaction, 'transactionIdHash'>;
6
- transactionId: string;
7
- csrfToken: string;
8
- consentBinding: string;
9
- }): Promise<void>;
10
- consume(transactionId: string, csrfToken: string, binding: string, subjectId: string): Promise<ConsumedAuthorizationTransaction | null>;
11
- unconsume(transactionId: string, consumedAt: Date): Promise<boolean>;
12
- deleteByBinding(value: string): Promise<number>;
13
- deleteAllForUser(userId: string): Promise<number>;
14
- purgeExpired(now: Date): Promise<number>;
15
- }
16
- export declare class InMemoryCodeStore implements CodeStore {
17
- #private;
18
- issue(record: AuthorizationCode): Promise<void>;
19
- findByHash(codeHash: string): Promise<AuthorizationCode | null>;
20
- consume(codeHash: string, now: Date): Promise<ConsumedAuthorizationCode | null>;
21
- unconsume(codeHash: string, usedAt: Date): Promise<boolean>;
22
- deleteAllForUser(userId: string): Promise<number>;
23
- purgeExpired(now: Date): Promise<number>;
24
- }
25
- export declare class InMemoryTokenStore implements TokenStore {
26
- #private;
27
- issueAuthorizationGrant(input: {
28
- accessToken: AccessToken;
29
- refreshToken?: RefreshToken;
30
- }): Promise<void>;
31
- findByHash(tokenHash: string): Promise<AccessToken | null>;
32
- rotateRefreshToken(input: {
33
- priorHash: string;
34
- clientId: string;
35
- resource: string;
36
- requestedScope?: string;
37
- nextAccessTokenHash: string;
38
- nextRefreshTokenHash: string;
39
- accessTokenExpiresAt: Date;
40
- refreshTokenExpiresAt: Date;
41
- createdAt: Date;
42
- }): ReturnType<TokenStore['rotateRefreshToken']>;
43
- revokeAccessToken(tokenHash: string, clientId: string): Promise<boolean>;
44
- revokeRefreshToken(tokenHash: string, clientId: string): ReturnType<TokenStore['revokeRefreshToken']>;
45
- revokeFamily(familyId: string): Promise<number>;
46
- deleteAllForUser(userId: string): Promise<number>;
47
- purgeExpired(now: Date): Promise<number>;
48
- }
49
- export declare class InMemoryClientStore implements ClientStore {
50
- #private;
51
- register(record: RegisteredClient): Promise<void>;
52
- upsert(record: RegisteredClient): Promise<void>;
53
- findById(clientId: string): Promise<RegisteredClient | null>;
54
- update(clientId: string, patch: Partial<RegisteredClient>): Promise<void>;
55
- }
56
- export declare function createInMemoryOAuthStores(): OAuthStores;