feat(mcp): P0 只读 MCP tool runtime + opsxdb-mcp stdio
- aitools 共用 runtime:list/describe/schema/query/redis(纯只读,无写确认) - 白名单 ~/.opsxdb/mcp.json;审计 mcp-audit.jsonl;复用 danger.go - 桌面 connections 双写 ~/.opsxdb/connections.json(ox1. 解码) - Cursor 配置示例与任务书验收勾选更新;写操作与 Agent UI 留 P1
This commit is contained in:
1 parent
5c17d32647
commit
0b68c8344d
19 files changed
+1989
-79
No files matched your search
@@ -0,0 +1,30 @@
|
||||
package aitools
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const secretPrefix = "ox1."
|
||||
|
||||
// DecodeSecret 与前端 src/secrets.ts decodeSecret 对齐:ox1. + base64(utf8)。 // Logan.Li
|
||||
func DecodeSecret(stored string) string {
|
||||
if stored == "" {
|
||||
return ""
|
||||
}
|
||||
if !strings.HasPrefix(stored, secretPrefix) {
|
||||
return stored
|
||||
}
|
||||
raw, err := base64.StdEncoding.DecodeString(stored[len(secretPrefix):])
|
||||
if err != nil {
|
||||
return stored
|
||||
}
|
||||
// 前端 encodeURIComponent 再 btoa;解码侧 escape/atob/decodeURIComponent。
|
||||
// Go 侧:先按 latin1 字节还原,再尝试 URL unescape。
|
||||
s := string(raw)
|
||||
if u, err := url.QueryUnescape(s); err == nil {
|
||||
return u
|
||||
}
|
||||
return s
|
||||
}
|
||||
Reference in new issue
Block a user