mcp-yearning
v0.5.0MCP Server for Yearning SQL audit/review platform (REST API)
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
yearning_user_info
查看当前登录用户的信息、部门、邮箱,以及有权查询的数据源列表。 对应 API:GET /api/v2/fetch/userinfo
| Parameter | Type | Description |
|---|---|---|
response_format |
yearning_list_sources
列出当前账号有权限的数据源(可按 query/dml/ddl 维度过滤)。 对应 API:GET /api/v2/fetch/source
| Parameter | Type | Description |
|---|---|---|
response_format | ||
tp | 数据源范围:all/query/dml/ddl/idc |
yearning_list_databases
列出指定数据源下的数据库(库)列表。 对应 API:GET /api/v2/fetch/base
| Parameter | Type | Description |
|---|---|---|
source_id * | string | 数据源 ID(来自 yearning_list_sources) |
hide | boolean | 是否隐藏排除库列表 |
response_format |
yearning_list_tables
列出指定数据源、指定库下的数据表列表。 对应 API:GET /api/v2/fetch/table
| Parameter | Type | Description |
|---|---|---|
database * | string | 库名 |
source_id * | string | 数据源 ID |
response_format |
yearning_table_fields
查看表结构:字段列表(类型/可空/键/默认值/注释)与索引信息。 对应 API:GET /api/v2/fetch/fields
| Parameter | Type | Description |
|---|---|---|
database * | string | 库名 |
source_id * | string | 数据源 ID |
table * | string | 表名 |
response_format |
yearning_sql_check
提交前对 SQL 做审核检测,返回逐条检查结果(级别/影响行数/错误/执行耗时)。 建议先调用本工具确认无误,再调用 yearning_submit_order 提交工单。 对应 API:PUT /api/v2/fetch/test
| Parameter | Type | Description |
|---|---|---|
database * | string | 库名 |
order_type * | SQL 类型:ddl / dml | |
source_id * | string | 数据源 ID |
sql * | string | 待检测的 SQL |
response_format |
yearning_my_orders
分页列出当前用户提交的工单(支持状态/关键字/工单号过滤)。 对应 API:WS /api/v2/common/list
| Parameter | Type | Description |
|---|---|---|
page | integer | 页码(从 1 开始) |
page_size | integer | 分页大小 |
response_format | ||
status | integer | 状态过滤:8=全部(默认)/ 2=待审核 / 3=已完成 / 0=已驳回 / 4=已终止 / 6=已撤回 / 1=已同意待执行 / 5=执行中 |
text | 按说明/工单号模糊搜索 | |
work_id | 按工单号过滤 |
yearning_order_detail
查看工单详情:SQL 明细(分页)、完整 SQL 语句、执行结果记录。 对应 API:GET /api/v2/fetch/detail + GET /api/v2/fetch/sql
| Parameter | Type | Description |
|---|---|---|
work_id * | string | 工单号 |
page | integer | |
page_size | integer | |
response_format |
yearning_order_timeline
查看工单审核时间线与流程步骤(含各审核人动作与当前所处步骤)。 对应 API:GET /api/v2/fetch/timeline + GET /api/v2/fetch/steps
| Parameter | Type | Description |
|---|---|---|
work_id * | string | 工单号 |
response_format | ||
source_id | 数据源 ID(影响流程步骤解析) |
yearning_rollback_sql
获取工单的回滚 SQL(执行前由系统生成,用于误操作回退)。 对应 API:GET /api/v2/fetch/roll
| Parameter | Type | Description |
|---|---|---|
work_id * | string | 工单号 |
response_format |
yearning_audit_orders
分页列出与当前用户相关的待审核/审核工单(审核人视角)。 对应 API:WS /api/v2/audit/order/list
| Parameter | Type | Description |
|---|---|---|
page | integer | |
page_size | integer | |
response_format | ||
status | 状态过滤:2 待审核/3 已完成/0 已驳回 | |
text | 按说明/工单号模糊搜索 | |
work_id | 按工单号过滤 |
yearning_query_status
查看查询审核开关是否开启,以及当前用户的查询工单状态。 对应 API:GET /api/v2/fetch/is_query + GET /api/v2/fetch/query_status
| Parameter | Type | Description |
|---|---|---|
response_format |
yearning_run_query
在指定数据源执行只读 SELECT 查询并返回结果表格。 注意:本工具仅执行 SELECT,对目标库数据无修改;但 Yearning 会留存查询审计记录, 且查询本身可能产生资源开销(如全表扫描、锁竞争),属「提交操作」而非纯被动读取。 需具备查询权限且已通过查询审核。 对应 API:WS /api/v2/query/results(msgpack 编解码)
| Parameter | Type | Description |
|---|---|---|
schema * | string | 库名 |
source_id * | string | 数据源 ID |
sql * | string | 查询 SQL(仅 SELECT,不修改目标库数据) |
limit | integer | 返回行数上限(客户端截断) |
response_format |
yearning_order_comments
读取指定工单的全部评论。 对应 API:WS /api/v2/fetch/comment
| Parameter | Type | Description |
|---|---|---|
work_id * | string | 工单号 |
response_format |