On 24-25 September 2026, Data Community Poland brought SQLDay Lite to Gdańsk University of Technology. One session on the agenda went straight to a question many data teams are being asked right now: how do you let an AI agent work with company data without handing it the keys and hoping for the best? "MCP Servers - build your own toolkit for AI agents" was presented by Maciej Kępa, Data Architect at Datumo and Azure & Production AI Tech Lead, and Piotr Balik, Senior Data Engineer at Datumo.
The Model Context Protocol (MCP) is an open standard for connecting AI applications to tools and data. Plenty of talks explain what it is. This one showed how to build a server that is actually worth connecting to, compared an agent with and without it on the same database, and ended with a clear rule for when MCP is worth the effort and when it isn't.
Why an agent needs more than a database connection
The speakers start with the language model itself. Their slide lists what an LLM is great at (summarizing context, drafting SQL or code, explaining concepts, reasoning over evidence it is given) next to what it is weak at by default: knowing your private data, choosing authoritative sources, applying hidden business rules and proving that an answer is correct. In their words, the model is "powerful at language and reasoning - but not a trusted data platform by itself."
An agent, in their definition, is "an LLM inside a work loop": plan, select a tool, call it with structured input, observe the result, then decide whether to finish or repeat. They sum it up as agent = model + tools + state + policy. The model proposes actions, and the runtime around it enforces the boundary.
A business question shows why that boundary matters. Take "Which stores breached the availability SLA last week, and why?" The model can draft SQL for it. But a reliable answer also depends on four things the database connection does not provide:
- Definition: which SLA, and in which timezone?
- Authority: which source is the trusted one?
- Scope: which stores is this user allowed to see?
- Evidence: how can the answer be verified?
Raw access gives an agent flexibility. A reliable answer needs an engineered interface. Without one, an agent sees tables but not metric definitions, picks the convenient source over the authoritative one, and works without the permissions and approvals that live elsewhere. The speakers' conclusion: "We need a controlled contract, not more prompt magic."
MCP as the enterprise adapter
Without a shared standard, every pairing of an AI client and an enterprise system needs its own glue code that rediscovers capabilities, describes inputs, handles authentication, translates errors and formats results. Multiply that by SQL and lakehouse sources, internal APIs, document search and business workflows on one side, and developer tools, chat assistants, custom agents and automation on the other, and the same plumbing gets rebuilt again and again.
MCP standardizes that interaction. As the speaker notes put it, MCP doesn't remove the adapters to your databases or APIs. It stops every AI client from inventing a different contract for the same capability. The business logic still belongs to your server.
The architecture slide, based on the MCP architecture documentation, names the parts:
- the host runs the experience (VS Code, ChatGPT or a custom agent)
- the MCP client speaks the protocol: discovery, sessions and messages
- the MCP server publishes capabilities and connects them to real systems
Servers offer three kinds of capability: tools (actions), resources (context) and prompts (workflows). They talk over one of two transports: stdio for local servers and Streamable HTTP for remote ones. The notes add a useful warning: MCP is not a database proxy. It defines how capabilities are discovered and invoked.
Building the contract, one business decision at a time
The heart of the session is a five-step recipe for a custom server:
- Choose one question: a repeatable decision with a known owner.
- Define the tool: name, description, inputs, output and errors.
- Implement the handler: call SQL or an API through a controlled adapter.
- Add controls: identity, scope, validation, timeout and audit.
- Test and register: in the MCP Inspector first, then in the target client.
The example contract is get_availability_breaches. It takes a week_start date and a region from an approved list. On the server side it applies the certified SLA definition and the user's scope, and it rejects incomplete periods. It returns not just a result but result + source + assumptions + validation.
Two ideas from this part are worth keeping. First, the tool description is part of the runtime contract, because the agent reads it to decide what to call. Second, the notes recommend keeping the handler "boring". The value sits in the contract: a narrow input schema, an authoritative definition, user scope and evidence in the result. As the slide puts it, "A good tool narrows the agent's choices and makes the result easier to verify."
Where to run a custom MCP server on Azure
For remote servers, the session maps the operating model to an Azure runtime:
- Azure Container Apps (lightweight) is the default for a containerized remote MCP server, with managed scaling and a Streamable HTTP endpoint.
- Azure Functions (serverless) fits small stateless tools and event-driven workloads.
- App Service (familiar) suits teams that already run web applications there.
- AKS (max control) is for teams that already operate Kubernetes.
In front of the server, Entra ID and API Management add OAuth, rate limits, policies and telemetry. API Management can also govern an existing MCP endpoint or expose selected REST operations as MCP tools. Behind the server, Managed Identity, Key Vault and private endpoints connect it to internal systems. The demo repository follows this pattern too, with Bicep templates for the database, a container registry and a Container App.
The challenge: agent vs. agent + MCP
The comparison keeps everything equal except the access pattern: "Same model. Same questions. Same database." The baseline agent gets an LLM, generic database access and a schema description. The MCP agent gets the same LLM plus an MCP toolkit with business rules and validation. Both are tested with the same benchmark questions against gold SQL and expected results.
The demo repository shows how carefully the benchmark is built. It is a Python MCP server over an AdventureWorksLT demo database, used from the Codex CLI, with three read-only tools: get_schema, get_business_rules and query_sql. The business rules are also published as an MCP resource. The rules tool returns the rule text together with a short version hash, so every answer can be traced to the definitions it used:
@mcp.tool(annotations=READ_ONLY, structured_output=True)
async def get_business_rules() -> dict[str, object]:
"""Read authoritative revenue, identity, country and classification rules before analytical SQL."""
text = RULES_PATH.read_text(encoding="utf-8")
log.info("tool=get_business_rules status=ok")
return {"version": hashlib.sha256(text.encode()).hexdigest()[:12], "rules": text}
@mcp.tool(annotations=READ_ONLY, structured_output=True)
async def get_business_rules() -> dict[str, object]:
"""Read authoritative revenue, identity, country and classification rules before analytical SQL."""
text = RULES_PATH.read_text(encoding="utf-8")
log.info("tool=get_business_rules status=ok")
return {"version": hashlib.sha256(text.encode()).hexdigest()[:12], "rules": text}
@mcp.tool(annotations=READ_ONLY, structured_output=True)
async def get_business_rules() -> dict[str, object]:
"""Read authoritative revenue, identity, country and classification rules before analytical SQL."""
text = RULES_PATH.read_text(encoding="utf-8")
log.info("tool=get_business_rules status=ok")
return {"version": hashlib.sha256(text.encode()).hexdigest()[:12], "rules": text}
The five benchmark questions are about recognized net revenue in Q1 2025, and the seed data contains just the kinds of detail that a schema alone won't tell an agent:
- revenue is recognized by a separate recognition date, so an order placed in December 2024 belongs to Q1
- an order can be cancelled by a downstream override flag even though its header says shipped
- internal orders must not count as external revenue
- two customer records can belong to the same business entity
- "US" and "USA" are the same country
- a product's reporting category is effective-dated, so a later reclassification must not change history
- each order has 1,000 related events, so joining order lines to events before aggregating inflates revenue
Each trap has an expected answer in the repo, and the rules file tells the agent how to avoid it. The query_sql tool adds the controls from the recipe: one SELECT or CTE at a time, an allowlist of schema-qualified objects, and limits of 15 seconds, 200 rows and 64 KiB per result. It is a compact, readable example of what "engineering the contract" looks like in code.
When MCP makes sense, and when to skip it
The closing slide is a decision rule, not a sales pitch. Use MCP when:
- multiple clients need the same tools
- business rules must live outside prompts
- access needs identity, scope and audit
- teams need discoverable capabilities
Skip it for now when one application calls one internal function, no capability will be reused, the interface changes every day, or the team can't yet operate another service. The line that sums up the session: "MCP does not create correctness. It gives us a place to engineer it."
Practical takeaways
- Start from one recurring business decision with a known owner, not from "expose the database".
- Write the tool name, description, inputs and errors with care. The agent reads them at runtime.
- Put certified definitions, user scope and validation in the server, not in the prompt.
- Return evidence with every answer: the source, the assumptions and how it was validated.
- Build a benchmark of real questions with expected results, and run it with and without your tools.
- On Azure, start with Container Apps for a remote server and add API Management when you need central policy.
- Ask whether a shared, governed contract will reduce repeated integration work. If not, a plain function call may be enough.
Correct definitions still need correct data
The session makes the agent's answer depend on a contract: the right definition, the right source, the right scope and evidence in the result. The example tool even rejects incomplete periods. That last rule raises a question for the data team behind the server: how does the server know a period is complete, or that last night's load arrived at all? A perfectly written business rule applied to a half-loaded table still returns a confident, wrong number.
That is where data quality monitoring fits into an agent's toolkit. Freshness, volume and validation checks on the tables behind a tool give the server something concrete to put in the "validation" part of its answer. digna works in the same direction: it offers its own MCP server so AI assistants can query data-quality results directly, and our overview of AI data quality explains why trustworthy inputs matter as much as a good model.
Thank you, Maciej, Piotr and SQLDay Lite
Many thanks to Maciej Kępa and Piotr Balik for a session that turns MCP from a buzzword into an engineering checklist, backed by a demo anyone can run, and to Data Community Poland for organizing SQLDay Lite in Gdańsk. The slides are available in the SQLDay Lite 2026 repository, and the full server, benchmark questions and Azure setup are in the demo repository.
Frequently asked questions
What is an MCP server and why do AI agents need one?
An MCP server publishes tools, resources and prompts that AI agents can discover and call through the Model Context Protocol. At SQLDay Lite 2026, Maciej Kępa and Piotr Balik showed that it gives an agent a controlled contract with certified definitions, user scope and evidence, instead of raw database access.
How do you build a custom MCP server for business data?
Follow five steps: choose one repeatable question with a known owner, define the tool's name, description, inputs, output and errors, implement the handler through a controlled adapter, add identity, scope, validation, timeout and audit, then test it in the MCP Inspector before registering it in the target client.
Where should you host a remote MCP server on Azure?
Azure Container Apps is the recommended default for a containerized remote MCP server, with managed scaling and a Streamable HTTP endpoint. Azure Functions suits small stateless tools, App Service fits teams already running web apps there, and AKS is for Kubernetes teams. Entra ID and API Management add OAuth, rate limits and telemetry.
How can you safely let an AI agent run SQL queries?
Restrict what the query tool accepts and returns. The demo's query_sql tool allows only one SELECT or CTE at a time, checks an allowlist of schema-qualified objects, and caps each result at 15 seconds, 200 rows and 64 KiB. Business rules come from a separate tool with a version hash for traceability.
When is building an MCP server not worth the effort?
You can skip MCP for now when one application calls one internal function, no capability will be reused, the interface changes daily, or the team cannot yet operate another service. It pays off when multiple clients need the same tools and when business rules, identity, scope and audit must live outside prompts.