@rubyls/yearning-mcp
This MCP server provides full integration with the Yearning SQL audit platform, offering read-only data exploration, SQL validation, order lifecycle management, query execution, and administrative write operations.
🔍 Data Exploration (Read-Only)
View current user profile, permissions, and accessible data sources.
List and filter data sources, databases, tables, and inspect table structures (fields, indexes).
✅ SQL Validation
Pre-audit SQL check to verify DDL/DML syntax before submission.
📋 Order Management (Read-Only)
Browse personal and pending audit orders with status filtering and pagination.
View order details, audit timelines (with flag values for audits), rollback SQL, and comments.
🔎 Query Execution
Execute read-only SELECT queries via WebSocket against permitted data sources.
Check query audit requirements and active query order status.
✍️ Write Operations (when YEARNING_READ_ONLY=false)
Submit DDL/DML orders with optional backup/rollback; requires explicit
confirm=true.Undo (withdraw) submitted orders, or approve/reject as auditor; final approval triggers SQL execution.
Submit query applications and post comments on orders.
⚙️ Configuration
Supports read-only mode, multiple transports (stdio, SSE, streamable HTTP), and Docker deployment.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@@rubyls/yearning-mcp list pending audit orders"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@rubyls/yearning-mcp
Yearning SQL 审核平台的 MCP Server(TypeScript)。不只读查询,还覆盖完整工单能力:提交 DDL/DML、审核(同意/驳回)、撤回、查询申请、评论,以及数据源/表结构探查。
基于 Yearning REST / WebSocket API(/api/v2,JWT Bearer)。列表类与查询执行走 WebSocket,其余为 REST。
仓库:https://github.com/rubyLs/yearning_mcp
快速接入(推荐)
在 Cursor / Claude Desktop 的 MCP 配置中:
{
"mcpServers": {
"yearning": {
"command": "npx",
"args": ["-y", "@rubyls/yearning-mcp"],
"env": {
"YEARNING_URL": "http://your-yearning:8000",
"YEARNING_USERNAME": "your-user",
"YEARNING_PASSWORD": "your-password",
"YEARNING_LOGIN_TYPE": "general",
"YEARNING_READ_ONLY": "false"
}
}
}
}也可全局安装后使用:
npm i -g @rubyls/yearning-mcp
yearning-mcpRelated MCP server: sql-explorer-mcp
Docker(单容器 HTTP)
镜像已发布到 Docker Hub:rubyls/yearning-mcp
# 直接拉取运行(推荐)
docker run -d --name yearning-mcp -p 8080:8080 \
-e MCP_AUTH_TOKEN=your-strong-token \
-e YEARNING_URL=http://your-yearning:8000 \
-e YEARNING_USERNAME=your-user \
-e YEARNING_PASSWORD=your-password \
-e YEARNING_READ_ONLY=false \
rubyls/yearning-mcp:latest
# 指定版本
# rubyls/yearning-mcp:1.1.3本地构建(可选):
docker build -t yearning-mcp:latest .
# 或 npm run docker:build健康检查:
GET http://localhost:8080/healthMCP 端点:
http://localhost:8080/mcpHeader:
Authorization: Bearer <MCP_AUTH_TOKEN>
Cursor 连接示例:
{
"mcpServers": {
"yearning": {
"url": "http://localhost:8080/mcp",
"headers": {
"Authorization": "Bearer your-strong-token"
}
}
}
}容器内访问宿主机 Yearning 时,macOS/Windows 可用
host.docker.internal代替localhost。
维护者推送镜像:
npm run docker:build
npm run docker:push
# 需已 docker login,镜像会打上 rubyls/yearning-mcp:1.1.3 与 :latest功能一览
只读工具(14)
工具 | 说明 |
| 当前用户与可查询数据源 |
| 数据源列表 |
| 库列表 |
| 表列表 |
| 表结构(字段 + 索引) |
| 提交前 SQL 审核检测 |
| 我的工单列表 |
| 工单详情 |
| 审核时间线 / 步骤(含 |
| 回滚 SQL |
| 待我审核的工单 |
| 查询审核开关与我的查询工单状态 |
| 只读 SELECT(msgpack WebSocket) |
| 读取工单评论 |
写工具(5,YEARNING_READ_ONLY=false 时注册)
工具 | 说明 |
| 提交 SQL 工单(需 |
| 撤回未执行工单(需 |
| 审核:agree / reject / undo(需 |
| 提交查询申请 |
| 发表工单评论 |
工单状态:0 已驳回 / 1 执行中 / 2 待审核 / 3 已完成 / 4 已终止 / 5 待执行 / 6 已撤回。
推荐流程:
yearning_sql_check → yearning_submit_order → yearning_order_timeline → yearning_audit_order环境变量
变量 | 说明 | 默认 |
| Yearning 地址 |
|
| 登录用户名 | (必填) |
| 登录密码 | (必填) |
|
|
|
| 请求超时(秒) |
|
|
|
|
| 跳过 TLS 校验 |
|
|
|
|
| HTTP 监听 |
|
| HTTP Bearer 鉴权 | (不设则不鉴权) |
| 无状态 HTTP |
|
HTTP 远程模式
MCP_TRANSPORT=streamable-http \
MCP_HOST=0.0.0.0 MCP_PORT=8080 \
MCP_AUTH_TOKEN=your-strong-token \
YEARNING_URL=http://your-yearning:8000 \
YEARNING_USERNAME=your-user \
YEARNING_PASSWORD=your-password \
YEARNING_READ_ONLY=false \
npx -y @rubyls/yearning-mcp客户端连接:http://localhost:8080/mcp,Header:Authorization: Bearer your-strong-token。
健康检查:GET /health(免鉴权)。
从源码运行
git clone https://github.com/rubyLs/yearning_mcp.git
cd yearning_mcp
npm install
npm run build
npm startCursor 本地调试:
{
"mcpServers": {
"yearning": {
"command": "node",
"args": ["/absolute/path/to/yearning_mcp/dist/index.js"],
"env": {
"YEARNING_URL": "http://localhost:8000",
"YEARNING_USERNAME": "your-user",
"YEARNING_PASSWORD": "your-password",
"YEARNING_READ_ONLY": "false"
}
}
}
}对话示例
连上 Yearning,列出我有权限的数据源把这条建表 SQL 在 dev 数据源做检测,没问题就提工单:
CREATE TABLE t_demo (id INT PRIMARY KEY, name VARCHAR(64));列出待我审核的工单;工单 XXX 没问题,帮我同意(先看 timeline 拿 flag)在 order_db 的 user 库查最近 7 天注册账号,前 100 条开发
npm run dev # tsx 直接跑 src
npm run build # 编译到 dist/
npm start # node dist/index.js
npm publish --access public # 发布到 npm(需先 npm login)已知限制
部分
/fetch/*接口使用 GET + JSON Body;若前置代理丢弃 GET body,列表会静默为空。WebSocket 鉴权依赖
Sec-WebSocket-Protocol透传裸 JWT,且需正确Origin。查询审核开启时,
yearning_run_query需先有已批准的查询工单。管理端能力(用户/数据源/规则管理)未包含,请在 Yearning 控制台操作。
License
MIT
Available Tools
19 toolsyearning_audit_order审核工单ADestructive
审核工单:agree 同意(末级步骤会触发 SQL 执行)/ reject 驳回 / undo 撤回。flag 为当前审核步骤序号(用 yearning_order_timeline 确认);reject 必须提供 reason。agree 为高危操作,必须 confirm=true。对应 POST /api/v2/audit/order/state
Inputs: flag (required), action (required), confirm (required), work_id (required), +3 more.
yearning_audit_orders待审工单列表ARead-onlyIdempotent
分页列出与当前用户相关的待审核工单(审核人视角)。对应 WS /api/v2/audit/order/list
Inputs: page, text, status, work_id, +2 more.
yearning_list_databases列出库BRead-onlyIdempotent
列出指定数据源下的数据库列表。对应 GET /api/v2/fetch/base
Inputs: source_id (required), hide, response_format.
yearning_list_sources列出数据源BRead-onlyIdempotent
列出当前账号有权限的数据源(可按 query/dml/ddl/idc 过滤)。对应 GET /api/v2/fetch/source
Inputs: tp, response_format.
yearning_list_tables列出表ARead-onlyIdempotent
列出指定数据源、指定库下的表。对应 GET /api/v2/fetch/table
Inputs: database (required), source_id (required), response_format.
yearning_my_orders我的工单列表ARead-onlyIdempotent
分页列出当前用户提交的工单。状态:8=全部 / 2=待审核 / 3=已完成 / 0=已驳回 / 4=已终止 / 6=已撤回 / 1=执行中 / 5=待执行。对应 WS /api/v2/common/list
Inputs: page, text, status, work_id, +2 more.
yearning_order_comments工单评论ARead-onlyIdempotent
读取指定工单的全部评论。对应 WS /api/v2/fetch/comment
Inputs: work_id (required), response_format.
yearning_order_detail工单详情BRead-onlyIdempotent
查看工单详情:SQL 明细与完整 SQL。对应 GET /api/v2/fetch/detail + /fetch/sql
Inputs: work_id (required), page, page_size, response_format.
yearning_order_timeline工单审核时间线ARead-onlyIdempotent
查看工单审核时间线与流程步骤。审核时 flag 取自此处。对应 GET /api/v2/fetch/timeline + /fetch/steps
Inputs: work_id (required), source_id, response_format.
yearning_post_comment发表工单评论C
在指定工单下发表评论。对应 POST /api/v2/fetch/comment
Inputs: comment (required), work_id (required).
yearning_query_status查询审核状态BRead-onlyIdempotent
查看查询审核开关,以及当前用户查询工单是否有效。对应 GET /api/v2/fetch/is_query + /fetch/query_status
Inputs: response_format.
yearning_rollback_sql回滚 SQLARead-onlyIdempotent
获取工单的回滚 SQL。对应 GET /api/v2/fetch/roll
Inputs: work_id (required), response_format.
yearning_run_query执行查询ARead-onlyIdempotent
在指定数据源执行只读 SELECT 查询。需具备查询权限;若开启查询审核,需先 yearning_submit_query_order。对应 WS /api/v2/query/results(msgpack)
Inputs: sql (required), schema (required), source_id (required), limit, +1 more.
yearning_sql_checkSQL 审核检测ARead-onlyIdempotent
提交前对 SQL 做审核检测。建议先调用本工具,再 yearning_submit_order。对应 PUT /api/v2/fetch/test。不接受 SELECT(请用 yearning_run_query)。
Inputs: sql (required), database (required), source_id (required), order_type (required), +1 more.
yearning_submit_order提交 SQL 工单A
提交 SQL 工单(DDL/DML)。提交前建议先 yearning_sql_check。对应 POST /api/v2/common/post。必须传 confirm=true 才会真正提交。
Inputs: sql (required), remark (required), confirm (required), database (required), +7 more.
yearning_submit_query_order提交查询申请A
提交数据查询申请。开通查询审核时需审批通过后方可 yearning_run_query。对应 POST /api/v2/query/post
Inputs: remark (required), source_id (required), export.
yearning_table_fields查看表结构ARead-onlyIdempotent
查看表结构:字段列表(类型/可空/键/默认值/注释)与索引。对应 GET /api/v2/fetch/fields
Inputs: table (required), database (required), source_id (required), response_format.
yearning_undo_order撤回工单AIdempotent
撤回自己提交、尚未执行的工单。对应 GET /api/v2/fetch/undo。必须传 confirm=true。
Inputs: confirm (required), work_id (required).
yearning_user_info查看当前用户信息ARead-onlyIdempotent
查看当前登录用户信息、部门、邮箱,以及有权查询的数据源列表。对应 GET /api/v2/fetch/userinfo
Inputs: response_format.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Each tool targets a distinct resource and action: user info, table metadata, SQL validation, order lifecycle steps, query execution, comments, and audit actions. Overlapping concepts like my_orders vs audit_orders and order_detail vs order_timeline are clearly separated by descriptions.
All tools share a 'yearning_' prefix and use snake_case, but the action-noun pattern is inconsistent. Some use verb-first forms (list_sources, run_query, submit_order), while others are noun-first (user_info, order_detail, sql_check). List-like tools are not uniformly prefixed (my_orders, order_comments vs list_tables).
With 19 tools, the set is slightly above the typical well-scoped range but is justified by the breadth of the Yearning platform. The count does not feel bloated, and each tool covers a necessary aspect of SQL order management and querying.
The toolkit thoroughly covers the domain: schema inspection, SQL pre-check, order submission/query/detail/timeline/comments, rollback, audit workflow, and read-only query execution. No major lifecycle gap is apparent, and the tools form a coherent end-to-end workflow.
Maintenance
Related MCP Connectors
One MCP server for all your MCP servers: code mode, per-tool permissions, approvals and audit.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
MCP server for querying and analyzing data from ad platforms, analytics tools, and spreadsheets
Read-only MCP server for ClassQuill, a tutoring-business-management platform.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA production-ready MCP server for MySQL database operations, providing secure HTTP endpoints for read-only queries, performance analysis, and server monitoring.22MIT
- AlicenseNot gradedqualityFmaintenanceRead-only MCP server for SQL databases (SQL Server, Postgres, SQLite) with multi-server support and three-layer safety using AST validation and linting.MIT
- FlicenseNot gradedqualityDmaintenanceA generic MCP server for MySQL operations, enabling listing databases/tables, describing schemas, running read-only SQL, and optionally executing write SQL with logging.1-
- AlicenseAqualityBmaintenanceMCP server for Yearning SQL audit platform that enables AI assistants to query and manage orders, browse data sources and table structures, submit and review SQL orders, and execute read-only queries.14MIT