MCP server for database analysis - supports MySQL connection management, query execution, schema analysis, statistics, slow query analysis, and ER diagram generation
This server demonstrates reasonable structure with 9 well-defined tools, consistent naming conventions, and documented schemas. However, multiple tools lack sufficient parameter descriptions, and several descriptions are generic or minimal. The server follows basic patterns but falls short of production-grade quality. Naming is consistently verb-prefixed (db_*, execute_*, list_*, describe_*, generate_*), which is positive. Input schemas are visible and properly typed in the source. However, many parameter descriptions are single-word or very brief, and output schemas are not documented in the visible code. Error handling is present (try/catch in mcp-server.ts) but generic. The Chinese descriptions are clear but some are quite brief.
连接到配置中的数据库(查询数据库前需先连接)。如不指定名称,将连接 default 数据库
断开指定数据库连接
清空表结构缓存并重新从数据库加载,表结构变更后需调用此工具刷新
查看所有数据库连接状态(已配置/已连接/当前活动),便于确认当前可查询的数据库
切换当前活动的数据库连接
获取指定表的完整结构信息(列、索引、外键)。用户说「表结构」「表有哪些字段」时可调用
查询数据库:在当前活动数据库上执行 SQL,返回结果。支持 SELECT/SHOW/DESCRIBE 等只读查询,也支持 INSERT/UPDATE/DELETE 等写入操作。用户说「查一下数据库」「执行 SQL」「查表数据」等时应调用此工具
Parameter descriptions are minimal or single-word. E.g., db_connect's 'name' parameter has only '数据库配置名称' (database config name), and execute_query's 'params' is just 'SQL 参数化查询的参数' (SQL parameterized query parameters). Descriptions should explain FORMAT, CONSTRAINTS, EXAMPLES, and WHEN NEEDED per pattern:tool-description.
Output schemas are not documented in the visible source code. Tools return content with 'type: text' but LLMs cannot determine what fields, objects, or structure the text contains (e.g., does list_tables return JSON, CSV, or prose?). JSON Schema output documentation is missing.
Inferred effective spec: <=2025-11-25.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-22 | C | 63 | <=2025-11-25 | v2 |
| 2026-03-09 | F | 42 | - | v1 |
生成当前数据库的 ER 关系图(Mermaid 格式)。可指定表范围,默认分析所有表
列出当前数据库中的所有表(用户说「查表」「有哪些表」时可调用)
execute_query tool combines multiple responsibilities: read queries (SELECT), writes (INSERT/UPDATE/DELETE), and preview mode. Description states 'supports...also supports' but splits responsibility. Consider splitting into execute_select_query and execute_write_query, or at minimum add a mandatory mode parameter.
Error handling in mcp-server.ts is generic: catch-all returns 'isError: true' with only the error message. No guidance on recovery (e.g., 'call db_connect first' or 'invalid table name, call list_tables to see available tables'). Per pattern:recovery-guide, errors should tell LLMs what to do next.
execute_query's 'limit' parameter lacks range constraints. Description says '最大返回行数' (max return rows) but does not specify minimum/maximum bounds. Unbounded limits can waste tokens or timeout (per pattern:constrained-input).
No tool supports batch operations or pagination. If a user queries a large table or asks to describe many tables, sequential tool calls will be inefficient. Consider adding batch variants (describe_tables with array input, or pagination to list_tables).