Statistics 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., "@Statistics MCP Servershow me total sales"
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.
Statistics MCP Server
A Model Context Protocol (MCP) server that provides statistical analysis tools for sales and salary data. This server exposes business intelligence functions that can be used by AI assistants and other MCP-compatible clients.
๐ Features
Sales Analytics: Calculate total sales, find popular products, and analyze order patterns
Product Intelligence: Identify most ordered products and highest value orders
Salary Statistics: Compute salary metrics including averages, min/max values
MCP Compatible: Works with Claude Desktop and other MCP clients
TypeScript: Full type safety and modern development experience
NestJS Framework: Built with enterprise-grade Node.js framework
Related MCP server: MCP Data Wrangler
๐ Available Tools
Tool Name | Description | Parameters |
| Calculate total sales amount from all orders | None |
| Get the most frequently ordered product | None |
| Get product with highest total quantity | None |
| Get order with the highest total amount | None |
| Get salary analytics (average, min, max) | None |
๐๏ธ Project Structure
mcp-server/
โโโ src/
โ โโโ statistics/
โ โ โโโ statistics.service.ts # Business logic and data operations
โ โ โโโ statistics.controller.ts # REST API endpoints (NestJS)
โ โ โโโ statistics.module.ts # NestJS module configuration
โ โ โโโ statistics.types.ts # TypeScript interfaces
โ โโโ mcp/
โ โ โโโ mcp-server.ts # MCP server implementation
โ โโโ mcp-main.ts # MCP server entry point
โ โโโ main.ts # NestJS application entry point
โ โโโ app.* # NestJS app configuration
โโโ test/ # E2E tests
โโโ dist/ # Compiled JavaScript output
โโโ mcp-config.json # MCP client configuration
โโโ package.json # Dependencies and scripts
โโโ README.md # This file๐ ๏ธ Technology Stack
Runtime: Node.js
Language: TypeScript
Framework: NestJS
Protocol: Model Context Protocol (MCP)
Testing: Jest
Linting: ESLint
๐ Prerequisites
Node.js (v18 or higher)
npm or yarn package manager
โก Quick Start
1. Install Dependencies
npm install2. Build the Project
npm run build3. Start MCP Server
npm run start:mcp
# or directly:
node dist/mcp-main.js4. Start NestJS Server (Alternative)
npm run start
# Development mode:
npm run start:dev๐ง Configuration
MCP Client Configuration
Add this configuration to your MCP client (e.g., Claude Desktop):
{
"mcpServers": {
"statistics-server": {
"command": "node",
"args": ["/home/mamun/official/mcp-server/dist/mcp-main.js"],
"env": {}
}
}
}For Claude Desktop
Add to ~/.config/claude-desktop/claude_desktop_config.json (Linux):
{
"mcpServers": {
"statistics-server": {
"command": "node",
"args": ["/home/mamun/official/mcp-server/dist/mcp-main.js"],
"env": {}
}
}
}๐งช Testing
Run Unit Tests
npm run testRun E2E Tests
npm run test:e2eTest with MCP Inspector
npx @modelcontextprotocol/inspector dist/mcp-main.js๐ก API Endpoints (NestJS)
The server also provides REST API endpoints:
Method | Endpoint | Description |
GET |
| Get total sales amount |
GET |
| Get most popular product |
GET |
| Get most ordered product |
GET |
| Get highest order amount |
GET |
| Get salary statistics |
Example API Usage
# Start the NestJS server
npm run start
# Make API requests
curl http://localhost:3000/statistics/total-sales
curl http://localhost:3000/statistics/popular-product๐ MCP Protocol Flow
1. AI Client connects to MCP server
2. Client requests available tools
3. Server responds with tool definitions
4. Client calls a specific tool (e.g., "get_total_sales")
5. Server executes the corresponding service method
6. Server returns structured result
7. AI uses the result in its response to user๐ Sample Data
The server includes sample data for demonstration:
Products
Laptop ($999.99)
Mouse ($24.99)
Keyboard ($79.99)
Monitor ($299.99)
Headphones ($149.99)
Orders
Multiple orders with different products and quantities
Total sales calculation across all orders
Salaries
Sample employee salary data for statistical analysis
๐ Development
Development Mode
npm run start:devBuild for Production
npm run build
npm run start:prodLinting
npm run lint
npm run lint:fix๐ง Available Scripts
Script | Description |
| Compile TypeScript to JavaScript |
| Start the NestJS application |
| Start in development mode with hot reload |
| Start in debug mode |
| Start in production mode |
| Start the MCP server |
| Run ESLint |
| Run unit tests |
| Run tests in watch mode |
| Run end-to-end tests |
๐ Best Practices Implemented
Separation of Concerns: Business logic in services, MCP logic in dedicated server
Type Safety: Full TypeScript implementation with proper interfaces
Error Handling: Comprehensive error handling in MCP tools
Validation: Input validation for all operations
Documentation: Clear documentation and examples
Testing: Unit and E2E test setup
Code Quality: ESLint configuration for consistent code style
๐ค Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
๐ License
This project is licensed under the MIT License.
๐ Support
For questions and support:
Create an issue in the repository
Check the MCP Documentation
Review the NestJS Documentation
๐ฏ What You've Learned
By studying this project, you now understand:
โ MCP Basics: What MCP is and how it works
โ Server Architecture: How to structure an MCP server project
โ Tool Implementation: How to expose business logic as MCP tools
โ Client Integration: How AI clients connect and use your tools
โ TypeScript Development: Modern TypeScript with NestJS
โ Testing: How to test MCP servers
โ Deployment: How to build and deploy MCP servers
๐ Next Steps
Add Authentication: Implement security for your MCP server
Database Integration: Connect to real databases instead of sample data
More Tools: Add additional statistical analysis tools
Resources: Implement MCP resources for file/data access
Prompts: Add MCP prompts for AI interaction templates
Production Deployment: Deploy to cloud platforms
Monitoring: Add logging and monitoring capabilities
Happy coding! ๐
This MCP server demonstrates a complete implementation from zero to hero. Use it as a foundation for building your own MCP servers!
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.
Latest Blog Posts
- 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/MamunCrafts/mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server