Skip to main content
Glama
dhandashreya

mcp-data-agent

by dhandashreya

MCP Data Agent

CI License

A real Model Context Protocol (MCP) server exposing data-analyst tools over a sales database, plus an LLM agent (Gemini) that discovers those tools at runtime and decides which to call to answer a question — the actual point of MCP being that the tool definitions live on the server, not hardcoded into the agent.

Why this is a real MCP implementation, not a mock

  • src/mcp_server.py is a genuine MCP server, built on the official mcp Python SDK, exposing 4 tools (list_tables, run_sql_query, get_column_stats, plot_bar_chart) over the standard stdio transport.

  • src/smoke_test_client.py is a protocol-level test with no LLM involved at all — it launches the server as a real subprocess, connects over stdio, calls list_tools(), and calls run_sql_query through the actual MCP wire protocol. This is what proves the server works, independent of whether the agent on top of it works.

  • src/mcp_client_agent.py is the agent: it lists the server's tools, converts their JSON schemas directly into Gemini function declarations (parameters_json_schema=tool.input_schema — no manual schema translation), and runs the standard tool-calling loop: ask the model → execute any requested tool call via the real MCP session → feed the result back → repeat until the model gives a final answer.

Related MCP server: agente-ecommerce-mcp-memoria

Requires Python 3.10+

The mcp package doesn't support Python 3.9. If your default python is older, use py -3.12 (or whichever 3.10+ interpreter you have) for every command below.

Pipeline

pip install -r requirements.txt
python src/generate_data.py          # -> data/sales.db (3,000 synthetic orders)
python src/smoke_test_client.py      # protocol-only sanity check, no LLM
python src/mcp_client_agent.py "Which category has the highest revenue?"

Without GEMINI_API_KEY set, mcp_client_agent.py runs a manual fallback: it lists the tools discovered from the live server and calls one directly, so the MCP plumbing is demonstrable with zero API keys. With a key (copy .env.example to .env), it runs the full agent loop.

Tests

tests/test_pipeline.py calls the server's tool functions directly (schema introspection, SQL rejection of non-SELECT statements, stats), and — the real proof this is a working MCP implementation — runs smoke_test_client.py, which launches the server as an actual subprocess and talks to it over the real stdio protocol. No API key needed, so this runs in CI on every push, on Python 3.12.

pip install -r requirements.txt pytest
pytest tests/ -v

Tools exposed by the server

Tool

Purpose

list_tables

Schema introspection

run_sql_query

Read-only SQL — rejects anything that isn't a SELECT before it reaches the database

get_column_stats

Summary stats for quantity, unit_price, or revenue

plot_bar_chart

Aggregates by region/category and saves a PNG

Verified vs. not independently verified

  • Verified: the MCP server and protocol wiring (tool discovery, tool execution over stdio) — smoke_test_client.py runs it end to end with no LLM in the loop, and the manual fallback path in mcp_client_agent.py exercises the same real protocol.

  • Implemented against the current google-genai SDK, not run against a live key in this environment: the Gemini tool-calling loop itself. The function-declaration and function-response types were checked directly against the installed SDK, but the actual multi-turn call requires an API key this environment doesn't have. Run it with your own GEMINI_API_KEY to exercise that path.

Project structure

data/     generated sales.db
src/      mcp_server, smoke_test_client, mcp_client_agent, generate_data
reports/  charts saved by plot_bar_chart

Stack

Python 3.12 · mcp (official Model Context Protocol SDK) · google-genai · SQLite · matplotlib

License

MIT — see LICENSE.

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    A production-grade MCP server for enterprise sales analytics, enabling LLM clients to query, analyze, and visualize sales data from a SQLite database through structured tools, resources, and prompts.
    6
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    An MCP server that exposes a LangChain agent with short-term memory to analyze real e-commerce data through predefined SQL tools, enabling natural language queries on sales, customers, and logistics.
  • A
    license
    Not graded
    quality
    C
    maintenance
    A production-style MCP server exposing six business tools (web search, database, CRM, email, calendar, analytics) to AI clients via a secure, authenticated interface, with mock mode and a reference agent client.
    MIT

View all related MCP servers

Related MCP Connectors

  • Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.

  • Hosted MCP endpoint with realistic fake data for prototyping agents. 12 tools, no setup.

  • GibsonAI MCP server: manage your databases with natural language

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dhandashreya/mcp-data-agent'

If you have feedback or need assistance with the MCP directory API, please join our Discord server