← Projects · MCP Protocol · Open Source

Lumenore Analytics MCP Server

FastMCP · async Python 3.13 · JWT · SSE streaming · Docker

A production MCP server that makes a BI/analytics platform natively accessible to any MCP-compatible AI assistant — natural-language querying, forecasting, correlations, and outlier detection over typed, permission-scoped tools. Published open source under the Lumenore Platform organization.

Problem

AI assistants like Claude and ChatGPT had no way to query the analytics platform directly — every user copy-pasted data into the chat window, and non-technical business users couldn’t self-serve without SQL or BI training. The goal: expose the platform through the Model Context Protocol so any compatible assistant can discover and call analytics capabilities at runtime — securely, observably, and fast.

My role

I designed and implemented the server: framework selection, the analytics tool surface, the asyncio/aiohttp concurrency model, stateless JWT authentication, SSE streaming transport, resilience patterns, and the Docker deployment.

Architecture

AI assistantMCP tool call + JWT FastMCP servertool discovery · routing JWT middlewarestateless claims, no DB hit asyncio handlersingle event loop aiohttp proxyconnection pooling Analytics backend7 endpointsall heavy computestays server-side Resiliencecircuit breaker · backoff SSE streamprogressive results Zero data storage — in-memory processing only. Tools are typed (Pydantic I/O), idempotent, and response-size-capped to protect the assistant’s context window.

The tool surface. Eight analytics tools, discoverable at runtime by any MCP host: natural-language query-to-data, ML forecasting, correlation analysis, outlier detection, dataset discovery, schema inspection, metadata retrieval, and result export. Each tool is single-responsibility with typed Pydantic inputs and outputs, safe to retry, and returns natural-language errors an LLM can act on.

Tech stack

FastMCPMCP ProtocolPython 3.13asyncioaiohttpSSEJWTPydantic v2uvDockeruvicorn

Key design decisions & trade-offs

  • asyncio over threading. Coroutines cost ~50KB vs ~8MB per thread — at 100 connections that’s megabytes instead of nearly a gigabyte, with no GIL contention. Trade-off: the server must stay strictly I/O-bound, so all analytics compute is proxied to the backend.
  • Stateless JWT over API keys or mTLS. Short-lived tokens carry user identity and dataset permissions in claims — no session storage, so the server scales horizontally; least-privilege means an assistant can only touch datasets its token allows.
  • SSE over WebSocket. MCP-native, unidirectional server-push matches the request→stream pattern, and it traverses proxies and load balancers without special handling.
  • Circuit breaker + exponential backoff. A slow or down backend gets fast-failed instead of piling up timed-out requests, and retries never hammer a recovering service.
  • FastMCP over the raw SDK. Decorator-based tools with auto-generated schemas from type hints — dramatically less boilerplate across the tool surface.

Results

sub-50ms P95 tool-invocation latency · ~180MB RAM observed at 100 concurrent connections · 8 analytics tools · MIT-licensed

Engineered for 100+ simultaneous connections through non-blocking I/O and connection pooling, with SSE connection lifecycle management and fault-tolerant recovery across network disruptions.