fix(dashboard): OpenCode 配置顶层 mcp 包裹;bump secrets-mcp 0.1.5

Made-with: Cursor
This commit is contained in:
voson
2026-03-21 09:23:51 +08:00
parent 0a8b14211a
commit b9f9534ce6
3 changed files with 6 additions and 4 deletions

2
Cargo.lock generated
View File

@@ -1949,7 +1949,7 @@ dependencies = [
[[package]] [[package]]
name = "secrets-mcp" name = "secrets-mcp"
version = "0.1.4" version = "0.1.5"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"askama", "askama",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "secrets-mcp" name = "secrets-mcp"
version = "0.1.4" version = "0.1.5"
edition.workspace = true edition.workspace = true
[[bin]] [[bin]]

View File

@@ -535,12 +535,14 @@ function buildOpencodeEntry(apiKey, encKey) {
}; };
} }
/** Full OpenCode config: MCP servers live under top-level `mcp`. */
function buildOpencodeConfigText(apiKey, encKey) { function buildOpencodeConfigText(apiKey, encKey) {
return JSON.stringify({ secrets: buildOpencodeEntry(apiKey, encKey) }, null, 2); return JSON.stringify({ mcp: { secrets: buildOpencodeEntry(apiKey, encKey) } }, null, 2);
} }
/** Strip outer `{` `}` so user can paste `secrets` under an existing `mcp` object. */
function buildOpencodeMergeSnippet(apiKey, encKey) { function buildOpencodeMergeSnippet(apiKey, encKey) {
const wrapped = buildOpencodeConfigText(apiKey, encKey); const wrapped = JSON.stringify({ secrets: buildOpencodeEntry(apiKey, encKey) }, null, 2);
const lines = wrapped.split('\n'); const lines = wrapped.split('\n');
return lines.length < 3 ? wrapped : lines.slice(1, -1).join('\n'); return lines.length < 3 ? wrapped : lines.slice(1, -1).join('\n');
} }