Connecting LLMs to Databases: Custom APIs vs. MCP

Building custom API endpoints just so an LLM can query your internal database is a quiet productivity killer. Every time a schema changes, your integration breaks, and your engineering team is dragged back into maintaining fragile middle-tier glue code instead of building core product features.
What Changed: Cheaper Agents and Standardized Protocols
Two major shifts have changed the economics of connecting data to AI. First, Anthropic released Claude Fable 5.1, reducing costs for complex agentic tasks by up to 45 percent while loosening overzealous safety safeguards that previously blocked benign data queries. Second, open standards like the Model Context Protocol (MCP) are maturing. The release of tools like datasette-mcp 0.2—which standardizes how database rows are returned to LLMs as clean arrays of objects—demonstrates that developers no longer need to write custom API wrappers to expose structured data to AI models.
The Comparison: Custom API Handlers vs. Model Context Protocol
When deciding how to expose your internal databases and tools to LLM agents, you have two primary paths:
Option 1: Custom API Handlers
This traditional approach involves writing bespoke REST or GraphQL endpoints specifically for your LLM prompts to call via tool-use features.
- Pros: Absolute control over data serialization, authentication, and rate limiting. Works with any LLM out of the box.
- Cons: High engineering overhead. You must manually map schemas, write custom error handling, and update the API whenever your database structure changes. Weak models often lose track of positional array elements if your custom serializer isn't perfectly optimized.
Option 2: Model Context Protocol (MCP)
MCP is an open standard that allows developers to build a single "MCP server" that exposes data sources directly to any compatible LLM client.
- Pros: Zero-maintenance schema mapping. Standardized tools like datasette-mcp automatically format SQL outputs into structured formats that even lightweight models can parse reliably. Highly reusable across different internal AI projects.
- Cons: Requires an MCP-compliant client or orchestrator. It is still an emerging ecosystem, meaning some legacy developer tools lack native support.
Action Plan: Implementing a Standardized Data Layer
If you want to leverage cheaper agentic models like Claude Fable 5.1 without drowning in integration debt, follow this transition plan:
- Identify read-only workloads: Find internal dashboards, customer support lookups, or reporting pipelines that currently rely on manual SQL queries or custom scripts.
- Deploy an MCP gateway: Instead of writing new endpoints, spin up an open-source MCP server (such as datasette-mcp for SQLite or equivalent Postgres connectors) pointing to a read-only replica of your database.
- Configure your LLM client: Connect your database-linked MCP server to your developer environment or internal AI chat interface.
- Establish strict guardrails: Ensure your database connection string uses a user role restricted solely to SELECT statements to prevent prompt injection attacks from altering your data.
Who Should Act Now
Lean engineering teams using LLMs for internal analysis or automated reporting should adopt MCP immediately. The reduction in API maintenance costs makes it a clear winner over custom-built endpoints. However, teams building highly sensitive, external-facing transactional workflows should wait for more robust application-level authorization frameworks to mature before exposing write-access databases to autonomous agents.
At Presence Digital, we recommend starting with read-only database connections to eliminate manual reporting bottlenecks without exposing your core infrastructure to unnecessary security risks.
Takeaway
Stop writing custom API wrappers for your database. Use open protocols like MCP to turn your data into an instant, self-describing resource for cheaper, smarter agentic models.
