arrow
Return

Text-to-SQL via Model Context Protocol: Structured Context Orchestration for Reliable Database Query Generation

delete2026-07-24
delete0
PRE
AI
G
Guocang Yang
V
Victor Junqiu Wei
Y
Y. Ling
张涛 cover
张涛 (Tao Zhang)
DOI:10.1109/tkde.2026.3716724delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

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

IEEE Transactions on Knowledge and Data Engineering cover
IEEE Transactions on Knowledge and Data Engineering
IF:
10.4
Papers:
6.8K
Citations:
3.2W

Organization

M
macau university of science and technology
Scholars:
1.5K
Papers: 685
Citations: 0
Cited Papers

Cited Papers

No cited papers available