К основному содержанию
скилл CX Codex

relational-database-mcp-cloudbase — скилл для Claude Code: SQL

Скилл описывает, как агенту работать с реляционной базой CloudBase через MCP: читать данные, менять схему, править права. Помечен как устаревший.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add TencentCloudBase/skills --skill relational-database-mcp-cloudbase -a claude-code
Открыть на GitHub

Что делает relational-database-mcp-cloudbase

Скилл задаёт порядок работы агента с реляционной базой CloudBase через MCP-инструменты. Чтение и проверка состояния идут через queryMysqlDatabase: runQuery для SELECT, getInstanceInfo для проверки, есть ли инстанс, describeCreateResult и describeTaskStatus для незавершённых задач. Записи, DDL и инициализация схемы — через manageMysqlDatabase с действиями runStatement и initializeSchema. Права читает queryPermissions, меняет managePermissions.

Скилл помечен как deprecated, и это главное, что стоит знать до установки. Создать MySQL через MCP больше нельзя: действие provisionMySQL убрано, вызов с ним не проходит валидацию схемы, а при отсутствии инстанса возвращается MYSQL_NOT_CREATED со ссылкой на консоль. Новые окружения переводят на PostgreSQL, для них есть отдельный скилл postgresql-development. Уничтожение инстанса осталось, но требует явного подтверждения и последующей проверки через describeTaskStatus.

При создании таблиц скилл требует колонку _openid VARCHAR(64) DEFAULT '' NOT NULL — сервер заполняет её сам из сессии пользователя, вручную вставлять не нужно. Ещё одно ограничение: в MCP-контексте нельзя инициализировать SDK, а getConnectionInfo с сырыми учётными данными годится только для миграции существующих TCP-клиентов. Для новых приложений — SDK, runQuery или runStatement.

Какие задачи решает

  • посмотреть данные в таблице CloudBase, не поднимая SDK
  • уничтожить ненужный MySQL-инстанс и дождаться результата
  • создать таблицу с колонкой _openid под разграничение доступа
  • проверить, кто может читать и писать в таблицу
  • дождаться статуса незавершённой задачи по базе

Примеры запросов агенту

  • покажи последние 50 записей из таблицы users через queryMysqlDatabase
  • создай таблицу orders с колонкой _openid и инициализируй схему
  • проверь права на таблицу orders и обнови их

Как установить relational-database-mcp-cloudbase

1Через Skills CLI (Vercel)

npx skills add TencentCloudBase/skills --skill relational-database-mcp-cloudbase -a claude-code

2Вручную: положить файлы

~/.claude/skills/relational-database-mcp-cloudbase/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/relational-database-mcp-cloudbase/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о relational-database-mcp-cloudbase

Как установить relational-database-mcp-cloudbase в Claude?

Выполните npx skills add TencentCloudBase/skills --skill relational-database-mcp-cloudbase -a claude-code. Файл скилла появится по пути ~/.claude/skills/relational-database-mcp-cloudbase/SKILL.md.

Что делает relational-database-mcp-cloudbase?

Описывает для агента канонический порядок работы с реляционной базой CloudBase через MCP: чтение SQL, запись и DDL, инициализация схемы, чтение и смена прав, уничтожение инстанса.

Можно ли создать MySQL-инстанс через этот скилл?

Нет. Действие provisionMySQL убрано из набора, инстансы создаются только в консоли, а новые окружения переводят на PostgreSQL — для них есть скилл postgresql-development.

Исходный текст

SKILL.md · MIT
---
name: relational-database-mcp-cloudbase
description: "[Deprecated] This is the required documentation for agents operating on the CloudBase Relational Database through MCP. It defines the canonical SQL management flow with `queryMysqlDatabase`, `manageMysqlDatabase`, `queryPermissions`, and `managePermissions`, including destroy flow, async status checks, safe query execution, schema initialization, and permission updates. MySQL provisioning is no longer available through MCP; new environments should use PostgreSQL — see postgresql-development skill instead."
version: 2.36.1
license: MIT
alwaysApply: false
metadata:
  priority: "5"
  deprecated: "true"
---

## Sibling skills (local only)

Sibling CloudBase skills ship beside this skill. Use local relative paths such as `../auth-tool-cloudbase/SKILL.md`.

If a referenced sibling skill file is missing from this environment, ask the user to install the full CloudBase plugin (or the missing skill). Do **not** HTTP-fetch remote skill or protocol markdown into the agent context.

## Activation Contract

### Use this first when

- The agent must inspect SQL data, execute SQL statements, destroy an existing MySQL instance, initialize table structure, or manage table security rules through MCP tools.

### Read before writing code if

- The task includes `queryMysqlDatabase`, `manageMysqlDatabase`, `queryPermissions`, or `managePermissions`.

### Then also read

- Web application integration -> `../relational-database-web-cloudbase/SKILL.md`
- Raw HTTP database access -> `../http-api-cloudbase/SKILL.md`

### Do NOT use for

- Frontend or backend application code that should use SDKs instead of MCP operations.

### Common mistakes / gotchas

- Initializing SDKs in an MCP management flow.
- Running write SQL or DDL before confirming the environment already has a ready MySQL instance.
- Trying to create a MySQL instance through MCP. Provisioning has been retired from the tool surface: new environments use PostgreSQL, and instances are only created in the console.
- Treating document database tasks as MySQL management tasks.
- Skipping `_openid` and permissions review after creating new SQL tables.
- Destroying MySQL without explicit confirmation or without checking whether the environment still needs the instance.
- Using `getConnectionInfo` (or inferred host/password) to build a default TCP client for new apps. Prefer SDK / `runQuery` / `runStatement`; TCP credentials are an explicit migration exception only.

## When to use this skill

Use this skill when an **agent** needs to operate on **CloudBase Relational Database via MCP tools**, for example:

- Inspecting or querying SQL data
- Destroying an existing MySQL instance
- Polling an in-flight MySQL task (create tasks are started in the console — MCP no longer creates instances)
- Modifying data or schema (INSERT/UPDATE/DELETE/DDL)
- Initializing tables and indexes after MySQL is ready
- Reading or changing table permissions

Do **NOT** use this skill for:

- Building Web or Node.js applications that talk to CloudBase Relational Database directly through SDKs
- Auth flows or user identity management

## How to use this skill (for a coding agent)

1. **Recognize MCP context**
   - If you can call tools like `queryMysqlDatabase`, `manageMysqlDatabase`, `queryPermissions`, `managePermissions`, you are in MCP context.
   - In this context, **never initialize SDKs for CloudBase Relational Database**; use MCP tools instead.

2. **Pick the right tool for the job**
   - Read-only SQL and create/destroy task status checks -> `queryMysqlDatabase`
   - MySQL destruction, write SQL, DDL, schema initialization -> `manageMysqlDatabase`
   - Inspect permissions -> `queryPermissions(action="getResourcePermission")`
   - Change permissions -> `managePermissions(action="updateResourcePermission")`

3. **Always be explicit about safety**
   - Before destructive operations (DELETE, DROP, etc.), summarize what you are about to run and why.
   - Prefer `queryMysqlDatabase(action="getInstanceInfo")` or a read-only SQL check before writes.
   - Destroying MySQL requires explicit confirmation because it has environment-level impact; provisioning is not offered here at all.

---

## Available MCP tools (CloudBase Relational Database)

These tools are the supported way to interact with CloudBase Relational Database via MCP:

### 1. `queryMysqlDatabase`

- **Purpose:** Query SQL data and instance / task state.
- **Use for:**
  - Running `SELECT` and other read-only SQL queries with `action="runQuery"`
  - Checking whether MySQL already exists with `action="getInstanceInfo"` (lifecycle only — no connection credentials)
  - Inspecting an in-flight create or destroy task with `action="describeCreateResult"` or `action="describeTaskStatus"` (create tasks originate in the console)
  - **Exception only:** `action="getConnectionInfo"` returns the raw connection/cluster payload (may include credentials) for migrating existing TCP/ORM clients. Do **not** use this for new business CRUD — prefer Web/Node SDK or `runQuery` / `runStatement`.

**Example flow:**

```json
{
  "action": "runQuery",
  "sql": "SELECT id, email FROM users ORDER BY created_at DESC LIMIT 50"
}
```

**Do NOT** call `getConnectionInfo` and then wire `pymysql` / `mysql2` / `DATABASE_URL` into a cloud function for greenfield apps. Platform-delegated SQL and SDK access are the default.

### 2. `manageMysqlDatabase`

- **Purpose:** Manage an existing SQL instance and execute mutating SQL.
- **Use for:**
  - Destroying MySQL with `action="destroyMySQL"`
  - Executing `INSERT`, `UPDATE`, `DELETE`, `CREATE TABLE`, `ALTER TABLE`, `DROP TABLE` with `action="runStatement"`
  - Initializing tables and indexes with `action="initializeSchema"`

**Provisioning is not available here.** `provisionMySQL` has been removed from the action set: a call carrying it fails schema validation, and a missing instance returns `MYSQL_NOT_CREATED` with a console entry rather than a create hint.

**Important:** When creating a new table, you **must** include the `_openid` column for per-user access control:

```sql
_openid VARCHAR(64) DEFAULT '' NOT NULL
```

Note: when a user is logged in, `_openid` is automatically populated by the server from the authenticated session. Do not manually fill it in normal inserts.

Before calling this tool, **confirm**:

- The current environment already has a ready MySQL instance.
- The target tables and conditions are correct.
- You have run a corresponding read-only query when appropriate.

When destroying MySQL, confirm:

- The current environment really should lose the SQL instance.
- You have explicit confirmation for the destructive action.
- You are prepared to query `describeTaskStatus` afterward to inspect the destroy result.

### 3. `queryPermissions`

- **Purpose:** Read permission configuration for a given SQL table.
- **Use for:**
  - Understanding who can read/write a table
  - Auditing permissions on sensitive tables
  - Call shape: `queryPermissions(action="getResourcePermission", resourceType="sqlDatabase", resourceId="<tableName>")`

### 4. `managePermissions`

- **Purpose:** Set or update permissions for a given SQL table.
- **Use for:**
  - Hardening access to sensitive data
  - Opening up read access while restricting writes
  - Updating resource-level permission configuration
  - Call shape: `managePermissions(action="updateResourcePermission", resourceType="sqlDatabase", resourceId="<tableName>", permission="READONLY")`

## Compatibility

- Canonical plugin name: `permissions`
- Legacy plugin aliases `security-rule`, `security-rules`, `secret-rule`, `secret-rules`, and `access-control` are still routed to `permissions`
- Legacy tools `readSecurityRule` and `writeSecurityRule` are removed; always use `queryPermissions` and `managePermissions`

---

## Recommended lifecycle flow

### Scenario 1: The environment has no MySQL instance

1. Call `queryMysqlDatabase(action="getInstanceInfo")`.
2. If no instance exists, **stop**. MySQL provisioning is no longer available through MCP: the result is `MYSQL_NOT_CREATED` with a console entry and no create hint.
3. New environments should use CloudBase PostgreSQL — see `../postgresql-development-cloudbase/SKILL.md`.
4. An instance created outside the tool can still be observed: poll `queryMysqlDatabase(action="describeCreateResult")` or `queryMysqlDatabase(action="describeTaskStatus")`, and only continue once the lifecycle status is `READY`.
5. Reserve `describeTaskStatus` for destroy flows whose task response carries `TaskName`.

### Scenario 2: Safely inspect data in a table

1. Use `queryMysqlDatabase(action="runQuery")` with a limited `SELECT`.
2. Include `LIMIT` and relevant filters.
3. Review the result set and confirm it matches expectations before any write operation.

### Scenario 3: Apply schema initialization on a ready instance

1. Confirm MySQL is ready.
2. Prepare ordered DDL statements.
3. Run them through `manageMysqlDatabase(action="initializeSchema")`.
4. After creating tables, verify permissions with `queryPermissions` or `managePermissions`.

### Scenario 4: Execute a targeted write or DDL change

1. Use `queryMysqlDatabase(action="runQuery")` to inspect current data or schema if needed.
2. Run the mutation once with `manageMysqlDatabase(action="runStatement")`.
3. Validate with another read-only query or by checking security rules.

### Scenario 5: Destroy MySQL when the environment no longer needs it

1. Use `queryMysqlDatabase(action="getInstanceInfo")` to confirm the current environment still has a SQL instance.
2. Call `manageMysqlDatabase(action="destroyMySQL", confirm=true)`.
3. Query `queryMysqlDatabase(action="describeTaskStatus")` until the destroy task completes or fails.
4. If the task succeeds, optionally call `queryMysqlDatabase(action="getInstanceInfo")` to confirm the instance no longer exists.
5. If the task fails, treat the returned error as the terminal result and let the caller decide whether to retry.

---

## Key principle: MCP tools vs SDKs

- **MCP tools** are for **agent operations** and **database management**:
  - Inspect and manage an existing MySQL instance — never create one.
  - Destroy MySQL.
  - Poll lifecycle state.
  - Run ad-hoc SQL.
  - Inspect and change resource permissions.
  - 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.

© TencentCloudBase · MIT · TencentCloudBase/skills

Похожие скиллы

Все скиллы по теме «Данные и базы» →
database-cloud-optimization-database-optimizer Seth Hobson Субагент для разбора медленных запросов, индексов и схемы. Пригодится, когда база тормозит или её пора масштабировать. CX Codex ★ 41 729звёзд репо database-design MoizIbnYousaf Скилл по проектированию схем, миграциям и оптимизации запросов для PostgreSQL, MySQL и NoSQL. Пригодится, когда агент пишет SQL. CX Codex +1 604установок database-optimization davila7 Субагент для разбора медленных запросов: смотрит планы выполнения, предлагает индексы и настройки пула соединений. 3 924установок database-optimizer https://github.com/Jeffallan Скилл помогает находить узкие места в PostgreSQL и MySQL, разбирать планы выполнения через EXPLAIN ANALYZE и настраивать индексы без простоя таблиц. CX Codex +1 6 000установок sql-database-assistant Alireza Rezvani Пишет SQL-запросы, помогает разбирать схемы, оптимизировать запросы и готовить миграции. Подойдёт для повседневной работы с базой и ORM. 727установок database-performance-debugging aj-geddes Скилл помогает найти медленные SQL-запросы и разобрать их планы выполнения. Пригодится, когда приложение тормозит или база упирается в CPU. CX Codex +1 493установок

Из того же набора16

ai-model-wechat Скилл для вызова ИИ-моделей внутри мини-программ WeChat через wx.cloud.extend.AI. Пригодится, если пишете генерацию текста в мини-аппе и не хотите угадывать сигнатуры. CX Codex +1 1 100установок auth-tool-cloudbase Готовит авторизацию CloudBase к работе: проверяет провайдеров, ключи и способы входа до того, как вы начнёте писать код. CX Codex +1 1 000установок ai-model-nodejs Скилл для вызова ИИ-моделей из Node.js-бэкенда через @cloudbase/node-sdk: генерация текста и картинок, облачные функции, CloudRun. CX Codex +1 998установок cloudrun-development Правила разработки бэкенда на CloudBase Run: развёртывание сервисов с долгими соединениями, доступом к VPC-базам и разбор сбоев контейнеров. CX Codex +1 983установок http-api-cloudbase Скилл учит агента работать с HTTP API платформы Tencent CloudBase напрямую без SDK. Пригодится бэкендам на Python или Go, мобильным клиентам и curl-скриптам. CX Codex +1 977установок auth-nodejs-cloudbase Скилл помогает настроить серверную авторизацию в CloudBase через Node.js: проверить профиль вызывающего пользователя, выдать тикет для входа или получить IP-адрес клиента. CX Codex +1 960установок auth-web-cloudbase Настраивает вход, регистрацию и сессии в веб-приложениях на базе @cloudbase/js-sdk. Предотвращает частые ошибки авторизации и защищает роуты. CX Codex +1 951установок relational-database-web-cloudbase Показывает, как инициализировать @cloudbase/js-sdk в браузере и получить общий клиент реляционной базы CloudBase для запросов в стиле Supabase. CX Codex +1 899установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой