Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

feat(mcp): show the endpoint token as the drawer's second step

wizardchen8b1a64004d4a
diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts
index 60dc07c77..7c9ff3196 100755
--- a/frontend/src/i18n/locales/en-US.ts
+++ b/frontend/src/i18n/locales/en-US.ts
@@ -6719,8 +6719,10 @@ export default {
rateLimitLabel: 'Max calls per minute',
rateLimitHint: 'Applies to all tool calls on this endpoint; clients get a rate-limit error above it.',
sectionConnect: 'Connection',
+ stepConfig: 'Configure',
+ stepConnect: 'Connect',
+ snippetsLabel: 'Client configuration',
connectHintExisting: 'The token was shown once at creation (current token starts with {hint}…). Rotate the token to get a new one.',
- showSnippets: 'Show client configuration',
tokenDialogTitle: 'Endpoint ready, save the token',
connectDialogTitle: 'Connect to this endpoint',
tokenOnce: 'This token is shown only once. Copy it now and store it somewhere safe.',
diff --git a/frontend/src/i18n/locales/ja-JP.ts b/frontend/src/i18n/locales/ja-JP.ts
index 21a8c69a0..dfb15ad32 100644
--- a/frontend/src/i18n/locales/ja-JP.ts
+++ b/frontend/src/i18n/locales/ja-JP.ts
@@ -6719,8 +6719,10 @@ export default {
rateLimitLabel: '1 分あたりの最大呼び出し数',
rateLimitHint: 'このエンドポイントのすべてのツール呼び出しに適用されます。',
sectionConnect: '接続情報',
+ stepConfig: '設定',
+ stepConnect: '接続',
+ snippetsLabel: 'クライアント設定',
connectHintExisting: 'トークンは作成時に一度だけ表示されました(現在のトークンは {hint}… で始まります)。再取得するにはローテーションしてください。',
- showSnippets: 'クライアント設定例を表示',
tokenDialogTitle: 'エンドポイントの準備完了。トークンを保存してください',
connectDialogTitle: 'このエンドポイントに接続',
tokenOnce: 'このトークンは一度しか表示されません。今すぐコピーして安全に保管してください。',
diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts
index 69f163f2e..4658d7527 100755
--- a/frontend/src/i18n/locales/ko-KR.ts
+++ b/frontend/src/i18n/locales/ko-KR.ts
@@ -747,8 +747,10 @@ export default {
rateLimitLabel: '분당 최대 호출 수',
rateLimitHint: '이 엔드포인트의 모든 도구 호출에 적용되며, 초과 시 클라이언트는 제한 오류를 받습니다.',
sectionConnect: '연결 정보',
+ stepConfig: '설정',
+ stepConnect: '연결',
+ snippetsLabel: '클라이언트 설정',
connectHintExisting: '토큰은 생성 시 한 번만 표시되었습니다(현재 토큰은 {hint}…로 시작). 새 토큰이 필요하면 교체하세요.',
- showSnippets: '클라이언트 설정 예시 보기',
tokenDialogTitle: '엔드포인트 준비 완료, 토큰을 저장하세요',
connectDialogTitle: '이 엔드포인트에 연결',
tokenOnce: '이 토큰은 한 번만 표시됩니다. 지금 복사하여 안전하게 보관하세요.',
diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts
index 6de9098c9..07724a9e2 100755
--- a/frontend/src/i18n/locales/ru-RU.ts
+++ b/frontend/src/i18n/locales/ru-RU.ts
@@ -747,8 +747,10 @@ export default {
rateLimitLabel: 'Максимум вызовов в минуту',
rateLimitHint: 'Применяется ко всем вызовам инструментов этой конечной точки; при превышении клиент получает ошибку.',
sectionConnect: 'Подключение',
+ stepConfig: 'Настройка',
+ stepConnect: 'Подключение',
+ snippetsLabel: 'Конфигурация клиента',
connectHintExisting: 'Токен показывался один раз при создании (текущий начинается с {hint}…). Чтобы получить новый, выполните ротацию.',
- showSnippets: 'Показать примеры конфигурации клиента',
tokenDialogTitle: 'Конечная точка готова, сохраните токен',
connectDialogTitle: 'Подключение к конечной точке',
tokenOnce: 'Токен показывается только один раз. Скопируйте его сейчас и сохраните в надёжном месте.',
diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts
index 767a18025..72ac4b3fb 100755
--- a/frontend/src/i18n/locales/zh-CN.ts
+++ b/frontend/src/i18n/locales/zh-CN.ts
@@ -747,8 +747,10 @@ export default {
rateLimitLabel: '每分钟最多调用次数',
rateLimitHint: '对该端点所有工具调用的总限制,超出后客户端会收到限流提示。',
sectionConnect: '连接信息',
+ stepConfig: '配置',
+ stepConnect: '连接',
+ snippetsLabel: '客户端配置',
connectHintExisting: '令牌只在创建时展示(当前令牌前缀 {hint}…)。如需重新获取,请轮换令牌。',
- showSnippets: '查看客户端配置示例',
tokenDialogTitle: '端点已就绪,请保存令牌',
connectDialogTitle: '连接此端点',
tokenOnce: '令牌只展示这一次,关闭后无法再次查看。请立即复制并妥善保存。',
diff --git a/frontend/src/views/integrations/McpServerIntegrationSettings.vue b/frontend/src/views/integrations/McpServerIntegrationSettings.vue
index 800fc2a96..1d5872fc1 100644
--- a/frontend/src/views/integrations/McpServerIntegrationSettings.vue
+++ b/frontend/src/views/integrations/McpServerIntegrationSettings.vue
@@ -80,159 +80,175 @@
v-model:visible="showDrawer"
class="mcp-endpoint-drawer"
:title="editing ? $t('integrations.mcpserver.editTitle') : $t('integrations.mcpserver.createTitle')"
- :description="$t('integrations.mcpserver.drawerDesc')"
+ :description="drawerStepDescription"
icon="tools"
storage-key="setting-drawer:mcp-endpoint"
width="600px"
:confirm-loading="saving"
- :confirm-text="editing ? $t('common.save') : $t('integrations.mcpserver.create')"
+ :confirm-text="drawerConfirmText"
:hide-footer="!isAdmin"
- @confirm="saveForm"
+ :close-on-overlay-click="!freshToken"
+ @confirm="handleDrawerConfirm"
@cancel="closeDrawer"
>
- <section class="setting-drawer__section">
- <h4 class="setting-drawer__section-title">{{ $t('integrations.mcpserver.sectionBasic') }}</h4>
- <div class="form-item">
- <label class="form-label required">{{ $t('integrations.mcpserver.nameLabel') }}</label>
- <t-input v-model="form.name" :placeholder="$t('integrations.mcpserver.namePlaceholder')" :maxlength="255" />
- </div>
- <div class="form-item">
- <label class="form-label">{{ $t('integrations.mcpserver.descriptionLabel') }}</label>
- <t-textarea v-model="form.description" :autosize="{ minRows: 2, maxRows: 4 }" :placeholder="$t('integrations.mcpserver.descriptionPlaceholder')" />
- </div>
- <div class="form-item enable-row">
- <label class="form-label form-label--inline">{{ $t('integrations.mcpserver.enabledLabel') }}</label>
- <t-switch v-model="form.enabled" size="small" />
- </div>
- </section>
-
- <section class="setting-drawer__section">
- <h4 class="setting-drawer__section-title">{{ $t('integrations.mcpserver.sectionScope') }}</h4>
- <div class="form-item">
- <label class="form-label">{{ $t('integrations.mcpserver.kbScopeLabel') }}</label>
- <t-select
- v-model="form.knowledge_base_ids"
- multiple
- filterable
- clearable
- :loading="kbLoading"
- :options="kbOptions"
- :placeholder="$t('integrations.mcpserver.kbScopePlaceholder')"
- />
- <p class="form-desc">{{ $t('integrations.mcpserver.kbScopeHint') }}</p>
- </div>
- </section>
-
- <section class="setting-drawer__section">
- <h4 class="setting-drawer__section-title">{{ $t('integrations.mcpserver.sectionTools') }}</h4>
- <p class="form-desc form-desc--block">{{ $t('integrations.mcpserver.toolsHint') }}</p>
- <div class="tool-group-list">
- <div v-for="group in groupedTools" :key="group.group" class="tool-group">
- <div class="tool-group__header">
- <span class="tool-group__name">{{ $t(`integrations.mcpserver.groups.${group.group}`) }}</span>
- <t-button size="small" variant="text" @click="toggleGroup(group, !groupAllSelected(group))">
- {{ groupAllSelected(group) ? $t('integrations.mcpserver.clearGroup') : $t('integrations.mcpserver.selectGroup') }}
- </t-button>
- </div>
- <div class="tool-group__items">
- <div v-for="tool in group.tools" :key="tool.name" class="tool-item" :class="{ 'tool-item--danger': tool.destructive }">
- <t-checkbox :model-value="toolSelections[tool.name] === true" @change="(v: boolean) => setToolSelected(tool.name, v)">
- <span class="tool-item__label">
- {{ $t(`integrations.mcpserver.tools.${tool.name}`) }}
- <code class="tool-item__code">{{ tool.name }}</code>
- </span>
- </t-checkbox>
- <p class="form-desc">{{ $t(`integrations.mcpserver.tools.${tool.name}Desc`) }}</p>
+ <template v-if="wizardStep > 0 && editing" #footer-left>
+ <t-button variant="outline" @click="goToWizardStep(0)">
+ {{ $t('common.back') }}
+ </t-button>
+ </template>
+
+ <div class="im-steps">
+ <button
+ v-for="(title, i) in stepTitles"
+ :key="i"
+ type="button"
+ :class="['im-step', { active: wizardStep === i, done: wizardStep > i }]"
+ :disabled="!editing && i > 0"
+ @click="goToWizardStep(i)"
+ >
+ <span class="im-step-num">
+ <t-icon v-if="wizardStep > i" name="check" class="im-step-check" />
+ <template v-else>{{ i + 1 }}</template>
+ </span>
+ <span class="im-step-title">{{ title }}</span>
+ </button>
+ </div>
+
+ <!-- Step 1: configuration -->
+ <div v-if="wizardStep === 0" class="im-step-body">
+ <section class="setting-drawer__section">
+ <h4 class="setting-drawer__section-title">{{ $t('integrations.mcpserver.sectionBasic') }}</h4>
+ <div class="form-item">
+ <label class="form-label required">{{ $t('integrations.mcpserver.nameLabel') }}</label>
+ <t-input v-model="form.name" :placeholder="$t('integrations.mcpserver.namePlaceholder')" :maxlength="255" />
+ </div>
+ <div class="form-item">
+ <label class="form-label">{{ $t('integrations.mcpserver.descriptionLabel') }}</label>
+ <t-textarea v-model="form.description" :autosize="{ minRows: 2, maxRows: 4 }" :placeholder="$t('integrations.mcpserver.descriptionPlaceholder')" />
+ </div>
+ <div class="form-item enable-row">
+ <label class="form-label form-label--inline">{{ $t('integrations.mcpserver.enabledLabel') }}</label>
+ <t-switch v-model="form.enabled" size="small" />
+ </div>
+ </section>
+
+ <section class="setting-drawer__section">
+ <h4 class="setting-drawer__section-title">{{ $t('integrations.mcpserver.sectionScope') }}</h4>
+ <div class="form-item">
+ <label class="form-label">{{ $t('integrations.mcpserver.kbScopeLabel') }}</label>
+ <t-select
+ v-model="form.knowledge_base_ids"
+ multiple
+ filterable
+ clearable
+ :loading="kbLoading"
+ :options="kbOptions"
+ :placeholder="$t('integrations.mcpserver.kbScopePlaceholder')"
+ />
+ <p class="form-desc">{{ $t('integrations.mcpserver.kbScopeHint') }}</p>
+ </div>
+ </section>
+
+ <section class="setting-drawer__section">
+ <h4 class="setting-drawer__section-title">{{ $t('integrations.mcpserver.sectionTools') }}</h4>
+ <p class="form-desc form-desc--block">{{ $t('integrations.mcpserver.toolsHint') }}</p>
+ <div class="tool-group-list">
+ <div v-for="group in groupedTools" :key="group.group" class="tool-group">
+ <div class="tool-group__header">
+ <span class="tool-group__name">{{ $t(`integrations.mcpserver.groups.${group.group}`) }}</span>
+ <t-button size="small" variant="text" @click="toggleGroup(group, !groupAllSelected(group))">
+ {{ groupAllSelected(group) ? $t('integrations.mcpserver.clearGroup') : $t('integrations.mcpserver.selectGroup') }}
+ </t-button>
+ </div>
+ <div class="tool-group__items">
+ <div v-for="tool in group.tools" :key="tool.name" class="tool-item" :class="{ 'tool-item--danger': tool.destructive }">
+ <t-checkbox :model-value="toolSelections[tool.name] === true" @change="(v: boolean) => setToolSelected(tool.name, v)">
+ <span class="tool-item__label">
+ {{ $t(`integrations.mcpserver.tools.${tool.name}`) }}
+ <code class="tool-item__code">{{ tool.name }}</code>
+ </span>
+ </t-checkbox>
+ <p class="form-desc">{{ $t(`integrations.mcpserver.tools.${tool.name}Desc`) }}</p>
+ </div>
</div>
</div>
</div>
- </div>
- <p v-if="selectedToolCount === 0" class="form-desc form-desc--error">{{ $t('integrations.mcpserver.toolsRequired') }}</p>
- </section>
-
- <section v-if="askSelected" class="setting-drawer__section">
- <h4 class="setting-drawer__section-title">{{ $t('integrations.mcpserver.sectionAsk') }}</h4>
- <div class="form-item">
- <label class="form-label">{{ $t('integrations.mcpserver.defaultAgentLabel') }}</label>
- <t-select
- v-model="form.default_agent_id"
- filterable
- clearable
- :loading="agentsLoading"
- :options="agentOptions"
- :placeholder="$t('integrations.mcpserver.defaultAgentPlaceholder')"
- />
- <p class="form-desc">{{ $t('integrations.mcpserver.defaultAgentHint') }}</p>
- </div>
- </section>
-
- <section class="setting-drawer__section">
- <h4 class="setting-drawer__section-title">{{ $t('integrations.mcpserver.sectionLimits') }}</h4>
- <div class="form-item">
- <label class="form-label">{{ $t('integrations.mcpserver.rateLimitLabel') }}</label>
- <t-input-number v-model="form.rate_limit_per_minute" class="form-number" :min="1" :max="6000" theme="column" />
- <p class="form-desc">{{ $t('integrations.mcpserver.rateLimitHint') }}</p>
- </div>
- </section>
-
- <section v-if="editing" class="setting-drawer__section">
- <h4 class="setting-drawer__section-title">{{ $t('integrations.mcpserver.sectionConnect') }}</h4>
- <p class="form-desc form-desc--block">{{ $t('integrations.mcpserver.connectHintExisting', { hint: editing.token_hint }) }}</p>
- <div class="code-toolbar">
- <pre class="code-toolbar__code">{{ endpointUrl(editing) }}</pre>
- <t-button class="code-toolbar__copy" size="small" variant="text" shape="square" :title="$t('common.copy')" @click="copyText(endpointUrl(editing))">
- <t-icon name="file-copy" size="16px" />
- </t-button>
- </div>
- <t-button size="small" variant="outline" @click="openConnectDialog(editing, '')">
- {{ $t('integrations.mcpserver.showSnippets') }}
- </t-button>
- </section>
- </SettingDrawer>
+ <p v-if="selectedToolCount === 0" class="form-desc form-desc--error">{{ $t('integrations.mcpserver.toolsRequired') }}</p>
+ </section>
+
+ <section v-if="askSelected" class="setting-drawer__section">
+ <h4 class="setting-drawer__section-title">{{ $t('integrations.mcpserver.sectionAsk') }}</h4>
+ <div class="form-item">
+ <label class="form-label">{{ $t('integrations.mcpserver.defaultAgentLabel') }}</label>
+ <t-select
+ v-model="form.default_agent_id"
+ filterable
+ clearable
+ :loading="agentsLoading"
+ :options="agentOptions"
+ :placeholder="$t('integrations.mcpserver.defaultAgentPlaceholder')"
+ />
+ <p class="form-desc">{{ $t('integrations.mcpserver.defaultAgentHint') }}</p>
+ </div>
+ </section>
+
+ <section class="setting-drawer__section">
+ <h4 class="setting-drawer__section-title">{{ $t('integrations.mcpserver.sectionLimits') }}</h4>
+ <div class="form-item">
+ <label class="form-label">{{ $t('integrations.mcpserver.rateLimitLabel') }}</label>
+ <t-input-number v-model="form.rate_limit_per_minute" class="form-number" :min="1" :max="6000" theme="column" />
+ <p class="form-desc">{{ $t('integrations.mcpserver.rateLimitHint') }}</p>
+ </div>
+ </section>
+ </div>
- <t-dialog
- v-model:visible="connectVisible"
- :header="connectToken ? $t('integrations.mcpserver.tokenDialogTitle') : $t('integrations.mcpserver.connectDialogTitle')"
- width="640px"
- :footer="false"
- :close-on-overlay-click="!connectToken"
- >
- <div class="connect-dialog">
- <t-alert v-if="connectToken" theme="warning" :message="$t('integrations.mcpserver.tokenOnce')" class="connect-dialog__alert" />
- <p v-else class="form-desc form-desc--block">{{ $t('integrations.mcpserver.connectPlaceholderHint') }}</p>
-
- <div v-if="connectToken" class="form-item">
- <label class="form-label">{{ $t('integrations.mcpserver.tokenLabel') }}</label>
- <div class="code-toolbar">
- <pre class="code-toolbar__code">{{ connectToken }}</pre>
- <t-button class="code-toolbar__copy" size="small" variant="text" shape="square" :title="$t('common.copy')" @click="copyText(connectToken)">
- <t-icon name="file-copy" size="16px" />
- </t-button>
+ <!-- Step 2: connection (token shown once right after create / rotate) -->
+ <div v-else-if="editing" class="im-step-body">
+ <section class="setting-drawer__section">
+ <h4 class="setting-drawer__section-title">{{ $t('integrations.mcpserver.sectionConnect') }}</h4>
+ <t-alert v-if="freshToken" theme="warning" :message="$t('integrations.mcpserver.tokenOnce')" class="connect-alert" />
+ <p v-else class="form-desc form-desc--block">
+ {{ $t('integrations.mcpserver.connectHintExisting', { hint: editing.token_hint }) }}
+ </p>
+
+ <div v-if="freshToken" class="form-item">
+ <label class="form-label">{{ $t('integrations.mcpserver.tokenLabel') }}</label>
+ <div class="code-toolbar">
+ <pre class="code-toolbar__code">{{ freshToken }}</pre>
+ <t-button class="code-toolbar__copy" size="small" variant="text" shape="square" :title="$t('common.copy')" @click="copyText(freshToken)">
+ <t-icon name="file-copy" size="16px" />
+ </t-button>
+ </div>
</div>
- </div>
- <div class="form-item">
- <label class="form-label">{{ $t('integrations.mcpserver.urlLabel') }}</label>
- <div class="code-toolbar">
- <pre class="code-toolbar__code">{{ connectUrl }}</pre>
- <t-button class="code-toolbar__copy" size="small" variant="text" shape="square" :title="$t('common.copy')" @click="copyText(connectUrl)">
- <t-icon name="file-copy" size="16px" />
- </t-button>
+ <div class="form-item">
+ <label class="form-label">{{ $t('integrations.mcpserver.urlLabel') }}</label>
+ <div class="code-toolbar">
+ <pre class="code-toolbar__code">{{ endpointUrl(editing) }}</pre>
+ <t-button class="code-toolbar__copy" size="small" variant="text" shape="square" :title="$t('common.copy')" @click="copyText(endpointUrl(editing))">
+ <t-icon name="file-copy" size="16px" />
+ </t-button>
+ </div>
</div>
- </div>
- <div v-for="snippet in connectSnippets" :key="snippet.key" class="form-item">
- <label class="form-label">{{ $t(`integrations.mcpserver.snippet.${snippet.key}Title`) }}</label>
- <p class="form-desc form-desc--block">{{ $t(`integrations.mcpserver.snippet.${snippet.key}Desc`) }}</p>
- <div class="code-toolbar">
- <pre class="code-toolbar__code">{{ snippet.text }}</pre>
- <t-button class="code-toolbar__copy" size="small" variant="text" shape="square" :title="$t('common.copy')" @click="copyText(snippet.text)">
- <t-icon name="file-copy" size="16px" />
- </t-button>
+ <div class="form-item">
+ <label class="form-label">{{ $t('integrations.mcpserver.snippetsLabel') }}</label>
+ <p v-if="!freshToken" class="form-desc form-desc--block">{{ $t('integrations.mcpserver.connectPlaceholderHint') }}</p>
+ <t-tabs v-model="snippetTab" size="medium" class="snippet-tabs">
+ <t-tab-panel v-for="snippet in connectSnippets" :key="snippet.key" :value="snippet.key" :label="$t(`integrations.mcpserver.snippet.${snippet.key}Title`)">
+ <p class="form-desc form-desc--block">{{ $t(`integrations.mcpserver.snippet.${snippet.key}Desc`) }}</p>
+ <div class="code-toolbar">
+ <pre class="code-toolbar__code">{{ snippet.text }}</pre>
+ <t-button class="code-toolbar__copy" size="small" variant="text" shape="square" :title="$t('common.copy')" @click="copyText(snippet.text)">
+ <t-icon name="file-copy" size="16px" />
+ </t-button>
+ </div>
+ </t-tab-panel>
+ </t-tabs>
</div>
- </div>
+ </section>
</div>
- </t-dialog>
+ </SettingDrawer>
</div>
</template>
@@ -287,6 +303,25 @@ const agentOptions = computed(() => agents.value.map((a) => ({ label: a.name, va
const showDrawer = ref(false)
const saving = ref(false)
const editing = ref<McpEndpoint | null>(null)
+const wizardStep = ref(0)
+const snippetTab = ref('http')
+// Plaintext token from the create / rotate response; shown once on step 2.
+const freshToken = ref('')
+
+const stepTitles = computed(() => [
+ t('integrations.mcpserver.stepConfig'),
+ t('integrations.mcpserver.stepConnect'),
+])
+const drawerStepDescription = computed(() => {
+ if (wizardStep.value === 0) return t('integrations.mcpserver.drawerDesc')
+ return freshToken.value
+ ? t('integrations.mcpserver.tokenDialogTitle')
+ : t('integrations.mcpserver.connectDialogTitle')
+})
+const drawerConfirmText = computed(() => {
+ if (wizardStep.value > 0) return t('common.finish')
+ return editing.value ? t('common.save') : t('integrations.mcpserver.create')
+})
const form = reactive({
name: '',
description: '',
@@ -302,18 +337,14 @@ const selectedToolNames = computed(() => catalog.value.tools.filter((tl) => tool
const selectedToolCount = computed(() => selectedToolNames.value.length)
const askSelected = computed(() => toolSelections.ask === true)
-const connectVisible = ref(false)
-const connectToken = ref('')
-const connectEndpoint = ref<McpEndpoint | null>(null)
-const connectUrl = computed(() => (connectEndpoint.value ? endpointUrl(connectEndpoint.value) : ''))
const connectSnippets = computed(() => {
- const ep = connectEndpoint.value
+ const ep = editing.value
if (!ep) return []
const url = endpointUrl(ep)
return [
- { key: 'http', text: buildHttpClientSnippet(ep.name, url, connectToken.value, ep.id) },
- { key: 'claudeCode', text: buildClaudeCodeCommand(ep.name, url, connectToken.value, ep.id) },
- { key: 'stdio', text: buildStdioBridgeSnippet(ep.name, url, connectToken.value, ep.id) },
+ { key: 'http', text: buildHttpClientSnippet(ep.name, url, freshToken.value, ep.id) },
+ { key: 'claudeCode', text: buildClaudeCodeCommand(ep.name, url, freshToken.value, ep.id) },
+ { key: 'stdio', text: buildStdioBridgeSnippet(ep.name, url, freshToken.value, ep.id) },
]
})
@@ -382,20 +413,40 @@ async function loadOptions() {
function openCreate() {
editing.value = null
+ freshToken.value = ''
+ wizardStep.value = 0
resetForm(null)
showDrawer.value = true
void loadOptions()
}
-function openEdit(ep: McpEndpoint) {
+function openEdit(ep: McpEndpoint, step: 0 | 1 = 0, token = '') {
editing.value = ep
+ freshToken.value = token
+ wizardStep.value = step
+ snippetTab.value = 'http'
resetForm(ep)
showDrawer.value = true
- void loadOptions()
+ if (step === 0) void loadOptions()
+}
+
+function goToWizardStep(step: number) {
+ if (step < 0 || step >= stepTitles.value.length) return
+ if (step > 0 && !editing.value) return
+ wizardStep.value = step
}
function closeDrawer() {
showDrawer.value = false
+ freshToken.value = ''
+}
+
+function handleDrawerConfirm() {
+ if (wizardStep.value > 0) {
+ closeDrawer()
+ return
+ }
+ void saveForm()
}
function buildPayload(): McpEndpointPayload {
@@ -430,9 +481,10 @@ async function saveForm() {
} else {
const res = await createMcpEndpoint(payload)
MessagePlugin.success(t('integrations.mcpserver.created'))
- showDrawer.value = false
await load()
- if (res?.data) openConnectDialog(res.data, res.data.token || '')
+ // Stay in the drawer and move to the connection step so the one-time
+ // token is read in place instead of in a second, taller dialog.
+ if (res?.data) openEdit(res.data, 1, res.data.token || '')
}
} catch (err: any) {
MessagePlugin.error(err?.message || t('integrations.mcpserver.saveFailed'))
@@ -456,7 +508,7 @@ async function rotateToken(ep: McpEndpoint) {
const res = await rotateMcpEndpointToken(ep.id)
MessagePlugin.success(t('integrations.mcpserver.rotated'))
await load()
- if (res?.data) openConnectDialog(res.data, res.data.token || '')
+ if (res?.data) openEdit(res.data, 1, res.data.token || '')
} catch (err: any) {
MessagePlugin.error(err?.message || t('integrations.mcpserver.rotateFailed'))
}
@@ -472,12 +524,6 @@ async function toggleEnabled(ep: McpEndpoint) {
}
}
-function openConnectDialog(ep: McpEndpoint, token: string) {
- connectEndpoint.value = ep
- connectToken.value = token
- connectVisible.value = true
-}
-
function menuOptions(ep: McpEndpoint) {
return [
{ content: t('integrations.mcpserver.menuConnect'), value: 'connect' },
@@ -489,7 +535,7 @@ function menuOptions(ep: McpEndpoint) {
function handleMenuClick(option: { value?: string | number }, ep: McpEndpoint) {
switch (option?.value) {
case 'connect':
- openConnectDialog(ep, '')
+ openEdit(ep, 1)
break
case 'toggle':
void toggleEnabled(ep)
@@ -641,13 +687,101 @@ onMounted(() => {
right: 6px;
}
-.connect-dialog {
+.connect-alert {
+ margin-bottom: 8px;
+}
+
+.snippet-tabs {
+ margin-top: 4px;
+
+ :deep(.t-tabs__content) {
+ padding-top: 8px;
+ }
+}
+
+/* Step rail, aligned with the embed / IM channel drawers. */
+.im-steps {
display: flex;
- flex-direction: column;
- gap: 12px;
+ gap: 8px;
+ margin-bottom: 16px;
+ border-bottom: 1px solid var(--td-component-stroke);
+ padding-bottom: 12px;
}
-.connect-dialog__alert {
- margin-bottom: 4px;
+.im-step {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ flex: 1;
+ min-width: 0;
+ font-size: 12px;
+ color: var(--td-text-color-placeholder);
+ padding: 0;
+ border: none;
+ background: transparent;
+ font-family: inherit;
+ text-align: left;
+ cursor: pointer;
+
+ &:hover:not(:disabled) {
+ color: var(--td-text-color-secondary);
+ }
+
+ &:disabled {
+ cursor: default;
+ }
+}
+
+.im-step-title {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.im-step.active {
+ color: var(--td-brand-color);
+ font-weight: 500;
+}
+
+.im-step.done {
+ color: var(--td-text-color-secondary);
+ font-weight: 500;
+}
+
+.im-step-num {
+ flex-shrink: 0;
+ width: 20px;
+ height: 20px;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 11px;
+ font-weight: 600;
+ border: 1px solid var(--td-component-stroke);
+ color: var(--td-text-color-placeholder);
+ background: transparent;
+}
+
+.im-step.active .im-step-num {
+ background: var(--td-brand-color);
+ color: #fff;
+ border-color: var(--td-brand-color);
+}
+
+.im-step.done .im-step-num {
+ background: var(--td-bg-color-secondarycontainer);
+ color: var(--td-brand-color);
+ border-color: var(--td-component-stroke);
+}
+
+.im-step-check {
+ font-size: 12px;
+}
+
+.im-step-body {
+ display: flex;
+ flex-direction: column;
}
</style>