mcp-yearning

v0.5.0
mcp-yearning Checked 1 hour ago Published 26 days ago

MCP 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

ParameterTypeDescription
response_format

yearning_list_sources

列出当前账号有权限的数据源(可按 query/dml/ddl 维度过滤)。 对应 API:GET /api/v2/fetch/source

ParameterTypeDescription
response_format
tp数据源范围:all/query/dml/ddl/idc

yearning_list_databases

列出指定数据源下的数据库(库)列表。 对应 API:GET /api/v2/fetch/base

ParameterTypeDescription
source_id *string数据源 ID(来自 yearning_list_sources)
hideboolean是否隐藏排除库列表
response_format

yearning_list_tables

列出指定数据源、指定库下的数据表列表。 对应 API:GET /api/v2/fetch/table

ParameterTypeDescription
database *string库名
source_id *string数据源 ID
response_format

yearning_table_fields

查看表结构:字段列表(类型/可空/键/默认值/注释)与索引信息。 对应 API:GET /api/v2/fetch/fields

ParameterTypeDescription
database *string库名
source_id *string数据源 ID
table *string表名
response_format

yearning_sql_check

提交前对 SQL 做审核检测,返回逐条检查结果(级别/影响行数/错误/执行耗时)。 建议先调用本工具确认无误,再调用 yearning_submit_order 提交工单。 对应 API:PUT /api/v2/fetch/test

ParameterTypeDescription
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

ParameterTypeDescription
pageinteger页码(从 1 开始)
page_sizeinteger分页大小
response_format
statusinteger状态过滤: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

ParameterTypeDescription
work_id *string工单号
pageinteger
page_sizeinteger
response_format

yearning_order_timeline

查看工单审核时间线与流程步骤(含各审核人动作与当前所处步骤)。 对应 API:GET /api/v2/fetch/timeline + GET /api/v2/fetch/steps

ParameterTypeDescription
work_id *string工单号
response_format
source_id数据源 ID(影响流程步骤解析)

yearning_rollback_sql

获取工单的回滚 SQL(执行前由系统生成,用于误操作回退)。 对应 API:GET /api/v2/fetch/roll

ParameterTypeDescription
work_id *string工单号
response_format

yearning_audit_orders

分页列出与当前用户相关的待审核/审核工单(审核人视角)。 对应 API:WS /api/v2/audit/order/list

ParameterTypeDescription
pageinteger
page_sizeinteger
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

ParameterTypeDescription
response_format

yearning_run_query

在指定数据源执行只读 SELECT 查询并返回结果表格。 注意:本工具仅执行 SELECT,对目标库数据无修改;但 Yearning 会留存查询审计记录, 且查询本身可能产生资源开销(如全表扫描、锁竞争),属「提交操作」而非纯被动读取。 需具备查询权限且已通过查询审核。 对应 API:WS /api/v2/query/results(msgpack 编解码)

ParameterTypeDescription
schema *string库名
source_id *string数据源 ID
sql *string查询 SQL(仅 SELECT,不修改目标库数据)
limitinteger返回行数上限(客户端截断)
response_format

yearning_order_comments

读取指定工单的全部评论。 对应 API:WS /api/v2/fetch/comment

ParameterTypeDescription
work_id *string工单号
response_format