GoSQLX
SQL validation, formatting, parsing, metadata extraction, linting, and security analysis.
我该使用它吗
质量与安全性
基于对工具定义和协议合规性的自动分析。
上下文开销
这是每次将服务器的工具加载到模型上下文窗口时所消耗的大致 token 数。数值越高,可用于其他任务的注意力就越少。
安装
一键安装
将以下内容添加到你的 `claude_desktop_config.json` 文件中:
{
"mcpServers": {
"gosqlx": {
"url": "https://mcp.gosqlx.dev/mcp"
}
}
}远程端点
https://mcp.gosqlx.dev/mcpstreamable-http它能做什么
工具清单
工具(7)
🟢analyze_sql(sql)
Use this when the user wants a complete review of a SQL query. Runs validate, parse, metadata, security, lint, and format concurrently and returns one composite report; hosts that support MCP Apps render it as an interactive report.
输入模式
{
"type": "object",
"properties": {
"sql": {
"description": "The SQL string to analyze",
"type": "string"
}
},
"required": [
"sql"
]
}🟢extract_metadata(sql)
Use this when the user wants the tables, columns, and functions a SQL query references (e.g. for lineage or impact analysis). Returns {tables, columns, functions}.
输入模式
{
"type": "object",
"properties": {
"sql": {
"description": "The SQL string to analyze",
"type": "string"
}
},
"required": [
"sql"
]
}🟢format_sql(add_semicolon, indent_size, sql, uppercase_keywords)
Use this when the user wants SQL pretty-printed or reformatted: one clause per line, optional upper-case keywords and trailing semicolon. Comments are not kept. Returns {formatted_sql, options}.
输入模式
{
"type": "object",
"properties": {
"add_semicolon": {
"description": "Append a trailing semicolon (default: false)",
"type": "boolean"
},
"indent_size": {
"description": "Spaces per indent level for nested blocks such as CREATE TABLE columns; clauses always start at column 0. 0 puts each statement on one line (default: 2)",
"type": "number"
},
"sql": {
"description": "The SQL string to format",
"type": "string"
},
"uppercase_keywords": {
"description": "true upper-cases all SQL keywords (AND, IN, CASE, ...), but not data type names. false keeps the formatter's casing: clause keywords (SELECT, FROM, WHERE, ...) upper-case, other keywords (e.g. and, or) may keep their input case (default: false)",
"type": "boolean"
}
},
"required": [
"sql"
]
}🟢lint_sql(sql)
Use this when the user wants SQL style feedback. Applies the same 10 rules as `gosqlx lint`: L001 trailing whitespace, L002 mixed indentation, L003 consecutive blank lines, L004 indentation depth, L005 line length (>100), L006 column alignment, L007 keyword case (upper), L008 comma placement (trailing), L009 aliasing consistency, L010 redundant whitespace. Returns {violation_count, violations}.
输入模式
{
"type": "object",
"properties": {
"sql": {
"description": "The SQL string to lint",
"type": "string"
}
},
"required": [
"sql"
]
}🟢parse_sql(sql)
Use this when the user wants to know how SQL parses: returns an AST summary with the statement count and the type of each statement.
输入模式
{
"type": "object",
"properties": {
"sql": {
"description": "The SQL string to parse",
"type": "string"
}
},
"required": [
"sql"
]
}🟢security_scan(sql)
Use this when the user wants SQL checked for injection patterns: tautologies, UNION attacks, stacked queries, comment bypasses, and more. Returns findings with severity counts.
输入模式
{
"type": "object",
"properties": {
"sql": {
"description": "The SQL string to scan",
"type": "string"
}
},
"required": [
"sql"
]
}🟢validate_sql(dialect, sql)
Use this when the user wants to know whether a SQL statement is syntactically valid, optionally for a specific dialect. Returns {valid: bool, error?: string, dialect?: string}.
输入模式
{
"type": "object",
"properties": {
"dialect": {
"description": "SQL dialect: generic, postgresql, mysql, mariadb, sqlserver, oracle, sqlite, snowflake, bigquery, redshift, clickhouse",
"enum": [
"generic",
"postgresql",
"mysql",
"mariadb",
"sqlserver",
"oracle",
"sqlite",
"snowflake",
"bigquery",
"redshift",
"clickhouse"
],
"type": "string"
},
"sql": {
"description": "The SQL string to validate",
"type": "string"
}
},
"required": [
"sql"
]
}社区
证据