Agent Core Extractor
从支持的框架仓库中提取仅含核心代码的压缩包,用于跨框架迁移或分析。
下载 25
通过 MGC Blackbox 实现数据库凭证零暴露管理,保障敏感信息不被 AI 模型访问。
openclaw skills install @zkeviny/mgc-database-security命令、参数、文件名以原文为准
数据库凭证安全(零暴露版)是一项文档型技能,旨在指导如何使用 MGC Blackbox 安全管理数据库凭证。支持 MySQL、PostgreSQL、SQLite、MariaDB 等多种数据库。该技能使 AI 代理能够在执行数据库操作时,始终不暴露数据库密码或连接字符串给 AI 模型。
本技能不含任何可执行代码,适用于自动审批流程,安全性高。
阅读本说明后,AI 代理将能够:
pip install mgc-blackboxmgc(默认运行于 http://127.0.0.1:57219)~/.mgc/database/mgc_black_box/.mgc_token创建一个包含数据库连接信息的 JSON 文件:
{
"host": "localhost",
"port": 3306,
"database": "my_database",
"user": "db_user",
"password": "your_password"
}重要提示: 对于 AI 代理,请使用 MCP 工具。CLI 可能在某些环境中引发端口冲突。
推荐方式:MCP 接口
mgc_save MCP 工具存储凭证mgc_get MCP 工具检索凭证替代方式:CLI(仅限本地开发)
mgc_save info_type=config info_owner=my_database < credentials.json一个安全的数据库脚本应遵循以下流程:
脚本不得打印或暴露数据库凭证。
function execute_query(sql):
credentials = retrieve_from_mgc("my_database")
connection = connect(credentials)
result = connection.execute(sql)
connection.close()
return resulthttp://127.0.0.1:57219~/.mgc/database/mgc_black_box/.mgc_token端点: /api/mgc/sensitive/get
方法: POST
请求头:
X-MGC-Token: (从令牌文件读取的字符串)Content-Type: application/json请求体字段:
info_type: "config"info_owner: 自定义标识符响应字段:
code: 状态码data.content: 存储的凭证 JSON 字符串端点: /api/mgc/sensitive/save
方法: POST
请求头: 与上述相同
请求体字段:
info_type: "config"info_owner: 标识符content: 凭证的 JSON 字符串提示: 用户也可通过 MGC WebUI 手动存储凭证,访问地址为
http://127.0.0.1:57218/skill
import mysql.connector
def get_connection(credentials):
return mysql.connector.connect(
host=credentials["host"],
port=credentials["port"],
database=credentials["database"],
user=credentials["user"],
password=credentials["password"]
)
def execute_query(sql):
creds = retrieve_from_mgc("my_mysql")
conn = get_connection(creds)
cursor = conn.cursor()
cursor.execute(sql)
result = cursor.fetchall()
cursor.close()
conn.close()
return resultMIT
已收录 1 个 Skill