From Plain English to a Live Dashboard: Automating Reporting with MCP
Someone in your Slack asks, "How many people signed up last week?" You open a SQL client, write a query you've written a dozen times before, run it, copy the number, and paste it back. A week later, the same question lands in a different channel. Same query, same copy-paste, same five minutes gone. Multiply that by every "quick number" your team asks for — signups, active users, MRR, refunds, top…
When team members ask quick questions like "How many people signed up last week?", the current process involves opening a SQL client, writing a familiar query, running it, copying the number, and pasting it back. This repetitive task quickly becomes a part-time job nobody initially signed up for. The Model Context Protocol (MCP) offers an alternative, providing a clean solution for automating reporting.
MCP is an open standard that connects AI assistants to external systems, including databases, through a consistent, permissioned interface. Instead of AI guessing connections or users pasting credentials into chat boxes, an MCP server sits between them and exposes read-only capabilities: accessing the schema, running read-only queries, and saving them to a dashboard.
This article explains the process of transforming plain-English questions into living reports using MCP.
MCP servers expose three types of capabilities: resources (read-only data), tools (actions like running queries and saving them), and prompts (reusable templates for common workflows). Crucially, the AI never accesses the database directly; it receives the schema, drafts SQL, and asks the server to run it. Since the query tool is read-only by design, malicious operations like DELETE or DROP are automatically rejected.
Schema awareness is vital, as it prevents the model from inventing incorrect column names. By grounding the model in the real schema, generated SQL remains honest and accurate.
The interaction process starts with asking the AI in plain English, like "How many users signed up in the last 7 days, grouped by day?" The AI fetches the schema and produces a SQL query, inferring column names, date functions, and grouping from the schema. Although the AI does the heavy lifting, a quick sanity check is essential to ensure the results are accurate and meaningful.
After verifying the query, it's essential to save it, so it's never rewritten. Naming the query, such as "Weekly Signups by Day," makes it a reusable asset. Subsequent requests can simply ask to run the saved query, eliminating the need to rewrite SQL. Additionally, a prompt template helps streamline the process further, turning a throwaway query into an asset the whole team can call by name.
Once the report is saved, it can be pinned to a dashboard, making data readily available and eliminating the need for repetitive manual queries.
An example demonstrates how three reports can be built in a single conversation. The AI writes the SQL for new MRR from subscriptions started this month, top 5 plans by active subscribers, and refunds issued in the last 30 days. These reports are saved and displayed on a Revenue Health dashboard, showcasing how five minutes of work can replace a recurring manual chore.
The AI handles SQL generation, while the user provides judgment on what metrics matter most. However, common mistakes like treating the first answer as final, fuzzy metric definitions, and unclear data definitions can hinder the process. By carefully reviewing queries and results and ensuring clear metric definitions, this approach can significantly streamline reporting for any team.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.