Sales Analytics MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Sales Analytics MCP ServerWhat tables are available, and are there any sales anomalies I should know about?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Sales Analytics MCP Server
A custom Model Context Protocol (MCP) server that gives Claude Desktop direct, safe access to a live sales database — turning a Python analytics backend into a reusable tool any MCP-compatible AI assistant can use, without writing a single integration per application.
What is MCP, and why build a server for it
Model Context Protocol is an open standard (created by Anthropic) that lets AI assistants connect to external tools and data sources through a common interface, instead of every assistant needing a custom-built integration for every tool. Writing an MCP server means building the connection once, per data source — and any MCP-compatible client (Claude Desktop, Claude Code, or other MCP-aware applications) can use it immediately, with no per-application rework.
This project exposes a real PostgreSQL sales database (the same one used in ai-analytics-agent) as a set of MCP tools, so Claude can query it, inspect its schema, and run anomaly detection — directly inside a normal conversation.
Related MCP server: pg-mcp
Architecture
graph LR
A[Claude Desktop] -->|MCP protocol| B[Sales Analytics<br/>MCP Server]
B --> C[get_database_schema]
B --> D[run_sql_query]
B --> E[find_sales_anomalies]
C --> F[(Supabase / PostgreSQL)]
D --> F
E --> FTools exposed
Tool | Description |
| Returns available tables and columns, so Claude knows what data exists before querying |
| Executes a read-only SQL query and returns results. Blocks any query that isn't |
| Runs a robust median/MAD-based anomaly detection pass over daily sales history and returns flagged dates with their statistical deviation |
Tech Stack
Layer | Tool |
Protocol | Model Context Protocol (MCP) Python SDK |
Client | Claude Desktop |
Database | PostgreSQL (Supabase) |
Query layer | SQLAlchemy |
Anomaly detection | Pandas (median + MAD, rolling window) |
Secrets | python-dotenv |
Engineering notes
Caught a breaking SDK change mid-development: the MCP Python SDK shipped a major version (2.0.0) that renamed
FastMCPtoMCPServerand moved its import path, right as this project was being built. The server was updated to the new API rather than pinning an older version, so the code reflects the current SDK surface.Claude chooses its own tool strategy: when asked to find anomalies before
find_sales_anomaliesexisted, Claude independently usedrun_sql_queryto investigate — checking for duplicate rows, negative amounts, and per-category breakdowns on its own initiative, arriving at the same root cause the dedicated tool later confirmed. This is a useful illustration of how an LLM client actually chooses between a general-purpose tool and a specialized one, rather than always preferring the "obvious" dedicated function.Same safety model as the Text-to-SQL agent:
run_sql_queryreuses the same read-only guardrail approach as the Python-based Text-to-SQL project — a good example of why building that safety logic once, carefully, pays off when it's reused in a second, independent tool.
Setup
Install dependencies: pip install -r requirements.txt
Create a
.envfile with: DATABASE_URL=your_postgresql_connection_stringAdd the server to Claude Desktop's config file (
claude_desktop_config.json):
{
"mcpServers": {
"sales-analytics": {
"command": "python",
"args": ["/full/path/to/server.py"]
}
}
}Fully restart Claude Desktop (quit via Task Manager / Activity Monitor, not just closing the window)
Start a new chat and ask Claude something like:
"What tables are available, and are there any sales anomalies I should know about?"
Example interaction

This server cannot be installed
Maintenance
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
- FlicenseDqualityDmaintenanceA secure Model Context Protocol server that allows Claude to execute read-only SQL queries against a PostgreSQL database, enabling natural language interaction with database data.1
- FlicenseNot gradedqualityDmaintenanceEnables natural language querying of PostgreSQL databases through the Model Context Protocol. It translates user questions into validated SQL, executes read-only queries safely, and returns results to MCP-compatible clients like Claude Desktop.
- AlicenseAqualityAmaintenanceQuery and manage PostgreSQL databases from Claude Code, Cursor, and any MCP client, with read-only by default and built-in schema introspection, EXPLAIN, and performance diagnostics.211,8093MIT
- AlicenseAqualityBmaintenanceExposes PostgreSQL query execution, EXPLAIN, and schema inspection tools to MCP-compatible clients like Claude Desktop.31MIT
Related MCP Connectors
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Hosted Amazon Seller Central and Amazon Ads MCP server for Claude, ChatGPT, Cursor, and agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/AleksandrGeraskov/mcp-sales-analytics-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server