Set MCP access token TTL to 24 hours (#191)

This commit is contained in:
Ben Senescu 2026-05-13 15:01:32 -04:00 committed by GitHub
parent fa20de2126
commit 49a2d7f732
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -37,7 +37,10 @@ const OAUTH_AUTHORIZATION_PARAM_NAMES = [
"code_challenge_method",
"resource",
] as const;
const REFRESH_TOKEN_TTL_SECONDS = 60 * 60 * 24 * 30;
// Keep access tokens reasonably short-lived while allowing refresh tokens to
// preserve MCP sessions across normal usage.
const MCP_ACCESS_TOKEN_TTL_SECONDS = 60 * 60 * 24;
const MCP_REFRESH_TOKEN_TTL_SECONDS = 60 * 60 * 24 * 30;
export type OpenSeoOAuthEnv = Env & {
OAUTH_KV: KVNamespace;
@ -390,7 +393,8 @@ export function createOpenSeoOAuthProvider(appFetch: AppFetch) {
tokenEndpoint: OAUTH_TOKEN_PATH,
clientRegistrationEndpoint: OAUTH_REGISTER_PATH,
scopesSupported: [...MCP_OAUTH_SCOPES],
refreshTokenTTL: REFRESH_TOKEN_TTL_SECONDS,
accessTokenTTL: MCP_ACCESS_TOKEN_TTL_SECONDS,
refreshTokenTTL: MCP_REFRESH_TOKEN_TTL_SECONDS,
resourceMetadata: {
scopes_supported: [...MCP_OAUTH_SCOPES],
resource_name: "OpenSEO MCP",

View File

@ -3,7 +3,7 @@
"name": "open-seo",
"main": "src/server.ts",
"compatibility_date": "2025-09-02",
"compatibility_flags": ["nodejs_compat"],
"compatibility_flags": ["nodejs_compat", "global_fetch_strictly_public"],
"observability": {
"enabled": true,
},