A Unified Model Context Protocol SQL Tool Interface for Agentic AI Systems: Architecture and a Reproducible SQL Execution Baseline
Abstract
Large language model (LLM) agents increasingly need reliable access to structured databases, yet that access is often fragmented across custom drivers, framework-specific tools, and non-standard execution interfaces. This paper presents a unified SQL tool interface based on the Model Context Protocol (MCP): database operations are exposed as named tools through a FastMCP server, while SQL execution runs on SQLAlchemy. We evaluate the interface with a reproducible benchmark of 30 queries across simple, join, and aggregate categories, executed through two arms-direct SQLAlchemy and the full MCP client-server path-at three dataset scales (5,390 to 539,000 records) and on two engines (SQLite and PostgreSQL), for 2,400 measured runs. MCP transport adds a near-constant absolute cost of roughly 3 ms per call, so its relative overhead falls from 3.39× at the smallest scale to $\mathbf{1. 0 8} \times$ at the largest, indicating that protocol cost amortizes as query work grows. Result equivalence is verified by comparing order-insensitive checksums across arms, which agree on every successful query and strengthen the earlier structural-validity check. The cross-engine test also exposes a concrete portability limit: 8 of 30 queries fail on PostgreSQL because ROUND(double precision, integer) is unsupported, showing that a shared tool interface does not by itself provide SQL dialect portability. The benchmark harness, seeded datasets, and query set are released to support replication.