Return
Text-to-SQL via Model Context Protocol: Structured Context Orchestration for Reliable Database Query Generation
DOI:10.1109/tkde.2026.3716724.png)
Abstract
En 中文
Text-to-SQL has emerged as a fundamental task for enabling natural language interfaces to relational databases, playing a critical role in data analytics, business intelligence, and end-user database interaction. Extensive research efforts have been devoted to this task, ranging from traditional semantic parsing approaches to recent large language model (LLM)-based methods. Despite recent advances, existing LLM-based Text-to-SQL approaches largely rely on one-shot prompt-based generation. This paradigm suffers from two fundamental limitations: entangled contextual information that obscures reasoning, and the absence of systematic validation mechanisms for detecting and correcting SQL errors. To address these challenges, we propose MCP-Text2SQL, a protocol-driven framework that reformulates Text-to-SQL as a controllable and verifiable generation process. Instead of relying on monolithic prompts, MCP-Text2SQL decomposes heterogeneous contextual knowledge into semantically isolated model context protocol context servers and coordinates them through an explicit generation protocol. Furthermore, we introduce a verifiable SQL generation loop that integrates schema validation and execution-based feedback as structured protocol interactions, enabling deterministic and error-aware SQL revision without modifying model parameters. We evaluate MCP-Text2SQL on standard Text-to-SQL benchmarks and demonstrate that protocol-guided context orchestration and verifiable generation substantially improve both generation accuracy and robustness. Our results suggest that MCP provides a principled system-level abstraction for Text-to-SQL, shifting the focus from prompt engineering to controllable and verifiable generation workflows.
Keywords:
Text-to-SQL
translation
large language models (LLMs)
MCP
SQL query optimization
Journal
IF:
10.4
Papers:
6.8K
Citations:
3.2W
Organization
Cited Papers
No cited papers available

