341 lines
9.9 KiB
HTML
341 lines
9.9 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>MCP 配置代码生成器 · 光湖</title>
|
||
<style>
|
||
:root {
|
||
--bg: #0a0e1a;
|
||
--surface: #111827;
|
||
--border: #1e293b;
|
||
--text: #e2e8f0;
|
||
--text-muted: #94a3b8;
|
||
--accent: #3b82f6;
|
||
--accent-glow: rgba(59,130,246,0.25);
|
||
--success: #22c55e;
|
||
--gold: #f59e0b;
|
||
--radius: 12px;
|
||
}
|
||
* { margin:0; padding:0; box-sizing:border-box; }
|
||
body {
|
||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
||
background: var(--bg);
|
||
color: var(--text);
|
||
min-height: 100vh;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
padding: 40px 20px;
|
||
}
|
||
.container {
|
||
max-width: 800px;
|
||
width: 100%;
|
||
}
|
||
/* 头部 */
|
||
.header {
|
||
text-align: center;
|
||
margin-bottom: 40px;
|
||
}
|
||
.header h1 {
|
||
font-size: 28px;
|
||
font-weight: 700;
|
||
letter-spacing: 2px;
|
||
background: linear-gradient(135deg, #60a5fa, #a78bfa);
|
||
-webkit-background-clip: text;
|
||
-webkit-text-fill-color: transparent;
|
||
background-clip: text;
|
||
}
|
||
.header .subtitle {
|
||
color: var(--text-muted);
|
||
font-size: 14px;
|
||
margin-top: 8px;
|
||
}
|
||
.header .server-badge {
|
||
display: inline-block;
|
||
margin-top: 12px;
|
||
padding: 4px 14px;
|
||
background: rgba(34,197,94,0.12);
|
||
border: 1px solid rgba(34,197,94,0.3);
|
||
border-radius: 20px;
|
||
color: var(--success);
|
||
font-size: 13px;
|
||
}
|
||
/* 卡片 */
|
||
.card {
|
||
background: var(--surface);
|
||
border: 1px solid var(--border);
|
||
border-radius: var(--radius);
|
||
padding: 24px;
|
||
margin-bottom: 20px;
|
||
}
|
||
.card-title {
|
||
font-size: 16px;
|
||
font-weight: 600;
|
||
margin-bottom: 16px;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
}
|
||
.card-title .step {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 24px; height: 24px;
|
||
border-radius: 50%;
|
||
background: var(--accent);
|
||
color: #fff;
|
||
font-size: 12px;
|
||
font-weight: 700;
|
||
}
|
||
/* 代码块 */
|
||
.code-block {
|
||
position: relative;
|
||
background: #0d1117;
|
||
border: 1px solid var(--border);
|
||
border-radius: 8px;
|
||
padding: 20px;
|
||
font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
|
||
font-size: 13px;
|
||
line-height: 1.7;
|
||
overflow-x: auto;
|
||
white-space: pre-wrap;
|
||
word-break: break-all;
|
||
color: #e6edf3;
|
||
}
|
||
.code-block .json-key { color: #79c0ff; }
|
||
.code-block .json-string { color: #a5d6ff; }
|
||
.code-block .json-number { color: #79c0ff; }
|
||
.code-block .json-boolean { color: #ff7b72; }
|
||
.code-block .json-null { color: #ff7b72; }
|
||
.code-block .json-bracket { color: #d2a8ff; }
|
||
.code-block .json-colon { color: #c9d1d9; }
|
||
.copy-btn {
|
||
position: absolute;
|
||
top: 10px;
|
||
right: 10px;
|
||
padding: 6px 14px;
|
||
font-size: 12px;
|
||
background: rgba(59,130,246,0.15);
|
||
border: 1px solid rgba(59,130,246,0.3);
|
||
border-radius: 6px;
|
||
color: var(--accent);
|
||
cursor: pointer;
|
||
transition: all 0.2s;
|
||
}
|
||
.copy-btn:hover { background: rgba(59,130,246,0.25); }
|
||
.copy-btn.copied {
|
||
background: rgba(34,197,94,0.2);
|
||
border-color: var(--success);
|
||
color: var(--success);
|
||
}
|
||
/* 步骤说明 */
|
||
.step-item {
|
||
display: flex;
|
||
gap: 14px;
|
||
padding: 12px 0;
|
||
border-bottom: 1px solid rgba(255,255,255,0.05);
|
||
}
|
||
.step-item:last-child { border-bottom: none; }
|
||
.step-num {
|
||
flex-shrink: 0;
|
||
width: 28px; height: 28px;
|
||
border-radius: 50%;
|
||
background: rgba(59,130,246,0.15);
|
||
color: var(--accent);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 13px;
|
||
font-weight: 700;
|
||
}
|
||
.step-text { font-size: 14px; line-height: 1.6; color: var(--text-muted); }
|
||
.step-text strong { color: var(--text); }
|
||
/* 状态 */
|
||
.status-bar {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
padding: 10px 16px;
|
||
background: rgba(34,197,94,0.06);
|
||
border: 1px solid rgba(34,197,94,0.15);
|
||
border-radius: 8px;
|
||
margin-bottom: 16px;
|
||
font-size: 13px;
|
||
color: var(--text-muted);
|
||
}
|
||
.status-dot {
|
||
width: 8px; height: 8px;
|
||
border-radius: 50%;
|
||
background: var(--gold);
|
||
animation: pulse 1.5s infinite;
|
||
}
|
||
.status-dot.online { background: var(--success); animation: none; }
|
||
@keyframes pulse {
|
||
0%, 100% { opacity: 1; }
|
||
50% { opacity: 0.3; }
|
||
}
|
||
/* 页脚 */
|
||
.footer {
|
||
text-align: center;
|
||
padding: 30px 0;
|
||
color: var(--text-muted);
|
||
font-size: 12px;
|
||
}
|
||
.footer a { color: var(--accent); text-decoration: none; }
|
||
/* 加载 */
|
||
.loading {
|
||
text-align: center;
|
||
padding: 40px;
|
||
color: var(--text-muted);
|
||
}
|
||
.loading::after {
|
||
content: '...';
|
||
animation: dots 1.5s infinite;
|
||
}
|
||
@keyframes dots {
|
||
0% { content: '.'; }
|
||
33% { content: '..'; }
|
||
66% { content: '...'; }
|
||
}
|
||
/* 令牌安全提示 */
|
||
.tip {
|
||
padding: 12px 16px;
|
||
background: rgba(245,158,11,0.08);
|
||
border: 1px solid rgba(245,158,11,0.2);
|
||
border-radius: 8px;
|
||
font-size: 13px;
|
||
color: var(--gold);
|
||
margin-bottom: 16px;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="container">
|
||
<div class="header">
|
||
<h1>◐ 光湖 · MCP 配置生成器</h1>
|
||
<div class="subtitle">一键生成 WorkBuddy MCP 连接配置 · 换账号也能秒级接入</div>
|
||
<div id="serverBadge" class="server-badge">⟐ 正在检测服务器状态...</div>
|
||
</div>
|
||
|
||
<div class="card">
|
||
<div class="card-title"><span class="step">1</span> 复制以下配置代码</div>
|
||
<div id="statusBar" class="status-bar">
|
||
<div id="statusDot" class="status-dot"></div>
|
||
<span id="statusText">正在读取仓库 MCP 配置...</span>
|
||
</div>
|
||
<div class="tip">⚠ 此配置包含认证令牌,请勿分享给他人。令牌与仓库 `.workbuddy/mcp.json` 同步更新。</div>
|
||
<div class="code-block" id="configDisplay">
|
||
<button class="copy-btn" id="copyBtn" onclick="copyConfig()">📋 复制</button>
|
||
<span id="configContent">正在加载配置...</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="card">
|
||
<div class="card-title"><span class="step">2</span> 配置步骤</div>
|
||
<div class="step-item">
|
||
<div class="step-num">1</div>
|
||
<div class="step-text">打开 WorkBuddy,进入 <strong>MCP 工具</strong> 配置界面</div>
|
||
</div>
|
||
<div class="step-item">
|
||
<div class="step-num">2</div>
|
||
<div class="step-text">点击上方 <strong>「复制」</strong> 按钮,将配置代码粘贴到 MCP 配置框中</div>
|
||
</div>
|
||
<div class="step-item">
|
||
<div class="step-num">3</div>
|
||
<div class="step-text">点击 <strong>「连接」</strong>,等待状态变为绿色即可</div>
|
||
</div>
|
||
<div class="step-item">
|
||
<div class="step-num">4</div>
|
||
<div class="step-text">如果连接失败,请确认 CVM 服务器已开机(<strong>guanghulab.com</strong> 能否访问)</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="footer">
|
||
◐ 光湖 · 铸渊 MCP Server · 主权 TCS-0002∞ 冰朔<br>
|
||
配置自动同步 · 更新于 <span id="updateTime">—</span>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
async function loadConfig() {
|
||
const badge = document.getElementById('serverBadge');
|
||
const statusText = document.getElementById('statusText');
|
||
const statusDot = document.getElementById('statusDot');
|
||
const configContent = document.getElementById('configContent');
|
||
|
||
try {
|
||
// 检测服务器健康
|
||
const healthResp = await fetch('https://guanghulab.com/mcp-health');
|
||
if (healthResp.ok) {
|
||
badge.textContent = '✦ MCP 服务器在线 · 配置有效';
|
||
badge.style.borderColor = 'rgba(34,197,94,0.3)';
|
||
badge.style.color = '#22c55e';
|
||
statusDot.className = 'status-dot online';
|
||
statusText.textContent = '已获取最新配置';
|
||
}
|
||
} catch (e) {
|
||
badge.textContent = '⟐ 服务器离线 · 配置仅供参考';
|
||
badge.style.borderColor = 'rgba(245,158,11,0.3)';
|
||
badge.style.color = '#f59e0b';
|
||
statusDot.className = 'status-dot';
|
||
statusText.textContent = '服务器未开机,显示上次保存配置';
|
||
}
|
||
|
||
try {
|
||
// 从仓库读取 MCP 配置
|
||
const configResp = await fetch('/bingshuo/guanghulab/raw/branch/main/.workbuddy/mcp.json');
|
||
if (configResp.ok) {
|
||
const config = await configResp.json();
|
||
configContent.textContent = JSON.stringify(config, null, 2);
|
||
document.getElementById('updateTime').textContent = new Date().toLocaleString('zh-CN');
|
||
} else {
|
||
// 后备方案:通过 API 读取
|
||
const apiResp = await fetch('/api/v1/repos/bingshuo/guanghulab/contents/.workbuddy/mcp.json');
|
||
if (apiResp.ok) {
|
||
const data = await apiResp.json();
|
||
const content = atob(data.content);
|
||
configContent.textContent = JSON.stringify(JSON.parse(content), null, 2);
|
||
document.getElementById('updateTime').textContent = new Date().toLocaleString('zh-CN');
|
||
} else {
|
||
throw new Error('无法读取配置');
|
||
}
|
||
}
|
||
} catch (e) {
|
||
configContent.textContent = `// ⚠ 无法自动读取配置\n// 请确保已登录 guanghulab.com\n// 错误: ${e.message}`;
|
||
}
|
||
}
|
||
|
||
async function copyConfig() {
|
||
const btn = document.getElementById('copyBtn');
|
||
const text = document.getElementById('configContent').textContent;
|
||
try {
|
||
await navigator.clipboard.writeText(text);
|
||
btn.textContent = '✅ 已复制';
|
||
btn.className = 'copy-btn copied';
|
||
setTimeout(() => {
|
||
btn.textContent = '📋 复制';
|
||
btn.className = 'copy-btn';
|
||
}, 2500);
|
||
} catch (e) {
|
||
// 回退方案
|
||
const ta = document.createElement('textarea');
|
||
ta.value = text;
|
||
document.body.appendChild(ta);
|
||
ta.select();
|
||
document.execCommand('copy');
|
||
document.body.removeChild(ta);
|
||
btn.textContent = '✅ 已复制';
|
||
btn.className = 'copy-btn copied';
|
||
setTimeout(() => {
|
||
btn.textContent = '📋 复制';
|
||
btn.className = 'copy-btn';
|
||
}, 2500);
|
||
}
|
||
}
|
||
|
||
loadConfig();
|
||
</script>
|
||
</body>
|
||
</html>
|