@gydr-ai/mcp-oauth 0.1.1 → 0.1.3

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -57,6 +57,13 @@ export interface Lifetimes {
57
57
  * (90 days).
58
58
  */
59
59
  readonly grant?: number;
60
+ /**
61
+ * Sliding limit on a grant: it also ends when it has not been renewed with
62
+ * a refresh token for this long, and each renewal extends it again, never
63
+ * beyond `grant`. `0` (off), or from `accessToken` up to 34,560,000.
64
+ * Default: 0.
65
+ */
66
+ readonly grantIdle?: number;
60
67
  /** Authorization code lifetime, 1 to 600. Default: 60. */
61
68
  readonly authorizationCode?: number;
62
69
  /** Time allowed for sign-in plus consent, 1 to 3600. Default: 900 (15 minutes). */
@@ -291,6 +298,16 @@ export interface McpAuthOptions {
291
298
  readonly scopes?: readonly string[];
292
299
  /** Scopes granted when a client asks for none. Default: all `scopes`. */
293
300
  readonly defaultScopes?: readonly string[];
301
+ /**
302
+ * Grant types a registered client or metadata document gets when it names
303
+ * none. RFC 7591 § 2 reads an absent `grant_types` as
304
+ * `["authorization_code"]`, so such a client receives no refresh token;
305
+ * `["authorization_code", "refresh_token"]` gives it one. Must include
306
+ * `authorization_code`. Applies when a client registers or a metadata
307
+ * document is fetched, not to clients already registered, and not to
308
+ * `clients`, which default to both. Default: `["authorization_code"]`.
309
+ */
310
+ readonly defaultGrantTypes?: readonly ("authorization_code" | "refresh_token")[];
294
311
  /**
295
312
  * Plain-language description per scope, shown on the consent screen (and
296
313
  * escaped). Keys must be listed in `scopes`. Default: none.
@@ -279,9 +279,14 @@ export interface GrantRecord {
279
279
  * or `McpAuth.updateGrantData` (JSON, at most `limits.grantDataBytes`).
280
280
  */
281
281
  readonly data?: unknown;
282
+ /** The redirect URI the approved authorization was sent to. */
283
+ readonly redirectUri?: string;
282
284
  /** When the person approved. */
283
285
  readonly createdAt: number;
284
- /** Absolute end of the grant; no token outlives it. */
286
+ /**
287
+ * End of the grant; no token outlives it. With `lifetimes.grantIdle` it
288
+ * moves forward on each refresh, never past `createdAt + lifetimes.grant`.
289
+ */
285
290
  readonly expiresAt: number;
286
291
  }
287
292
  /**
@@ -305,6 +310,8 @@ export interface GrantUpstreamUpdate {
305
310
  readonly upstreamAccessTokenExpiresAt?: number;
306
311
  /** New integrator data for the grant (see `GrantRecord.data`). */
307
312
  readonly data?: unknown;
313
+ /** New end of the grant, after a refresh under `lifetimes.grantIdle`. */
314
+ readonly expiresAt?: number;
308
315
  }
309
316
  /**
310
317
  * An issued access token, stored by hash.
@@ -147,8 +147,10 @@ export interface OAuthStore {
147
147
  /** Read a grant. */
148
148
  getGrant(grantId: string): Promise<GrantRecord | undefined>;
149
149
  /**
150
- * Update the upstream-token fields of an existing grant. Resolves `false`,
151
- * writing nothing, when the grant no longer exists.
150
+ * Update fields of an existing grant: the upstream tokens, `data`, or
151
+ * `expiresAt` (a refresh under `lifetimes.grantIdle`). Save every field
152
+ * given. Resolves `false`, writing nothing, when the grant no longer
153
+ * exists.
152
154
  */
153
155
  updateGrant(grantId: string, update: GrantUpstreamUpdate): Promise<boolean>;
154
156
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gydr-ai/mcp-oauth",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "OAuth 2.1 authorization server and resource-server guard for remote MCP servers, in front of any OIDC identity provider. No token passthrough, consent on every authorization, DCR and Client ID Metadata Documents.",
5
5
  "keywords": [
6
6
  "mcp",
@@ -56,11 +56,11 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "@gydr-ai/safe-fetch": "^0.1.1",
59
- "jose": "^6.2.13"
59
+ "jose": "^6.2.14"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/node": "26.6.6",
63
- "@vitest/coverage-v8": "4.1.12",
63
+ "@vitest/coverage-v8": "5.0.5",
64
64
  "@vitest/eslint-plugin": "1.6.28",
65
65
  "esbuild": "0.28.2",
66
66
  "eslint": "10.13.0",
@@ -68,6 +68,6 @@
68
68
  "prettier": "3.9.10",
69
69
  "typescript": "6.0.3",
70
70
  "typescript-eslint": "8.72.1",
71
- "vitest": "4.1.12"
71
+ "vitest": "5.0.5"
72
72
  }
73
73
  }