feat(web): manage MCP HTTP access from settings

This commit is contained in:
Hand Sonic authored and GitHub committed 2026-09-26 00:29:23 +08:00
1 parent 705ea7464d
commit fc0d576f6d
29 files changed
+1040 -159

No files matched your search

@@ -140,6 +140,8 @@ import {
mcpHttpServerStatus,
rotateMcpHttpServerToken,
loadWebMcpHttpStatus,
saveWebMcpHttpSettings,
rotateWebMcpToken,
forgetSnippetSavedToken,
forgetWebdavSyncSecretsPassphrase,
forgetWebdavSavedPassword,
@@ -173,6 +175,7 @@ import {
type McpHttpServerSettings,
type McpHttpServerStatus,
type WebMcpHttpStatus,
type WebMcpHttpSettings,
type McpServerStatus,
type SnippetProvider,
type SnippetSyncConfig,
@@ -3303,6 +3306,11 @@ const mcpHttpSettings = ref<McpHttpServerSettings>({
});
const mcpHttpStatus = ref<McpHttpServerStatus | null>(null);
const webMcpHttpStatus = ref<WebMcpHttpStatus | null>(null);
const webMcpEnabledDraft = ref(false);
const webMcpAllowedHostsText = ref("");
const webMcpAllowedOriginsText = ref("");
const webMcpSaving = ref(false);
const webMcpError = ref("");
const mcpHttpLoading = ref(false);
const mcpHttpSaving = ref(false);
const mcpHttpError = ref("");
@@ -3808,7 +3816,12 @@ async function loadMcpHttpSettings() {
mcpHttpError.value = "";
try {
if (isWeb) {
webMcpHttpStatus.value = await loadWebMcpHttpStatus();
const status = await loadWebMcpHttpStatus();
webMcpHttpStatus.value = status;
webMcpEnabledDraft.value = status.enabled;
webMcpAllowedHostsText.value = status.allowedHosts.join("\n");
webMcpAllowedOriginsText.value = status.allowedOrigins.join("\n");
webMcpError.value = "";
return;
}
const [settings, status] = await Promise.all([loadMcpHttpServerSettings(), mcpHttpServerStatus()]);
@@ -3824,6 +3837,41 @@ async function loadMcpHttpSettings() {
}
}
async function saveWebMcpSettings() {
if (webMcpSaving.value || webMcpHttpStatus.value?.deploymentManaged) return;
webMcpSaving.value = true;
webMcpError.value = "";
const settings: WebMcpHttpSettings = {
enabled: webMcpEnabledDraft.value,
allowedHosts: mcpHttpList(webMcpAllowedHostsText.value),
allowedOrigins: mcpHttpList(webMcpAllowedOriginsText.value),
};
try {
const status = await saveWebMcpHttpSettings(settings);
webMcpHttpStatus.value = status;
webMcpEnabledDraft.value = status.enabled;
webMcpAllowedHostsText.value = status.allowedHosts.join("\n");
webMcpAllowedOriginsText.value = status.allowedOrigins.join("\n");
} catch (error: unknown) {
webMcpError.value = formatMcpHttpError(error);
} finally {
webMcpSaving.value = false;
}
}
async function rotateWebMcpAccessToken() {
if (webMcpSaving.value || webMcpHttpStatus.value?.deploymentManaged) return;
webMcpSaving.value = true;
webMcpError.value = "";
try {
webMcpHttpStatus.value = await rotateWebMcpToken();
} catch (error: unknown) {
webMcpError.value = formatMcpHttpError(error);
} finally {
webMcpSaving.value = false;
}
}
async function saveMcpHttpSettings() {
if (mcpHttpSaving.value) return;
mcpHttpSaving.value = true;
@@ -9737,25 +9785,63 @@ LIMIT 100;</pre
</TabsList>
<TabsContent value="http" class="m-0 space-y-4">
<div v-if="isWeb" class="space-y-4">
<div class="rounded-md border bg-muted/20 p-4 space-y-2">
<div class="space-y-3 border-t border-border/60 pt-3">
<div class="flex items-center justify-between gap-3">
<Label class="text-base">{{ t("settings.mcpHttpWebServiceTitle") }}</Label>
<Badge :variant="webMcpHttpStatus?.enabled ? 'default' : 'outline'">{{ webMcpHttpStatus?.enabled ? t("settings.mcpHttpStatusLabelEnabled") : t("settings.mcpHttpStatusLabelDisabled") }}</Badge>
</div>
<p class="text-xs text-muted-foreground">{{ t("settings.mcpHttpWebServiceDescription") }}</p>
<p v-if="mcpHttpError" class="text-xs text-destructive">{{ mcpHttpError }}</p>
<template v-if="webMcpHttpStatus">
<code class="block rounded border bg-background px-2 py-1.5 text-xs">{{ webMcpEndpoint }}</code>
<p v-if="!webMcpHttpStatus.enabled" class="text-xs text-muted-foreground">{{ t("settings.mcpHttpWebDisabledHint") }}</p>
<code v-else class="block overflow-x-auto rounded border bg-background px-2 py-1.5 text-xs">{{ webMcpEndpoint }}</code>
<p class="text-[11px] text-muted-foreground">
{{
t("settings.mcpHttpWebTokenSourceAndHosts", {
tokenSource: webMcpHttpStatus.tokenSource || t("settings.mcpHttpNotConfigured"),
tokenSource: webMcpHttpStatus.tokenSource === "managed" ? t("settings.mcpHttpWebManagedTokenSource") : webMcpHttpStatus.tokenSource || t("settings.mcpHttpNotConfigured"),
hosts: webMcpHttpStatus.allowedHosts.join(", ") || t("settings.mcpHttpNotConfigured"),
})
}}
</p>
<p v-if="webMcpHttpStatus.allowedOrigins.length" class="text-[11px] text-muted-foreground">{{ t("settings.mcpHttpWebAllowedOrigins", { origins: webMcpHttpStatus.allowedOrigins.join(", ") }) }}</p>
<p v-if="webMcpHttpStatus.deploymentManaged" class="text-xs text-muted-foreground">{{ t("settings.mcpHttpWebDeploymentManaged") }}</p>
<p v-else-if="!webMcpHttpStatus.managementAvailable" class="text-xs text-muted-foreground">{{ t("settings.mcpHttpWebPasswordRequired") }}</p>
<template v-else>
<div class="flex items-center justify-between gap-3 border-t border-border/60 pt-3">
<Label for="web-mcp-enabled" class="text-sm">{{ t("settings.mcpHttpWebEnableLabel") }}</Label>
<Switch id="web-mcp-enabled" v-model="webMcpEnabledDraft" :disabled="webMcpSaving" />
</div>
<div class="space-y-1.5">
<Label for="web-mcp-hosts">{{ t("settings.mcpHttpAllowedHostsLabel") }}</Label>
<textarea id="web-mcp-hosts" v-model="webMcpAllowedHostsText" rows="2" :disabled="webMcpSaving" class="min-h-16 w-full rounded-md border bg-background px-3 py-2 font-mono text-xs" placeholder="192.168.0.77:4224" />
<p class="text-[11px] text-muted-foreground">{{ t("settings.mcpHttpHostsHint") }}</p>
</div>
<div class="space-y-1.5">
<Label for="web-mcp-origins">{{ t("settings.mcpHttpAllowedOriginsLabel") }}</Label>
<textarea id="web-mcp-origins" v-model="webMcpAllowedOriginsText" rows="2" :disabled="webMcpSaving" class="min-h-16 w-full rounded-md border bg-background px-3 py-2 font-mono text-xs" placeholder="https://mcp-client.example.com" />
<p class="text-[11px] text-muted-foreground">{{ t("settings.mcpHttpWebOriginsHint") }}</p>
</div>
<div v-if="webMcpHttpStatus.enabled && webMcpHttpStatus.accessToken" class="space-y-1.5">
<div class="flex items-center justify-between gap-2">
<Label>Bearer Token</Label>
<Button type="button" variant="outline" size="sm" :disabled="webMcpSaving" @click="rotateWebMcpAccessToken">{{ t("settings.mcpHttpRotateToken") }}</Button>
</div>
<div class="flex min-w-0 items-center gap-2">
<code class="min-w-0 flex-1 overflow-x-auto rounded border bg-background px-2 py-1.5 text-xs">{{ webMcpHttpStatus.accessToken }}</code>
<Button type="button" variant="outline" size="icon" :title="t('common.copy')" @click="copyMcpText('http-token', webMcpHttpStatus.accessToken || '')">
<CheckCircle2 v-if="mcpCopied === 'http-token'" class="h-3.5 w-3.5 text-green-500" />
<Copy v-else class="h-3.5 w-3.5" />
</Button>
</div>
</div>
<p v-if="webMcpError" class="text-xs text-destructive">{{ webMcpError }}</p>
<div class="flex flex-wrap justify-end gap-2">
<Button type="button" variant="outline" size="sm" :disabled="mcpHttpLoading || webMcpSaving" @click="loadMcpHttpSettings">{{ t("settings.mcpHttpReloadStatus") }}</Button>
<Button type="button" size="sm" :disabled="webMcpSaving || (webMcpEnabledDraft && !mcpHttpList(webMcpAllowedHostsText).length)" @click="saveWebMcpSettings">{{ t("settings.mcpHttpWebSave") }}</Button>
</div>
</template>
</template>
<Button type="button" variant="outline" size="sm" :disabled="mcpHttpLoading" @click="loadMcpHttpSettings">{{ t("settings.mcpHttpReloadStatus") }}</Button>
<Button v-if="!webMcpHttpStatus || webMcpHttpStatus.deploymentManaged" type="button" variant="outline" size="sm" :disabled="mcpHttpLoading" @click="loadMcpHttpSettings">{{ t("settings.mcpHttpReloadStatus") }}</Button>
</div>
</div>
+8 -1
View File
@@ -8111,7 +8111,14 @@ export default withEnglishFallback({
mcpTransportLocalStdio: "Yerli stdio",
mcpTransportHttpService: "HTTP xidməti",
mcpHttpWebServiceTitle: "Veb Streamable HTTP xidməti",
mcpHttpWebServiceDescription: "Veb/Docker cari veb dinləmə portundan təkrar istifadə edir. Onu yerləşdirmə mühitinin dəyişənləri ilə aktivləşdirin; parametrlər səhifəsi tokeni heç vaxt saxlamır.",
mcpHttpWebServiceDescription: "Veb/Docker mövcud veb portundan istifadə edir. Girişi burada idarə edin və ya bu parametrləri yerləşdirmə sirləri ilə əvəz edin.",
mcpHttpWebDisabledHint: "Xidmət deaktivdir; bu ünvandan hələ istifadə etmək olmaz.",
mcpHttpWebDeploymentManaged: "Bu xidmət yerləşdirmə mühiti və ya gizli fayl ilə idarə olunur. Tokeni və icazə siyahılarını yerləşdirmə konfiqurasiyasında dəyişin.",
mcpHttpWebPasswordRequired: "Veb MCP idarəsi üçün veb giriş parolu tələb olunur və demo rejimində mövcud deyil.",
mcpHttpWebManagedTokenSource: "Veb parametrləri",
mcpHttpWebEnableLabel: "HTTP MCP-ni aktivləşdir",
mcpHttpWebOriginsHint: "Yalnız brauzer müştəriləri üçün dəqiq Origin tələb olunur; yerli müştərilər bunu boş saxlaya bilər.",
mcpHttpWebSave: "Yadda saxla və tətbiq et",
mcpHttpStatusLabelEnabled: "Aktivdir",
mcpHttpStatusLabelDisabled: "Aktiv deyil",
mcpHttpNotConfigured: "Tənzimlənməyib",
+8 -1
View File
@@ -8791,7 +8791,14 @@ export default {
mcpTransportLocalStdio: "Local stdio",
mcpTransportHttpService: "HTTP service",
mcpHttpWebServiceTitle: "Web Streamable HTTP service",
mcpHttpWebServiceDescription: "Web/Docker reuses the current web listening port. Enable it with deployment environment variables; the settings page never stores the token.",
mcpHttpWebServiceDescription: "Web/Docker uses the existing web port. Manage access here, or use deployment secrets to override these settings.",
mcpHttpWebDisabledHint: "The service is disabled; this endpoint cannot be used yet.",
mcpHttpWebDeploymentManaged: "Deployment environment or a secret file controls this service. Change the token and allowlists in your deployment configuration.",
mcpHttpWebPasswordRequired: "Web MCP management requires a configured Web login password and is unavailable in demo mode.",
mcpHttpWebManagedTokenSource: "Web settings",
mcpHttpWebEnableLabel: "Enable HTTP MCP",
mcpHttpWebOriginsHint: "Only browser clients need an exact Origin; native clients can leave this empty.",
mcpHttpWebSave: "Save and apply",
mcpHttpStatusLabelEnabled: "Enabled",
mcpHttpStatusLabelDisabled: "Not enabled",
mcpHttpNotConfigured: "Not configured",
+8 -1
View File
@@ -8101,7 +8101,14 @@ export default withEnglishFallback({
mcpTransportLocalStdio: "stdio local",
mcpTransportHttpService: "Servicio HTTP",
mcpHttpWebServiceTitle: "Servicio Web Streamable HTTP",
mcpHttpWebServiceDescription: "Web/Docker reutiliza el puerto de escucha web actual. Se activa con variables de entorno de despliegue; la página de ajustes nunca guarda el Token.",
mcpHttpWebServiceDescription: "Web/Docker usa el puerto web existente. Administra el acceso aquí o usa secretos de despliegue para sustituir estos ajustes.",
mcpHttpWebDisabledHint: "El servicio está desactivado; este punto de acceso aún no se puede usar.",
mcpHttpWebDeploymentManaged: "Este servicio se controla mediante el entorno de despliegue o un archivo secreto. Cambia el token y las listas de permitidos en la configuración del despliegue.",
mcpHttpWebPasswordRequired: "La administración de Web MCP requiere una contraseña de acceso web y no está disponible en el modo de demostración.",
mcpHttpWebManagedTokenSource: "Ajustes web",
mcpHttpWebEnableLabel: "Activar HTTP MCP",
mcpHttpWebOriginsHint: "Solo los clientes de navegador necesitan un Origin exacto; los clientes nativos pueden dejarlo vacío.",
mcpHttpWebSave: "Guardar y aplicar",
mcpHttpStatusLabelEnabled: "Activado",
mcpHttpStatusLabelDisabled: "Desactivado",
mcpHttpNotConfigured: "Sin configurar",
+8 -1
View File
@@ -8026,7 +8026,14 @@ export default withEnglishFallback({
mcpTransportLocalStdio: "stdio locale",
mcpTransportHttpService: "Servizio HTTP",
mcpHttpWebServiceTitle: "Servizio Web Streamable HTTP",
mcpHttpWebServiceDescription: "Web/Docker riusa la porta di ascolto web attuale. Viene abilitato con variabili d'ambiente di distribuzione; la pagina delle impostazioni non salva mai il Token.",
mcpHttpWebServiceDescription: "Web/Docker usa la porta web esistente. Gestisci l'accesso qui oppure usa i segreti di distribuzione per sostituire queste impostazioni.",
mcpHttpWebDisabledHint: "Il servizio è disattivato; questo endpoint non è ancora utilizzabile.",
mcpHttpWebDeploymentManaged: "Questo servizio è gestito dall'ambiente di distribuzione o da un file segreto. Modifica il token e le liste consentite nella configurazione di distribuzione.",
mcpHttpWebPasswordRequired: "La gestione di Web MCP richiede una password di accesso Web e non è disponibile in modalità demo.",
mcpHttpWebManagedTokenSource: "Impostazioni Web",
mcpHttpWebEnableLabel: "Abilita HTTP MCP",
mcpHttpWebOriginsHint: "Solo i client browser richiedono un Origin esatto; i client nativi possono lasciare vuoto questo campo.",
mcpHttpWebSave: "Salva e applica",
mcpHttpStatusLabelEnabled: "Attivo",
mcpHttpStatusLabelDisabled: "Non attivo",
mcpHttpNotConfigured: "Non configurato",
+8 -1
View File
@@ -8029,7 +8029,14 @@ export default withEnglishFallback({
mcpTransportLocalStdio: "ローカル stdio",
mcpTransportHttpService: "HTTP サービス",
mcpHttpWebServiceTitle: "Web Streamable HTTP サービス",
mcpHttpWebServiceDescription: "Web/Docker は現在の Web リスニングポートを再利用します。デプロイの環境変数で有効化され、設定ページに Token は保存されません。",
mcpHttpWebServiceDescription: "Web/Docker は既存の Web ポートを使用します。ここでアクセスを管理するか、デプロイ時のシークレットで設定を上書きできます。",
mcpHttpWebDisabledHint: "サービスは無効です。このエンドポイントはまだ使用できません。",
mcpHttpWebDeploymentManaged: "このサービスはデプロイ環境またはシークレットファイルで管理されています。Token と許可リストはデプロイ設定で変更してください。",
mcpHttpWebPasswordRequired: "Web MCP の管理には Web ログインパスワードが必要です。デモモードでは利用できません。",
mcpHttpWebManagedTokenSource: "Web 設定",
mcpHttpWebEnableLabel: "HTTP MCP を有効化",
mcpHttpWebOriginsHint: "正確な Origin が必要なのはブラウザクライアントのみです。ネイティブクライアントでは空欄にできます。",
mcpHttpWebSave: "保存して適用",
mcpHttpStatusLabelEnabled: "有効",
mcpHttpStatusLabelDisabled: "無効",
mcpHttpNotConfigured: "未設定",
+8 -1
View File
@@ -7816,7 +7816,14 @@ export default withEnglishFallback({
mcpTransportLocalStdio: "로컬 stdio",
mcpTransportHttpService: "HTTP 서비스",
mcpHttpWebServiceTitle: "Web Streamable HTTP 서비스",
mcpHttpWebServiceDescription: "Web/Docker은 현재 웹 수신 포트를 재사용합니다. 배포 환경 변수로 활성화되며 설정 페이지에는 Token이 저장되지 않습니다.",
mcpHttpWebServiceDescription: "Web/Docker는 기존 웹 포트를 사용합니다. 여기서 접근을 관리하거나 배포 시크릿으로 이 설정을 덮어쓸 수 있습니다.",
mcpHttpWebDisabledHint: "서비스가 비활성화되어 이 엔드포인트를 아직 사용할 수 없습니다.",
mcpHttpWebDeploymentManaged: "이 서비스는 배포 환경 또는 시크릿 파일로 관리됩니다. 토큰과 허용 목록은 배포 설정에서 변경하세요.",
mcpHttpWebPasswordRequired: "Web MCP 관리에는 웹 로그인 비밀번호가 필요하며 데모 모드에서는 사용할 수 없습니다.",
mcpHttpWebManagedTokenSource: "웹 설정",
mcpHttpWebEnableLabel: "HTTP MCP 활성화",
mcpHttpWebOriginsHint: "브라우저 클라이언트에만 정확한 Origin이 필요합니다. 네이티브 클라이언트는 비워 둘 수 있습니다.",
mcpHttpWebSave: "저장하고 적용",
mcpHttpStatusLabelEnabled: "활성화됨",
mcpHttpStatusLabelDisabled: "비활성화됨",
mcpHttpNotConfigured: "미구성",
+8 -1
View File
@@ -8027,7 +8027,14 @@ export default withEnglishFallback({
mcpTransportLocalStdio: "stdio local",
mcpTransportHttpService: "Serviço HTTP",
mcpHttpWebServiceTitle: "Serviço Web Streamable HTTP",
mcpHttpWebServiceDescription: "O Web/Docker reutiliza a porta de escuta web atual. É ativado por variáveis de ambiente de implantação; a página de configurações nunca salva o Token.",
mcpHttpWebServiceDescription: "O Web/Docker usa a porta web existente. Gerencie o acesso aqui ou use segredos de implantação para substituir estas configurações.",
mcpHttpWebDisabledHint: "O serviço está desativado; este endpoint ainda não pode ser usado.",
mcpHttpWebDeploymentManaged: "Este serviço é controlado pelo ambiente de implantação ou por um arquivo secreto. Altere o token e as listas de permissões na configuração da implantação.",
mcpHttpWebPasswordRequired: "O gerenciamento do Web MCP exige uma senha de login web e não está disponível no modo de demonstração.",
mcpHttpWebManagedTokenSource: "Configurações web",
mcpHttpWebEnableLabel: "Ativar HTTP MCP",
mcpHttpWebOriginsHint: "Somente clientes de navegador precisam de um Origin exato; clientes nativos podem deixar este campo vazio.",
mcpHttpWebSave: "Salvar e aplicar",
mcpHttpStatusLabelEnabled: "Ativado",
mcpHttpStatusLabelDisabled: "Desativado",
mcpHttpNotConfigured: "Não configurado",
+8 -1
View File
@@ -9312,7 +9312,14 @@ export default withEnglishFallback({
mcpTransportLocalStdio: "Локальный stdio",
mcpTransportHttpService: "Служба HTTP",
mcpHttpWebServiceTitle: "Веб-служба Streamable HTTP",
mcpHttpWebServiceDescription: "Web/Docker повторно использует текущий порт веб-прослушивания. Включите её переменными среды развёртывания; страница настроек никогда не хранит токен.",
mcpHttpWebServiceDescription: "Web/Docker использует существующий веб-порт. Управляйте доступом здесь или переопределите настройки секретами развёртывания.",
mcpHttpWebDisabledHint: "Служба отключена; этот адрес пока недоступен.",
mcpHttpWebDeploymentManaged: "Эта служба управляется средой развёртывания или файлом с секретом. Изменяйте токен и списки разрешений в конфигурации развёртывания.",
mcpHttpWebPasswordRequired: "Для управления Web MCP требуется пароль входа в Web; в демонстрационном режиме функция недоступна.",
mcpHttpWebManagedTokenSource: "Настройки Web",
mcpHttpWebEnableLabel: "Включить HTTP MCP",
mcpHttpWebOriginsHint: "Точный Origin нужен только браузерным клиентам; для нативных клиентов поле можно оставить пустым.",
mcpHttpWebSave: "Сохранить и применить",
mcpHttpStatusLabelEnabled: "Включено",
mcpHttpStatusLabelDisabled: "Не включено",
mcpHttpNotConfigured: "Не настроено",
+8 -1
View File
@@ -8009,7 +8009,14 @@ export default withEnglishFallback({
mcpTransportLocalStdio: "Yerel stdio",
mcpTransportHttpService: "HTTP servisi",
mcpHttpWebServiceTitle: "Web Streamable HTTP servisi",
mcpHttpWebServiceDescription: "Web/Docker, geçerli web dinleme portunu yeniden kullanır. Dağıtım ortam değişkenleriyle etkinleştirin; ayarlar sayfası belirteci hiçbir zaman saklamaz.",
mcpHttpWebServiceDescription: "Web/Docker mevcut web portunu kullanır. Erişimi buradan yönetin veya dağıtım gizli bilgileriyle bu ayarları geçersiz kılın.",
mcpHttpWebDisabledHint: "Hizmet devre dışı; bu uç nokta henüz kullanılamaz.",
mcpHttpWebDeploymentManaged: "Bu hizmet dağıtım ortamı veya gizli dosya tarafından yönetiliyor. Belirteci ve izin listelerini dağıtım yapılandırmasında değiştirin.",
mcpHttpWebPasswordRequired: "Web MCP yönetimi için bir Web giriş parolası gerekir ve demo modunda kullanılamaz.",
mcpHttpWebManagedTokenSource: "Web ayarları",
mcpHttpWebEnableLabel: "HTTP MCP'yi etkinleştir",
mcpHttpWebOriginsHint: "Yalnızca tarayıcı istemcileri tam bir Origin gerektirir; yerel istemciler bu alanı boş bırakabilir.",
mcpHttpWebSave: "Kaydet ve uygula",
mcpHttpStatusLabelEnabled: "Etkin",
mcpHttpStatusLabelDisabled: "Etkin değil",
mcpHttpNotConfigured: "Yapılandırılmadı",
+8 -1
View File
@@ -8764,7 +8764,14 @@ export default withEnglishFallback({
mcpTransportLocalStdio: "本地 stdio",
mcpTransportHttpService: "HTTP 服务",
mcpHttpWebServiceTitle: "Web Streamable HTTP 服务",
mcpHttpWebServiceDescription: "Web/Docker 复用当前 Web 监听端口。通过部署环境变量启用,设置页不会保存 Token。",
mcpHttpWebServiceDescription: "Web/Docker 复用当前 Web 监听端口。可在此管理接入,部署环境变量配置优先。",
mcpHttpWebDisabledHint: "服务尚未启用,当前地址不可连接。",
mcpHttpWebDeploymentManaged: "此服务由部署环境变量或 Secret 文件管理;请在部署配置中修改 Token 和白名单。",
mcpHttpWebPasswordRequired: "页面管理 MCP 需要先设置 Web 登录密码,演示模式不可用。",
mcpHttpWebManagedTokenSource: "Web 设置",
mcpHttpWebEnableLabel: "启用 HTTP MCP",
mcpHttpWebOriginsHint: "仅浏览器客户端需要,填写完整 Origin;原生客户端可留空。",
mcpHttpWebSave: "保存并应用",
mcpHttpStatusLabelEnabled: "已启用",
mcpHttpStatusLabelDisabled: "未启用",
mcpHttpNotConfigured: "未配置",
+8 -1
View File
@@ -7395,7 +7395,14 @@ export default withEnglishFallback({
mcpTransportLocalStdio: "本機 stdio",
mcpTransportHttpService: "HTTP 服務",
mcpHttpWebServiceTitle: "Web Streamable HTTP 服務",
mcpHttpWebServiceDescription: "Web/Docker 重用目前 Web 監聽埠。透過部署環境變數啟用,設定頁不會儲存 Token。",
mcpHttpWebServiceDescription: "Web/Docker 重用目前 Web 監聽埠。可在此管理存取,部署環境變數設定優先。",
mcpHttpWebDisabledHint: "服務尚未啟用,目前位址無法連線。",
mcpHttpWebDeploymentManaged: "此服務由部署環境變數或 Secret 檔案管理;請在部署設定中修改 Token 與白名單。",
mcpHttpWebPasswordRequired: "頁面管理 MCP 需要先設定 Web 登入密碼,展示模式不可用。",
mcpHttpWebManagedTokenSource: "Web 設定",
mcpHttpWebEnableLabel: "啟用 HTTP MCP",
mcpHttpWebOriginsHint: "僅瀏覽器用戶端需要填寫完整 Origin;原生用戶端可留空。",
mcpHttpWebSave: "儲存並套用",
mcpHttpStatusLabelEnabled: "已啟用",
mcpHttpStatusLabelDisabled: "未啟用",
mcpHttpNotConfigured: "未設定",
+3
View File
@@ -930,6 +930,8 @@ export const saveMcpHttpServerSettings = forward("saveMcpHttpServerSettings");
export const mcpHttpServerStatus = forward("mcpHttpServerStatus");
export const rotateMcpHttpServerToken = forward("rotateMcpHttpServerToken");
export const loadWebMcpHttpStatus = forward("loadWebMcpHttpStatus");
export const saveWebMcpHttpSettings = forward("saveWebMcpHttpSettings");
export const rotateWebMcpToken = forward("rotateWebMcpToken");
export const checkForUpdates = forward("checkForUpdates");
export const fetchChangelog = forward("fetchChangelog");
export const getSystemProxyUrl = forward("getSystemProxyUrl");
@@ -999,6 +1001,7 @@ export type {
McpHttpServerSettings,
McpHttpServerStatus,
WebMcpHttpStatus,
WebMcpHttpSettings,
UpdateInfo,
DownloadedUpdate,
RedisBlob,
+16
View File
@@ -2217,6 +2217,22 @@ export async function loadWebMcpHttpStatus(): Promise<import("@/lib/backend/taur
return get("/api/app-settings/mcp-http-status");
}
export async function saveWebMcpHttpSettings(settings: import("@/lib/backend/tauri").WebMcpHttpSettings): Promise<import("@/lib/backend/tauri").WebMcpHttpStatus> {
const res = await fetch(apiUrl("/api/app-settings/mcp-http"), {
method: "PUT",
headers: { "Content-Type": "application/json", "X-DBX-MCP-Settings": "1" },
body: JSON.stringify(settings),
});
if (!res.ok) throw await backendResponseError(res);
return res.json();
}
export async function rotateWebMcpToken(): Promise<import("@/lib/backend/tauri").WebMcpHttpStatus> {
const res = await fetch(apiUrl("/api/app-settings/mcp-http/rotate-token"), { method: "POST", headers: { "X-DBX-MCP-Settings": "1" } });
if (!res.ok) throw await backendResponseError(res);
return res.json();
}
export async function loadMaxAgentTurns(): Promise<number> {
return get("/api/app-settings/max-agent-turns");
}
+19 -2
View File
@@ -816,7 +816,16 @@ export interface McpHttpServerStatus {
export interface WebMcpHttpStatus {
enabled: boolean;
endpointPath: string;
tokenSource: "environment" | "file" | null;
tokenSource: "environment" | "file" | "managed" | null;
allowedHosts: string[];
allowedOrigins: string[];
deploymentManaged: boolean;
managementAvailable: boolean;
accessToken: string | null;
}
export interface WebMcpHttpSettings {
enabled: boolean;
allowedHosts: string[];
allowedOrigins: string[];
}
@@ -838,7 +847,15 @@ export async function rotateMcpHttpServerToken(): Promise<McpHttpServerStatus> {
}
export async function loadWebMcpHttpStatus(): Promise<WebMcpHttpStatus> {
return { enabled: false, endpointPath: "/mcp", tokenSource: null, allowedHosts: [], allowedOrigins: [] };
return { enabled: false, endpointPath: "/mcp", tokenSource: null, allowedHosts: [], allowedOrigins: [], deploymentManaged: false, managementAvailable: false, accessToken: null };
}
export async function saveWebMcpHttpSettings(_settings: WebMcpHttpSettings): Promise<WebMcpHttpStatus> {
throw new Error("Web MCP settings are available only in DBX Web");
}
export async function rotateWebMcpToken(): Promise<WebMcpHttpStatus> {
throw new Error("Web MCP settings are available only in DBX Web");
}
export async function loadMaxAgentTurns(): Promise<number> {