GoSQLX
Pure-Go SQL parser, formatter, linter and security scanner for 8 dialects.
接入你的智能体
发布者自己的 URL。不是 PlugMCP 端点。
用我们的密钥与日志托管一份副本。
https://mcp.gosqlx.dev/mcp上方的 Claude 按钮会打开 Claude,并填好名称和 URL。你仍需在那里确认。
claude mcp add --transport http io.github.ajitpratap0-gosqlx https://mcp.gosqlx.dev/mcpRun in a terminal.
{ "mcpServers": { "io.github.ajitpratap0-gosqlx": { "command": "npx", "args": [ "-y", "mcp-remote", "https://mcp.gosqlx.dev/mcp" ] } }}claude_desktop_config.json
远程 URL 还是本机命令? 两种安装方式的区别
Playground · Docs · Benchmarks · VS Code · MCP server
† Parse stage only (pre-tokenized input to AST), SELECT id, name FROM users, Apple M4, Go 1.27, median of 20 runs of BenchmarkPerformanceBaseline. Complex queries take longer (see performance_baselines.json). Reproduce: go test -run ^$ -bench BenchmarkPerformanceBaseline -benchmem -count=20 ./pkg/sql/parser/.
GoSQLX is a production-ready SQL parsing SDK for Go. It tokenizes, parses, and generates ASTs from SQL with zero-copy optimizations and intelligent object pooling - parsing a simple SELECT in about 349 ns (~2.9M parses/sec).
go get github.com/ajitpratap0/GoSQLX
go install github.com/ajitpratap0/GoSQLX/cmd/gosqlx@latest
code --install-extension ajitpratap0.gosqlx
The extension bundles the binary, so there is no extra setup. Learn more.
claude mcp add --transport http gosqlx https://mcp.gosqlx.dev/mcp
7 SQL tools in Claude, Cursor, or any MCP client. MCP guide.
Claude Code plugin (skills, slash commands, SQL reviewer agent): /plugin marketplace add ajitpratap0/GoSQLX then /plugin install gosqlx@gosqlx - details.
ChatGPT app: add https://mcp.gosqlx.dev/mcp as a connector in developer mode for an interactive analysis widget - details.
- uses: ajitpratap0/GoSQLX@v1
with:
files: '**/*.sql'
validate: true
Source: examples/readme_quickstart/main.go, compiled in CI against HEAD and the latest release.
package main
import (
"context"
"errors"
"fmt"
"log"
"github.com/ajitpratap0/GoSQLX/pkg/gosqlx"
"github.com/ajitpratap0/GoSQLX/pkg/sql/ast"
)
func main() {
ctx := context.Background()
// ParseTree is the recommended entry point. It returns an
// opaque handle with built-in helpers.
tree, err := gosqlx.ParseTree(ctx, "SELECT id, name FROM users WHERE active = true",
gosqlx.WithDialect("postgresql"))
if err != nil {
// Sentinel errors work with errors.Is
if errors.Is(err, gosqlx.ErrSyntax) {
log.Fatalf("syntax error: %v", err)
}
log.Fatal(err)
}
fmt.Println("Tables:", tree.Tables())
fmt.Println(tree.Format(gosqlx.WithIndent(2), gosqlx.WithUppercaseKeywords(true)))
// Walk the AST - typed walkers avoid the type-assertion dance:
tree.WalkSelects(func(s *ast.SelectStatement) bool {
fmt.Printf(" SELECT with %d columns\n", len(s.Columns))
return true
})
// The legacy Parse/Format/Validate API still works for v1.x code.
// See docs/MIGRATION.md for the Tree migration guide.
}
Output:
Tables: [users]
SELECT id, name
FROM users
WHERE active = true
SELECT with 2 columns
Formatting turns one-line SQL into a readable query:
gosqlx highlight query.sql or gosqlx.HighlightANSI(sql).--dialect flag and WithDialect accept 11 names: those 8 (postgresql, mysql, mariadb, sqlserver, oracle, sqlite, snowflake, clickhouse) plus generic, bigquery and redshift. BigQuery and Redshift have no dialect-specific keyword set (they use the generic keywords) and only capability-gated grammar, such as BigQuery's QUALIFY, PIVOT/UNPIVOT, UNNEST in FROM and (struct).field access.GoSQLX is built by contributors like you. Whether it's a bug fix, new feature, documentation improvement, or just a typo - every contribution matters.
git clone https://github.com/ajitpratap0/GoSQLX.git && cd GoSQLX
task check # fmt → vet → lint → test (with race detection)
maintask check - must pass before PRQuestions or ideas: Discussions. Found a bug or want a feature: Issues.
Apache License 2.0 - see LICENSE for details.
gosqlx.dev · Playground · Docs · MCP Server · VS Code
SQL validation, formatting, parsing, metadata extraction, linting, and security analysis.
{ "mcpServers": { "io.github.ajitpratap0-gosqlx": { "url": "https://mcp.gosqlx.dev/mcp", "headers": {} } }}工具
暂无工具列表。远程服务器在首次健康检查后会获得工具列表。
常见问题
在本页复制适用于 Cursor、Claude Desktop、Claude Code 或 VS Code 的 http 配置。它使用发布者的安装方式,而不是 PlugMCP 代理。
此记录未列出必需的环境变量。
GoSQLX 通过 HTTP 访问。
上次检查时间:2026-11-15。 SQL validation, formatting, parsing, metadata extraction, linting, and security analysis.