Skip to content

Commit 214e108

Browse files
author
piexlMax(奇淼
committed
feat(mcpTest): 添加复制MCP配置功能
1 parent b197a84 commit 214e108

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

web/src/view/systemTools/autoCode/mcpTest.vue

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
<template>
2-
<div class="p-5">
2+
<div class="p-2">
33

4-
<el-card class="mt-5">
4+
<el-card class="mb-2">
55
<template #header>
66
<div class="flex justify-between items-center font-bold">
77
<span>MCP 服务器配置示例</span>
8+
<el-tooltip content="复制配置" placement="top">
9+
<el-button :icon="DocumentCopy" circle @click="copyMcpConfig" />
10+
</el-tooltip>
811
</div>
912
</template>
1013
<pre class="font-mono whitespace-pre-wrap break-words bg-gray-100 p-2.5 rounded text-gray-700">{{ mcpServerConfig }}</pre>
1114
</el-card>
1215

1316

14-
<el-row :gutter="20">
17+
<el-row :gutter="8">
1518
<el-col v-for="tool in mcpTools" :key="tool.name" :xs="24" :sm="12" :md="8" :lg="6">
1619
<el-card class="mb-5 h-[150px] flex flex-col overflow-hidden">
1720
<template #header>
@@ -110,7 +113,7 @@
110113
<script setup>
111114
import { ref, reactive, onMounted } from 'vue'
112115
import { ElMessage } from 'element-plus'
113-
import { VideoPlay } from '@element-plus/icons-vue'
116+
import { VideoPlay, DocumentCopy } from '@element-plus/icons-vue' // Added DocumentCopy
114117
import { mcpList, mcpTest } from '@/api/autoCode'
115118
116119
const mcpTools = ref([])
@@ -142,6 +145,15 @@ onMounted(() => {
142145
fetchMcpTools()
143146
})
144147
148+
const copyMcpConfig = async () => {
149+
try {
150+
await navigator.clipboard.writeText(mcpServerConfig.value)
151+
ElMessage.success('配置已复制到剪贴板')
152+
} catch (err) {
153+
ElMessage.error('复制失败: ' + err)
154+
}
155+
}
156+
145157
const openTestDialog = (tool) => {
146158
currentTestingTool.value = tool
147159
apiDialogResponse.value = null // 清空之前的API响应

0 commit comments

Comments
 (0)