MCP Server — All SQL Tools as Model Context Protocol Tools
GoSQLX v1.10.0 adds a full MCP Server that exposes all GoSQLX SQL capabilities as Model Context Protocol tools over streamable HTTP. Integrate GoSQLX into Claude, Cursor, and any MCP-compatible AI assistant.
✨ New Features
- MCP Server (
pkg/mcp/,cmd/gosqlx-mcp/): 7 SQL tools over streamable HTTPvalidate_sql— validate SQL syntax with optional dialectformat_sql— format SQL with configurable indentation and keyword casingparse_sql— parse SQL and return AST summary (statement count and types)extract_metadata— extract tables, columns, and functions referenced in SQLsecurity_scan— scan SQL for injection patterns (tautologies, UNION attacks, stacked queries, comment bypasses)lint_sql— lint SQL against all 10 GoSQLX style rules (L001–L010)analyze_sql— run all 6 tools concurrently and return a composite report
- Bearer Token Auth: Optional authentication via
GOSQLX_MCP_AUTH_TOKENenvironment variable - Multi-Dialect: Validate against postgresql, mysql, sqlite, sqlserver, oracle, snowflake, or generic
📝 Documentation
docs/MCP_GUIDE.md— comprehensive MCP server guide- Architecture diagram updated with MCP layer
- API reference updated with
pkg/mcppackage - Configuration guide updated with MCP environment variables
🔧 Build
- Go minimum bumped to 1.23.0 (required by
github.com/mark3labs/mcp-go v0.45.0) - Taskfile:
mcp,mcp:build,mcp:test,mcp:installtasks added
Quick Start
# Install
go install github.com/ajitpratap0/GoSQLX/cmd/gosqlx-mcp@v1.10.0
# Run
gosqlx-mcp # default :8080
GOSQLX_MCP_PORT=9090 gosqlx-mcp # custom port
GOSQLX_MCP_AUTH_TOKEN=secret gosqlx-mcp # with authClaude Desktop Configuration
{
"mcpServers": {
"gosqlx": {
"command": "gosqlx-mcp",
"env": { "GOSQLX_MCP_PORT": "8080" }
}
}
}Full Changelog: v1.9.3...v1.10.0