Skip to main content
Glama

GoSQLX

Парсинг SQL на скорости Go

Go Version Release License PRs Welcome

Website VS Code MCP Glama MCP Server Lint Action

Tests Go Report GoDoc Stars OpenSSF Scorecard

🌐 Попробовать Playground  ·  📖 Читать документацию  ·  🚀 Начало работы  ·  📊 Бенчмарки

1.38M+ оп/сек

<1мкс задержка

85% SQL-99

8 диалектов

0 состояний гонки

Что такое GoSQLX?

GoSQLX — это готовый к промышленному использованию SDK для парсинга SQL на языке Go. Он токенизирует, анализирует и генерирует AST из SQL с оптимизацией без копирования и интеллектуальным пулом объектов, обрабатывая более 1,38 млн операций в секунду с субмикросекундной задержкой.

ast, _ := gosqlx.Parse("SELECT u.name, COUNT(*) FROM users u JOIN orders o ON u.id = o.user_id GROUP BY u.name")
// → Full AST with statements, columns, joins, grouping - ready for analysis, transformation, or formatting

Почему GoSQLX?

  • Не ORM — это парсер. Вы получаете AST, а что с ним делать — решаете сами.

  • Не медленный — токенизация без копирования, переиспользование через sync.Pool, отсутствие аллокаций на критических путях.

  • Не ограниченный — PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite, Snowflake, ClickHouse. Поддержка CTE, оконных функций, MERGE, операций над множествами.

  • Не просто библиотека — CLI, расширение для VS Code, GitHub Action, MCP-сервер, WASM-песочница, Python-биндинги.

Related MCP server: mcp-server-duckdb

Начало работы за 60 секунд

go get github.com/ajitpratap0/GoSQLX
package main

import (
    "fmt"
    "github.com/ajitpratap0/GoSQLX/pkg/gosqlx"
)

func main() {
    // Parse any SQL dialect
    ast, _ := gosqlx.Parse("SELECT * FROM users WHERE active = true")
    fmt.Printf("%d statement(s)\n", len(ast.Statements))

    // Format messy SQL
    clean, _ := gosqlx.Format("select id,name from users where id=1", gosqlx.DefaultFormatOptions())
    fmt.Println(clean)
    // SELECT
    //   id,
    //   name
    // FROM users
    // WHERE id = 1

    // Catch errors before production
    if err := gosqlx.Validate("SELECT * FROM"); err != nil {
        fmt.Println(err) // → expected table name
    }
}

Установка везде

📦 Go-библиотека

go get github.com/ajitpratap0/GoSQLX

🖥️ CLI-инструмент

go install github.com/ajitpratap0/GoSQLX/cmd/gosqlx@latest
gosqlx validate "SELECT * FROM users"
gosqlx format query.sql
gosqlx lint query.sql

💻 Расширение для VS Code

code --install-extension ajitpratap0.gosqlx

Включает бинарный файл — никакой настройки. Узнать больше →

🤖 MCP-сервер (AI-интеграция)

claude mcp add --transport http gosqlx \
  https://mcp.gosqlx.dev/mcp

7 SQL-инструментов в Claude, Cursor или любом другом MCP-клиенте. Руководство →

Краткий обзор возможностей

Документация

Ресурс

Описание

🌐

gosqlx.dev

Веб-сайт с интерактивной песочницей

🚀

Начало работы

Разберите свой первый SQL за 5 минут

📖

Руководство по использованию

Исчерпывающие паттерны и примеры

📄

Справочник API

Полная документация API

🖥️

Руководство по CLI

Справочник по командной строке

🌍

Совместимость SQL

Матрица поддержки диалектов

🤖

Руководство по MCP

Интеграция с ИИ-ассистентами

🏗️

Архитектура

Глубокое погружение в проектирование системы

📊

Бенчмарки

Данные о производительности и методология

📝

Примечания к выпуску

Что нового в каждой версии

Вклад в проект

GoSQLX создается такими же участниками, как вы. Будь то исправление ошибки, новая функция, улучшение документации или просто опечатка — любой вклад важен.

git clone https://github.com/ajitpratap0/GoSQLX.git && cd GoSQLX
task check    # fmt → vet → lint → test (with race detection)
  1. Сделайте форк и создайте ветку от main

  2. Напишите тесты — мы используем TDD и требуем код без состояний гонки

  3. Запустите task check — должно пройти перед PR

  4. Откройте PR — мы проверяем в течение 24 часов

📋 Руководство по вкладу · 📜 Кодекс поведения · 🏛️ Управление

Кто использует GoSQLX?

GoSQLX скачивают и клонируют разработчики по всему миру — 595 уникальных пользователей за последние 14 дней. Если вы используете GoSQLX в своем проекте или организации, мы будем рады узнать об этом!

Проект / Компания

Вариант использования

Ваш проект здесь

Добавьте себя через PR или расскажите нам в обсуждениях

Используете GoSQLX на работе? Создали что-то крутое с его помощью? Поделитесь своей историей в GitHub Discussions — это помогает сообществу расти и мотивирует на дальнейшую разработку.

Сообщество

Есть вопросы? Идеи? Нашли ошибку?

Лицензия

Apache License 2.0 — подробности см. в LICENSE.


Создано с ❤️ сообществом GoSQLX

gosqlx.dev · Playground · Документация · MCP-сервер · VS Code

Если GoSQLX помогает вашему проекту, подумайте о том, чтобы поставить ⭐

Available Tools

7 tools
analyze_sqlA
Read-onlyIdempotent

Run all 6 analysis tools concurrently and return a composite report (validate, parse, metadata, security, lint, format).

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesThe SQL string to analyze

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond annotations (readOnly, idempotent), the description adds that it runs six tools concurrently and returns a composite report, though it doesn't detail error handling or report structure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, well-structured sentence that conveys the essential purpose and behavior without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description adequately covers the tool's purpose and behavior given the simple parameter set and safety annotations, but lacks details about the composite report format.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the description adds no additional meaning to the 'sql' parameter beyond the schema's description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'run' and the resource 'all 6 analysis tools concurrently', distinguishing itself from sibling tools that perform individual analyses.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Describes when to use (concurrent analysis), but does not explicitly state when not to use or name alternatives; however, sibling tool list provides implicit guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

extract_metadataA
Read-onlyIdempotent

Extract tables, columns, and functions referenced in SQL.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesThe SQL string to analyze

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare the tool as read-only and idempotent. The description adds that it extracts specific SQL elements but does not detail error handling or output behavior, adding modest value beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no superfluous words, effectively conveying the core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of an output schema, the description hints at what is returned (tables, columns, functions), which is sufficient for a focused extraction tool, though more detail on output structure would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema coverage, the description adds some meaning by listing extracted items but no additional detail on parameter formatting or constraints beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool extracts tables, columns, and functions from SQL, which is specific and distinct from sibling tools like format_sql or security_scan.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as parse_sql or analyze_sql, leaving the agent to infer context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

format_sqlA
Read-onlyIdempotent

Format SQL with configurable indentation and keyword casing.

ParametersJSON Schema
NameRequiredDescriptionDefault
add_semicolonNoAppend a trailing semicolon (default: false)
indent_sizeNoSpaces per indent level (default: 2)
sqlYesThe SQL string to format
uppercase_keywordsNoUppercase SQL keywords (default: false)

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare the tool as read-only (readOnlyHint=true), non-destructive, and idempotent. The description adds no further behavioral details beyond what parameters suggest. No contradiction, but also no extra context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, front-loaded sentence that efficiently conveys the tool's purpose. No extraneous words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description, together with the schema and annotations, covers most aspects. However, since there is no output schema, it would be helpful to mention that the tool returns the formatted SQL string. Minor gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 100% description coverage for all 4 parameters. The description merely summarizes the parameters without adding new meaning beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Format SQL with configurable indentation and keyword casing,' using a specific verb and resource. This distinguishes it from sibling tools like analyze_sql, lint_sql, and parse_sql.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for formatting SQL but does not explicitly state when to use this tool versus alternatives, nor does it mention any when-not-to-use scenarios. Usage is clear from context but lacks explicit guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

lint_sqlA
Read-onlyIdempotent

Lint SQL against all 10 GoSQLX style rules (L001–L010).

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesThe SQL string to lint

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations (readOnlyHint, destructiveHint, idempotentHint) already declare safe, read-only, idempotent behavior. The description adds the specific rule coverage but no additional behavioral traits like output format or side effects, providing limited extra transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, front-loaded sentence that efficiently conveys the tool's purpose without any redundant information. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description lacks details about the return format (e.g., list of issues, pass/fail). Given the tool's simplicity, this is a notable gap, but annotations partially compensate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with a clear description for the single 'sql' parameter. The description does not add further meaning beyond what the schema already provides, so a baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Lint SQL against all 10 GoSQLX style rules (L001–L010).' It specifies the exact verb (lint), resource (SQL), and rule set, distinguishing it from siblings like format_sql or security_scan.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied through the rule set (GoSQLX), but no explicit when-to-use, when-not-to-use, or alternative tools are mentioned. The description lacks guidance on choosing this over siblings like analyze_sql or validate_sql.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

parse_sqlA
Read-onlyIdempotent

Parse SQL and return an AST summary: statement count and types.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesThe SQL string to parse

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already confirm read-only, non-destructive, idempotent. Description adds that output is an AST summary with count and types, which goes beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, no redundancy, all information is useful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given simple tool and good annotations, description provides all needed context: input (SQL string) and output (AST summary). No output schema needed as description covers return value.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Single parameter 'sql' has description in schema. Description does not add additional meaning beyond the schema's description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states verb 'Parse' and resource 'SQL', specifying output as 'AST summary: statement count and types'. Distinguishes from siblings like analyze_sql which likely does deeper analysis.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit when-to-use or when-not-to-use guidance. Implies use for quick overview, but doesn't mention alternatives like analyze_sql for detailed analysis.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

security_scanA
Read-onlyIdempotent

Scan SQL for injection patterns: tautologies, UNION attacks, stacked queries, comment bypasses, and more.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesThe SQL string to scan

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and idempotentHint=true, so the description adds only that it detects injection patterns. No additional behavioral details (e.g., output format, blocking behavior) are provided, but annotations carry the safety burden.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with no wasted words. Essential information is front-loaded and clear.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple interface (1 required param, no output schema) and annotations covering safety, the description adequately explains the tool's purpose. However, it could mention the return format or highlight that it is a security-focused analysis.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage (the `sql` parameter has a description), so the description adds no extra meaning beyond listing patterns the scan looks for. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly specifies the action (scan) and resource (SQL) and lists specific injection patterns (tautologies, UNION attacks, etc.), making it distinct from sibling tools like analyze_sql or lint_sql.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like validate_sql or parse_sql. The description implies use for security scanning but does not state exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

validate_sqlA
Read-onlyIdempotent

Validate SQL syntax. Returns {valid: bool, error?: string, dialect?: string}.

ParametersJSON Schema
NameRequiredDescriptionDefault
dialectNoSQL dialect: generic, mysql, postgresql, sqlite, sqlserver, oracle, snowflake
sqlYesThe SQL string to validate

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate this is a safe, idempotent read operation (readOnlyHint=true, destructiveHint=false, idempotentHint=true). The description adds the return value shape ({valid, error, dialect}) but does not disclose edge-case behaviors (e.g., handling of invalid dialect). This is adequate but not exceptional.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with the return type, perfectly concise and front-loaded. No unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity, two well-documented parameters, and no output schema, the description is largely complete. It reveals the return shape, which compensates for the missing output schema. However, it omits any mention of error handling or usage context (e.g., 'use for quick syntax checks before execution').

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%: both 'sql' and 'dialect' have descriptions and the latter has an enum. The description does not add any additional semantic meaning beyond what the schema provides, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description concisely states 'Validate SQL syntax', which clearly identifies the verb and resource. It distinguishes this tool from siblings like lint_sql (style checking) and parse_sql (parsing into AST).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance is given on when to use this tool versus alternatives (e.g., analyze_sql for deeper analysis, format_sql for formatting). The description only states what it does, not when it is appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 7 tool updatesv1.12.1
    • First observedanalyze_sql
    • First observedextract_metadata
    • First observedformat_sql
    • First observedlint_sql
    • First observedparse_sql
    • First observedsecurity_scan
    • First observedvalidate_sql

TDQS

A4.1/5.0
Disambiguation5/5

Each tool targets a distinct SQL analysis function: syntax validation, AST parsing, metadata extraction, security scanning, linting, formatting, and a composite report. No overlaps exist.

Naming Consistency5/5

All tools follow a clear verb_noun pattern (e.g., validate_sql, format_sql). The one exception (extract_metadata) still uses a verb and clearly refers to SQL metadata, maintaining consistency.

Tool Count5/5

7 tools is well-scoped for SQL analysis, covering the core tasks without being too many or too few. Each tool has a clear purpose.

Completeness5/5

The tool set covers the full lifecycle of SQL analysis: validation, parsing, metadata extraction, security, linting, and formatting. The aggregate tool enhances usability. No obvious gaps for the intended domain.

Maintenance

ActivitySlowing
ResponsivenessWithin a week

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Allows AI assistants to list tables, read data, and execute SQL queries through a controlled interface, making database exploration and analysis safer and more structured.
    3
    1,374
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol (MCP) server implementation for DuckDB, providing database interaction capabilities through MCP tools. It would be interesting to have LLM analyze it. DuckDB is suitable for local analysis.
    178
    MIT
  • A
    license
    B
    quality
    F
    maintenance
    Added support for STDIO mode and SSE mode Added support for multiple SQL execution, separated by ";" Added ability to query database table names and fields based on table comments Added SQL Execution Plan Analysis Added Chinese field to pinyin conversion
    5
    248
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ajitpratap0/GoSQLX'

If you have feedback or need assistance with the MCP directory API, please join our Discord server