Inspiration

Most people keep their money, habits and small-business numbers in spreadsheets, but nobody wants to open a laptop to ask "where did most of my money go this month?". Alexa+ talks to external services through MCP, so I built the missing piece: a server that lets a voice assistant answer questions about your own tabular data with a short sentence you can hear, not a table you have to read.

What it does

Ask Your Data is a self-hosted MCP server (spec 2025-11-25, Streamable HTTP) that exposes four tools to any MCP client, such as an Alexa+ integration:

  • load_dataset: loads CSV text into memory with strict validation (5 MiB / 100,000-row limits, unique headers, row-length checks).
  • query: filters rows (eq, ne, gt, gte, lt, lte, contains), groups by a column, and aggregates (count, sum/total, avg/average/mean, min, max). Numbers compare numerically and text case-insensitively.
  • summarize: reports the dataset's name, row count, columns and sample rows, so the assistant can learn the shape of the data before it plans a query.
  • answer_with_bedrock: turns the latest query result into one concise, speakable answer with the Amazon Bedrock Converse API, and falls back gracefully if Bedrock is unavailable.

Example: "Where did most of my money go this month?" The assistant calls query(group_by="category", aggregation="sum", column="amount") and gets Food 64.50, Transport 37.50, Entertainment 24. It then calls answer_with_bedrock to phrase that as one sentence. A follow-up, "How much on transport?", becomes a filter (category = Transport) that matches 2 rows totalling 37.50.

How I built it

  • Python and the official MCP Python SDK (FastMCP). Tool schemas come from type hints and a Pydantic Filter model, so clients see strict JSON schemas (for example, an enum of allowed operators) and build valid calls on the first try.
  • Streamable HTTP transport. The handshake negotiates MCP protocol 2025-11-25 (verified in MCP Inspector).
  • A pure-Python query engine. It uses csv plus Decimal for exact sums and averages, with no pandas, so it installs anywhere and starts instantly.
  • Amazon Bedrock via boto3 bedrock-runtime converse(). The system prompt tells the model to answer only from the supplied results and to treat dataset values as untrusted data, not instructions (prompt-injection hardening). Temperature 0.2 and a 300-token cap keep answers short enough to speak. Credentials come from the AWS credential chain or a short-term Bedrock API key; nothing is stored in the repo.
  • A graceful fallback. If Bedrock fails, the error is logged on the server and the user still gets a clearly labelled deterministic answer (for example, the group with the largest total). A voice user never hears a stack trace.
  • Tests: 14 pytest tests cover parsing limits, operators, aggregations, the tool schema and the fallback path.

Challenges I ran into

My new AWS account was blocked from Amazon Bedrock inference: ValidationException: Operation not allowed in eu-north-1, and Service Quotas shows an applied value of 0 for every Bedrock tokens-per-minute quota. My support case was still unassigned at submission time. The demo therefore shows the fallback path, and the whole story is in the friction log.

Accomplishments that I'm proud of

  • A spec-compliant (2025-11-25) Streamable HTTP MCP server with strict, client-friendly tool schemas.
  • Answers designed for the ear, not the screen.
  • Security-minded defaults: localhost binding, input size limits, no file-path access, no secrets in the repo, and prompt-injection-aware model instructions.

What I learned

  • Designing tool schemas matters as much as the tools themselves: precise schemas mean fewer failed calls from the agent.
  • Voice changes the output contract. One sentence beats a JSON table.
  • In time-boxed projects, plan for cloud-account friction and build a fallback path.

What's next

  • Per-user / per-session datasets (today one in-memory dataset is shared by all clients).
  • Load from Amazon S3 or Google Sheets and other formats such as XLSX.
  • Multi-turn context, so "and what about transport?" reuses the previous query.
  • Deploy behind auth on AWS (Lambda or AgentCore) so Alexa+ can reach it without running locally.
  • Visual cards for Echo Show devices: a chart alongside the spoken answer.

Code (MIT): https://github.com/rajnish-verma-22172/ask-your-data-mcp Friction log: https://github.com/rajnish-verma-22172/ask-your-data-mcp/blob/main/FRICTION_LOG.md

Built With

Share this project:

Updates

Submission history