@better-auth/mcp 1.7.0-beta.6 → 1.7.0-beta.7

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/index.d.mts CHANGED
@@ -23,6 +23,18 @@ verifyOptions: Parameters<typeof verifyAccessTokenRequest>[1], handler: (req: Re
23
23
  * the MCP resource identifier.
24
24
  */
25
25
  interface McpOptions extends OAuthOptions<Scope[]> {
26
+ /**
27
+ * Seconds that a rotated refresh token can be reused to receive the same
28
+ * token response for the same effective scopes, requested resources, and
29
+ * sender constraint.
30
+ *
31
+ * MCP overrides the OAuth Provider default because native/public MCP clients
32
+ * can have multiple local sessions racing the same refresh token. Set to `0`
33
+ * to keep strict replay handling.
34
+ *
35
+ * @default 30
36
+ */
37
+ refreshTokenReuseInterval?: OAuthOptions<Scope[]>["refreshTokenReuseInterval"];
26
38
  /**
27
39
  * The protected resource identifier (RFC 8707 / RFC 9728) that access tokens
28
40
  * are bound to. Published as `resource` in the protected resource metadata,
@@ -37,6 +49,9 @@ interface McpOptions extends OAuthOptions<Scope[]> {
37
49
  * MCP: it enables dynamic client registration, binds issued tokens to the MCP
38
50
  * `resource`, and, as the resource server, serves the RFC 9728 protected resource
39
51
  * metadata so MCP clients discover and use it through standard OAuth discovery.
52
+ * It also defaults `refreshTokenReuseInterval` to 30 seconds for native/public
53
+ * MCP clients that may retry a refresh after a local process loses the rotated
54
+ * response.
40
55
  * Because it is the OAuth provider, it cannot be combined with a separate
41
56
  * {@link oauthProvider}.
42
57
  *
package/dist/index.mjs CHANGED
@@ -85,6 +85,9 @@ const buildResourceServerMetadata = (ctx, providerOptions, resource) => {
85
85
  * MCP: it enables dynamic client registration, binds issued tokens to the MCP
86
86
  * `resource`, and, as the resource server, serves the RFC 9728 protected resource
87
87
  * metadata so MCP clients discover and use it through standard OAuth discovery.
88
+ * It also defaults `refreshTokenReuseInterval` to 30 seconds for native/public
89
+ * MCP clients that may retry a refresh after a local process loses the rotated
90
+ * response.
88
91
  * Because it is the OAuth provider, it cannot be combined with a separate
89
92
  * {@link oauthProvider}.
90
93
  *
@@ -107,11 +110,12 @@ const buildResourceServerMetadata = (ctx, providerOptions, resource) => {
107
110
  * ```
108
111
  */
109
112
  const mcp = (options) => {
110
- const { resource, ...oauthOptions } = options;
113
+ const { resource, refreshTokenReuseInterval = 30, ...oauthOptions } = options;
111
114
  ResourceUriSchema.parse(resource);
112
115
  const provider = oauthProvider({
113
116
  allowDynamicClientRegistration: true,
114
117
  allowUnauthenticatedClientRegistration: true,
118
+ refreshTokenReuseInterval,
115
119
  ...oauthOptions,
116
120
  resources: appendProtectedResource(oauthOptions.resources, resource)
117
121
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/mcp",
3
- "version": "1.7.0-beta.6",
3
+ "version": "1.7.0-beta.7",
4
4
  "description": "Model Context Protocol (MCP) plugin for Better Auth",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -63,22 +63,22 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "jose": "^6.1.3",
66
- "@better-auth/oauth-provider": "^1.7.0-beta.6"
66
+ "@better-auth/oauth-provider": "^1.7.0-beta.10"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@modelcontextprotocol/sdk": "^1.27.1",
70
- "better-call": "1.3.6",
70
+ "better-call": "1.3.7",
71
71
  "listhen": "1.9.0",
72
72
  "tsdown": "0.21.1",
73
- "@better-auth/core": "1.7.0-beta.6",
74
- "better-auth": "1.7.0-beta.6"
73
+ "@better-auth/core": "1.7.0-beta.10",
74
+ "better-auth": "1.7.0-beta.10"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@better-auth/utils": "0.4.2",
78
78
  "@better-fetch/fetch": "1.3.1",
79
- "better-call": "1.3.6",
80
- "@better-auth/core": "^1.7.0-beta.6",
81
- "better-auth": "^1.7.0-beta.6"
79
+ "better-call": "1.3.7",
80
+ "@better-auth/core": "^1.7.0-beta.10",
81
+ "better-auth": "^1.7.0-beta.10"
82
82
  },
83
83
  "scripts": {
84
84
  "build": "tsdown",