diff --git a/public/admin.html b/public/admin.html index 5714f03..5ab01fc 100644 --- a/public/admin.html +++ b/public/admin.html @@ -117,7 +117,7 @@
| 名称 | 关联项目 | 权限 | Token | +名称 | 关联项目 | 权限 | MCP 访问 | Token | 状态 | 过期时间 | 创建时间 | 操作 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 暂无 Token | ||||||||||||
| 暂无 Token | " + esc(t.name) + " | " + "" + esc(t.projectId === "all" ? "全部项目" : t.projectId) + " | " + '' + (t.permission === "readwrite" ? "读写" : "只读") + " | " + + '' + (t.mcpEnabled + ? 'MCP' + : '—') + " | " + '' +
'' + masked + "" +
'' +
@@ -508,7 +517,7 @@
" " + fmtDate(t.expiresAt) + " | " +
"" + fmtDate(t.createdAt) + " | " +
'' +
- ' " +
+ ' " +
(t.enabled
? '"
: "") +
@@ -559,6 +568,7 @@
document.getElementById("input-token-project").value = "all";
document.getElementById("input-token-permission").value = "readonly";
document.getElementById("input-token-expiry").value = "90";
+ document.getElementById("input-token-mcp").checked = false;
document.getElementById("btn-save-token").textContent = "生成";
loadProjectsForSelect();
openModal("modal-token");
@@ -570,6 +580,7 @@
document.getElementById("input-token-name").value = t.name;
document.getElementById("input-token-project").value = t.projectId;
document.getElementById("input-token-permission").value = t.permission;
+ document.getElementById("input-token-mcp").checked = !!(t.mcpEnabled);
document.getElementById("btn-save-token").textContent = "保存";
loadProjectsForSelect();
openModal("modal-token");
@@ -585,6 +596,7 @@
name: name,
projectId: document.getElementById("input-token-project").value,
permission: document.getElementById("input-token-permission").value,
+ mcpEnabled: document.getElementById("input-token-mcp").checked,
});
closeModal("modal-token");
toast("Token 已更新", "success");
@@ -594,6 +606,7 @@
name: name,
projectId: document.getElementById("input-token-project").value,
permission: document.getElementById("input-token-permission").value,
+ mcpEnabled: document.getElementById("input-token-mcp").checked,
expiresInDays: parseInt(document.getElementById("input-token-expiry").value) || 0,
});
closeModal("modal-token");
diff --git a/src/mcp/index.js b/src/mcp/index.js
index cfb2b5b..bc68e9f 100644
--- a/src/mcp/index.js
+++ b/src/mcp/index.js
@@ -1,7 +1,7 @@
/**
* MCP HTTP 传输层
* 以 Streamable HTTP 协议在 /mcp 端点暴露 MCP 服务。
- * 鉴权:基于 data/mcp.json 中配置的 token,要求请求头 Authorization: Bearer | | ||||