diff --git a/apps/client/public/locales/en-US/translation.json b/apps/client/public/locales/en-US/translation.json index 86a97d352..c2457dea3 100644 --- a/apps/client/public/locales/en-US/translation.json +++ b/apps/client/public/locales/en-US/translation.json @@ -708,9 +708,9 @@ "MCP is only available in the Docmost enterprise edition. Contact sales@docmost.com.": "MCP is only available in the Docmost enterprise edition. Contact sales@docmost.com.", "MCP Server URL": "MCP Server URL", "Connect AI assistants with your Docmost account via OAuth.": "Connect AI assistants with your Docmost account via OAuth.", - "Require OAuth": "Require OAuth", + "Enforce OAuth": "Enforce OAuth", "AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.": "AI assistants must connect with a Docmost account via OAuth. API keys cannot be used with the MCP server.", - "Toggle require OAuth for MCP": "Toggle require OAuth for MCP", + "Toggle enforce OAuth for MCP": "Toggle enforce OAuth for MCP", "Supported tools": "Supported tools", "MCP server URL:": "MCP server URL:", "Learn more": "Learn more", diff --git a/apps/client/src/ee/ai/components/mcp-settings.tsx b/apps/client/src/ee/ai/components/mcp-settings.tsx index eeb7ad47e..20952ad73 100644 --- a/apps/client/src/ee/ai/components/mcp-settings.tsx +++ b/apps/client/src/ee/ai/components/mcp-settings.tsx @@ -111,7 +111,7 @@ export default function McpSettings() { {t("Connect AI assistants with your Docmost account via OAuth.")} - +
@@ -156,17 +156,17 @@ export default function McpSettings() { ); } -function McpOauthOnlySetting() { +function McpEnforceOauthSetting() { const { t } = useTranslation(); const [workspace, setWorkspace] = useAtom(workspaceAtom); - const [checked, setChecked] = useState(workspace?.settings?.ai?.mcpOauthOnly); + const [checked, setChecked] = useState(workspace?.settings?.ai?.enforceMcpOauth); const hasAccess = useHasFeature(Feature.MCP_CONTROLS); const upgradeLabel = useUpgradeLabel(); const handleChange = async (event: React.ChangeEvent) => { const value = event.currentTarget.checked; try { - const updatedWorkspace = await updateWorkspace({ mcpOauthOnly: value }); + const updatedWorkspace = await updateWorkspace({ enforceMcpOauth: value }); setChecked(value); setWorkspace(updatedWorkspace); } catch (err) { @@ -182,7 +182,7 @@ function McpOauthOnlySetting() {
- {t("Require OAuth")} + {t("Enforce OAuth")} {!hasAccess && ( @@ -202,7 +202,7 @@ function McpOauthOnlySetting() { defaultChecked={checked} onChange={handleChange} disabled={!hasAccess} - aria-label={t("Toggle require OAuth for MCP")} + aria-label={t("Toggle enforce OAuth for MCP")} /> diff --git a/apps/client/src/features/workspace/types/workspace.types.ts b/apps/client/src/features/workspace/types/workspace.types.ts index 1722370ef..80bf1f69d 100644 --- a/apps/client/src/features/workspace/types/workspace.types.ts +++ b/apps/client/src/features/workspace/types/workspace.types.ts @@ -27,7 +27,7 @@ export interface IWorkspace { mcpEnabled?: boolean; aiChatReadOnly?: boolean; aiChatWorkspaceKnowledgeOnly?: boolean; - mcpOauthOnly?: boolean; + enforceMcpOauth?: boolean; trashRetentionDays?: number; restrictApiToAdmins?: boolean; allowMemberTemplates?: boolean; @@ -53,7 +53,7 @@ export interface IWorkspaceAiSettings { search?: boolean; generative?: boolean; mcp?: boolean; - mcpOauthOnly?: boolean; + enforceMcpOauth?: boolean; chat?: boolean; chatReadOnly?: boolean; chatWorkspaceKnowledgeOnly?: boolean; diff --git a/apps/server/src/core/workspace/dto/update-workspace.dto.ts b/apps/server/src/core/workspace/dto/update-workspace.dto.ts index 55b19283d..51b749516 100644 --- a/apps/server/src/core/workspace/dto/update-workspace.dto.ts +++ b/apps/server/src/core/workspace/dto/update-workspace.dto.ts @@ -79,5 +79,5 @@ export class UpdateWorkspaceDto extends PartialType(CreateWorkspaceDto) { @IsOptional() @IsBoolean() - mcpOauthOnly: boolean; + enforceMcpOauth: boolean; } diff --git a/apps/server/src/core/workspace/services/workspace.service.ts b/apps/server/src/core/workspace/services/workspace.service.ts index efb10a647..1f5db0fec 100644 --- a/apps/server/src/core/workspace/services/workspace.service.ts +++ b/apps/server/src/core/workspace/services/workspace.service.ts @@ -337,7 +337,7 @@ export class WorkspaceService { typeof updateWorkspaceDto.allowPersonalSpaces !== 'undefined' || typeof updateWorkspaceDto.aiChatReadOnly !== 'undefined' || typeof updateWorkspaceDto.aiChatWorkspaceKnowledgeOnly !== 'undefined' || - typeof updateWorkspaceDto.mcpOauthOnly !== 'undefined' + typeof updateWorkspaceDto.enforceMcpOauth !== 'undefined' ) { const ws = await this.db .selectFrom('workspaces') @@ -392,7 +392,7 @@ export class WorkspaceService { } } - if (typeof updateWorkspaceDto.mcpOauthOnly !== 'undefined') { + if (typeof updateWorkspaceDto.enforceMcpOauth !== 'undefined') { if ( !this.licenseCheckService.hasFeature( ws.licenseKey, @@ -574,16 +574,16 @@ export class WorkspaceService { ); } - if (typeof updateWorkspaceDto.mcpOauthOnly !== 'undefined') { - const prev = settingsBefore?.ai?.mcpOauthOnly ?? false; - if (prev !== updateWorkspaceDto.mcpOauthOnly) { - before.mcpOauthOnly = prev; - after.mcpOauthOnly = updateWorkspaceDto.mcpOauthOnly; + if (typeof updateWorkspaceDto.enforceMcpOauth !== 'undefined') { + const prev = settingsBefore?.ai?.enforceMcpOauth ?? false; + if (prev !== updateWorkspaceDto.enforceMcpOauth) { + before.enforceMcpOauth = prev; + after.enforceMcpOauth = updateWorkspaceDto.enforceMcpOauth; } await this.workspaceRepo.updateAiSettings( workspaceId, - 'mcpOauthOnly', - updateWorkspaceDto.mcpOauthOnly, + 'enforceMcpOauth', + updateWorkspaceDto.enforceMcpOauth, trx, ); } @@ -627,7 +627,7 @@ export class WorkspaceService { delete updateWorkspaceDto.defaultPageEditMode; delete updateWorkspaceDto.aiChatReadOnly; delete updateWorkspaceDto.aiChatWorkspaceKnowledgeOnly; - delete updateWorkspaceDto.mcpOauthOnly; + delete updateWorkspaceDto.enforceMcpOauth; await this.workspaceRepo.updateWorkspace( updateWorkspaceDto, diff --git a/apps/server/src/ee b/apps/server/src/ee index ae1bfe5b5..844f2003c 160000 --- a/apps/server/src/ee +++ b/apps/server/src/ee @@ -1 +1 @@ -Subproject commit ae1bfe5b5c3672e3d910af8b3b6beb85e4b5e057 +Subproject commit 844f2003cdc36268478fdfb5ad64b656df6b633b