relational-database-mcp-cloudbase
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWhen to use this skill
何时使用该Skill
Use this skill when an agent needs to operate on CloudBase Relational Database via MCP tools, for example:
- Inspecting or querying data in tables
- Modifying data or schema (INSERT/UPDATE/DELETE/DDL)
- Reading or changing table security rules
Do NOT use this skill for:
- Building Web or Node.js applications that talk to CloudBase Relational Database (use the Web/Node Relational Database skills)
- Auth flows or user identity (use the Auth skills)
当Agent需要通过MCP工具操作CloudBase关系型数据库时,使用该Skill,例如:
- 检查或查询表中的数据
- 修改数据或模式(INSERT/UPDATE/DELETE/DDL)
- 读取或修改表的安全规则
请勿将该Skill用于:
- 构建与CloudBase关系型数据库交互的Web或Node.js应用(请使用Web/Node关系型数据库相关Skill)
- 认证流程或用户身份管理(请使用认证相关Skill)
How to use this skill (for a coding agent)
如何使用该Skill(针对编码Agent)
-
Recognize MCP context
- If you can call tools like ,
executeReadOnlySQL,executeWriteSQL,readSecurityRule, you are in MCP context.writeSecurityRule - In this context, never initialize SDKs for CloudBase Relational Database; use MCP tools instead.
- If you can call tools like
-
Pick the right tool for the job
- Reads →
executeReadOnlySQL - Writes/DDL →
executeWriteSQL - Inspect rules →
readSecurityRule - Change rules →
writeSecurityRule
- Reads →
-
Always be explicit about safety
- Before destructive operations (DELETE, DROP, etc.), summarize what you are about to run and why.
- Prefer running read-only SELECTs first to verify assumptions.
-
识别MCP上下文
- 如果您可以调用、
executeReadOnlySQL、executeWriteSQL、readSecurityRule等工具,说明您处于MCP上下文环境中。writeSecurityRule - 在该上下文环境中,绝对不要初始化CloudBase关系型数据库的SDK;请改用MCP工具。
- 如果您可以调用
-
为任务选择合适的工具
- 读取操作 →
executeReadOnlySQL - 写入/DDL操作 →
executeWriteSQL - 检查规则 →
readSecurityRule - 修改规则 →
writeSecurityRule
- 读取操作 →
-
始终明确安全性
- 在执行破坏性操作(DELETE、DROP等)之前,总结您即将执行的操作内容及原因。
- 优先运行只读SELECT语句来验证假设。
Available MCP tools (CloudBase Relational Database)
可用的MCP工具(CloudBase关系型数据库)
These tools are the only supported way to interact with CloudBase Relational Database via MCP:
这些工具是唯一支持通过MCP与CloudBase关系型数据库交互的方式:
1. executeReadOnlySQL
executeReadOnlySQL1. executeReadOnlySQL
executeReadOnlySQL- Purpose: Run queries (read-only).
SELECT - Use for:
- Listing rows, aggregations, joins.
- Inspecting data before changing it.
Example call (conceptual):
sql
SELECT id, email FROM users WHERE active = true ORDER BY created_at DESC LIMIT 50;Call this through the MCP tool instead of embedding SQL in code.
- 用途: 运行查询(只读)。
SELECT - 适用场景:
- 列出行数据、聚合、连接查询。
- 在修改数据前检查数据。
示例调用(概念性):
sql
SELECT id, email FROM users WHERE active = true ORDER BY created_at DESC LIMIT 50;请通过MCP工具调用该查询,而非将SQL嵌入代码中。
2. executeWriteSQL
executeWriteSQL2. executeWriteSQL
executeWriteSQL- Purpose: Run write or DDL statements:
- ,
INSERT,UPDATEDELETE - ,
CREATE TABLE,ALTER TABLEDROP TABLE
- Use for:
- Data migrations
- Fixing or seeding data
- Schema changes
Important: When creating a new table, you must include the column for per-user access control:
_openidsql
_openid VARCHAR(64) DEFAULT '' NOT NULL💡 Note about: When a user is logged in, the_openidfield is automatically populated by the server with the current user's identity. You do NOT need to manually set this field in INSERT operations - the server will fill it automatically based on the authenticated user's session._openid
Before calling this tool, confirm:
- The target tables and conditions are correct.
- You have run a corresponding via
SELECTwhen appropriate.executeReadOnlySQL
- 用途: 运行写入或DDL语句:
- 、
INSERT、UPDATEDELETE - 、
CREATE TABLE、ALTER TABLEDROP TABLE
- 适用场景:
- 数据迁移
- 修复或填充数据
- 模式变更
重要提示: 创建新表时,您必须包含列以实现按用户访问控制:
_openidsql
_openid VARCHAR(64) DEFAULT '' NOT NULL💡 关于的说明:当用户登录后,服务器会自动将当前用户的身份信息填充到_openid字段。您无需在INSERT操作中手动设置该字段——服务器会根据已认证用户的会话自动填充。_openid
调用该工具前,请确认:
- 目标表和条件是正确的。
- 适当时,已通过运行对应的SELECT查询。
executeReadOnlySQL
3. readSecurityRule
readSecurityRule3. readSecurityRule
readSecurityRule- Purpose: Read security rules for a given table.
- Use for:
- Understanding who can read/write a table.
- Auditing permissions on sensitive tables.
Security rule types typically include:
- – anyone can read, no one can write
READONLY - – only authenticated users can read/write
PRIVATE - – anyone can read, only admins can write
ADMINWRITE - – only admins can read/write
ADMINONLY - – custom security logic
CUSTOM
- 用途: 读取指定表的安全规则。
- 适用场景:
- 了解谁可以读写该表。
- 审计敏感表的权限。
安全规则类型通常包括:
- – 任何人可读取,无人可写入
READONLY - – 仅已认证用户可读写
PRIVATE - – 任何人可读取,仅管理员可写入
ADMINWRITE - – 仅管理员可读写
ADMINONLY - – 自定义安全逻辑
CUSTOM
4. writeSecurityRule
writeSecurityRule4. writeSecurityRule
writeSecurityRule- Purpose: Set or update security rules for a table.
- Use for:
- Hardening access to sensitive data
- Opening up read access while restricting writes
- Applying custom rules when needed
When using this tool:
- Clearly explain the intent (who should read/write what).
- Prefer standard rule types (,
READONLY, etc.) beforePRIVATE.CUSTOM
- 用途: 设置或更新表的安全规则。
- 适用场景:
- 强化敏感数据的访问权限
- 开放读取权限同时限制写入权限
- 必要时应用自定义规则
使用该工具时:
- 明确说明意图(谁应该读写什么数据)。
- 优先使用标准规则类型(、
READONLY等),而非PRIVATE。CUSTOM
Scenario 1: Safely inspect data in a table
场景1:安全检查表中的数据
- Use with a limited
executeReadOnlySQL:SELECT- Include a clause.
LIMIT - Filter by relevant conditions.
- Include a
- Review the result set and confirm it matches expectations.
This pattern prevents accidental full-table scans and gives you context before any write operations.
- 使用执行带限制的
executeReadOnlySQL查询:SELECT- 包含子句。
LIMIT - 按相关条件过滤。
- 包含
- 查看结果集并确认其符合预期。
该模式可防止意外的全表扫描,并在执行任何写入操作前为您提供上下文信息。
Scenario 2: Apply a schema change
场景2:应用模式变更
- Use to inspect the current schema or data (if needed).
executeReadOnlySQL - Plan the /
CREATE TABLEstatement.ALTER TABLE - Run it once via .
executeWriteSQL - Optionally, validate by running again.
SELECT
Always describe:
- What schema change you are making.
- Why it is safe in the current context.
- 使用检查当前模式或数据(如有需要)。
executeReadOnlySQL - 规划/
CREATE TABLE语句。ALTER TABLE - 通过运行一次该语句。
executeWriteSQL - 可选:再次运行SELECT查询以验证结果。
始终说明:
- 您正在进行的模式变更内容。
- 该变更在当前上下文中为何是安全的。
Scenario 3: Tighten security rules on a sensitive table
场景3:收紧敏感表的安全规则
- Call for the table to see current settings.
readSecurityRule - Decide on the target rule (e.g., from →
READONLY).PRIVATE - Explain the change and why it matches the user’s requirements.
- Call with the new rule.
writeSecurityRule - Optionally, re-read the rule to confirm the update.
- 调用查看该表的当前设置。
readSecurityRule - 确定目标规则(例如从改为
READONLY)。PRIVATE - 说明变更内容及为何符合用户需求。
- 调用设置新规则。
writeSecurityRule - 可选:重新读取规则以确认更新成功。
Key principle: MCP tools vs SDKs
核心原则:MCP工具 vs SDK
-
MCP tools are for agent operations and database management:
- Run ad-hoc SQL.
- Inspect and change security rules.
- Do not depend on application auth state.
-
SDKs are for application code:
- Frontend Web apps → Web Relational Database skill.
- Backend Node apps → Node Relational Database quickstart.
When working as an MCP agent, always prefer these MCP tools for CloudBase Relational Database, and avoid mixing them with SDK initialization in the same flow.
-
MCP工具适用于Agent操作和数据库管理:
- 运行临时SQL查询。
- 检查和修改安全规则。
- 不依赖应用的认证状态。
-
SDK适用于应用代码:
- 前端Web应用 → Web关系型数据库Skill。
- 后端Node应用 → Node关系型数据库快速入门。
当作为MCP Agent工作时,请始终优先使用这些MCP工具操作CloudBase关系型数据库,避免在同一流程中混合使用SDK初始化。