fix(mcp): coordinate OAuth token refresh and authorization polling

Prevent concurrent refresh-token rotation across instances, distinguish
expired-but-refreshable tokens from active authorization, and bind OAuth
popup polling to a per-attempt ID so stale tokens cannot satisfy new consent.
This commit is contained in:
wizardchen
2026-07-23 15:33:20 +08:00
committed by lyingbug
parent c74b0caa35
commit 8ae82573ab
31 changed files with 1418 additions and 109 deletions
+26 -6
View File
@@ -331,6 +331,9 @@ definitions:
- kb.share_permission_changed
- kb.share_removed
- wiki.content_changed
- faq.import_started
- faq.import_completed
- faq.import_failed
type: string
x-enum-varnames:
- AuditActionMemberAdded
@@ -390,6 +393,9 @@ definitions:
- AuditActionKBSharePermissionChanged
- AuditActionKBShareRemoved
- AuditActionWikiContentChanged
- AuditActionFAQImportStarted
- AuditActionFAQImportCompleted
- AuditActionFAQImportFailed
github_com_Tencent_WeKnora_internal_types.AuditLog:
properties:
action:
@@ -8328,10 +8334,14 @@ paths:
in: query
name: page_size
type: integer
- description: 标签ID筛选(seq_id)
- description: 标签ID筛选(seq_id),兼容旧版单标签
in: query
name: tag_id
type: integer
- description: 标签UUID筛选,逗号分隔(OR语义)
in: query
name: tag_ids
type: string
- description: 关键词搜索
in: query
name: keyword
@@ -8525,18 +8535,23 @@ paths:
get:
consumes:
- application/json
description: 将所有FAQ条目导出为CSV文件
description: 将所有FAQ条目导出为 CSV(默认)或 JSON。?format=json 返回与 FAQEntryPayload 结构兼容的数组。
parameters:
- description: 知识库ID
in: path
name: id
required: true
type: string
- description: 导出格式:csv(默认)或 json
in: query
name: format
type: string
produces:
- text/csv
- application/json
responses:
"200":
description: CSV文件
description: 导出文件
schema:
type: file
"400":
@@ -10900,7 +10915,7 @@ paths:
- application/json
responses:
"200":
description: '{authorization_url: string}'
description: '{authorization_url: string, authorization_attempt: string}'
schema:
additionalProperties: true
type: object
@@ -10915,18 +10930,23 @@ paths:
- MCP服务
/mcp-services/{id}/oauth/status:
get:
description: 返回当前用户对指定 MCP 服务是否已完成 OAuth 授权
description: 返回当前用户的 OAuth Token 生命周期状态;传 authorization_attempt 时只检查本次授权流程
parameters:
- description: MCP 服务 ID
in: path
name: id
required: true
type: string
- description: 本次授权尝试 ID;传入后不会接受历史 Token
in: query
name: authorization_attempt
type: string
produces:
- application/json
responses:
"200":
description: '{authorized: bool}'
description: '{authorized: bool, state: string, refresh_available: bool,
expires_at?: string}'
schema:
additionalProperties: true
type: object