Content
# KPI Dashboard MCP Server
An intelligent KPI Dashboard server built on FastAPI and FastMCP.
It supports local data analysis and agent interaction, suitable for enterprise operations, business monitoring, intelligent analysis, and other scenarios.
---
## 🌟 Project Highlights
- ✅ Lightweight and high-performance HTTP interface built with FastAPI
- 🤖 Integrated FastMCP Server, supports intelligent dialogue with MCP clients (such as Cherry Studio)
- 📊 Built-in data analysis module, no external database or CSV files required
- 🔧 Supports local development debugging and VS Code plugin usage
---
## 📁 Project Structure
```
kpi-dashboard-mcp-server/
│
├── api.py # Provides APIs related to data analysis
├── helper.py # Data analysis utility functions (e.g., KPI calculation)
├── main.py # Starts the MCP Server service
├── data.py # Built-in simulated data, replaces CSV loading
├── requirements.txt # Required Python dependencies
└── README.md # Project documentation
```
---
## 🚀 Quick Start
### 1. Clone the Repository
```bash
git clone https://github.com/zhangting-hit/mcp_demo.git
cd mcp_demo
```
### 2. Create a Virtual Environment (Optional)
```bash
python -m venv venv
# macOS/Linux:
source venv/bin/activate
# Windows:
venv\Scripts\activate
```
### 3. Install Dependencies
```bash
pip install -r requirements.txt
```
---
## ▶️ Start the Service
### Start the API Service (default port `8000`)
```bash
python api.py
```
Access the documentation at:
* [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs)
### Start the MCP Server Service (default port `8080`)
```bash
python main.py
```
After starting, the output will be:
```
FastMCP Server is running at http://localhost:8080
```
> Example Screenshots
> 
> 
---
## 🔗 Connect MCP Server in Cherry Studio
1. Open Cherry Studio
2. Go to Settings → Add MCP Service Configuration
3. Use the following content:
```json
{
"name": "KPI Analysis Agent",
"command": "D:\\Anaconda\\envs\\mcp\\python.exe",
"args": [
"D:/Users/Desktop/mcp_demo/main.py"
],
"env": {
"PYTHONUNBUFFERED": "1"
}
}
```
Once connected successfully, you can converse with the Agent through Cherry.
> 
---
## 📡 API Interface Description
### `GET /kpi/summary`
Returns the KPI summary results.
#### Example Response:
```json
{
"total_sales": 150000,
"conversion_rate": 0.035,
"active_users": 3421
}
```
---
## 💡 Example: Adding New KPI Analysis Logic
Add the following in `helper.py`:
```python
def calculate_average_order_value(sales_data):
return sum(s["amount"] for s in sales_data) / len(sales_data)
```
Then use it in the `/kpi/summary` endpoint in `api.py`.
---
## 📚 Tech Stack
* [FastAPI](https://fastapi.tiangolo.com/)
* [FastMCP](https://github.com/zhplus/fastmcp)
* Python 3.8+
---
## 📌 Frequently Asked Questions
### Q: Accessing `http://127.0.0.1:8000/` shows 404?
A: Accessing the root path directly will return 404. Please use the following paths:
* [http://127.0.0.1:8000/kpi/summary](http://127.0.0.1:8000/kpi/summary)
* [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs)
---
## 🧑💻 Developer Suggestions
* You can replace `data.py` with a database or external API data source
* MCP Server supports extending context memory, chart output, and multi-turn Q&A
* Can be used to build embedded knowledge bases, BI platforms, customer operation analysis systems, etc.
---
## 📄 License
MIT License
Connection Info
You Might Also Like
markitdown
Python tool for converting files and office documents to Markdown.
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
TrendRadar
TrendRadar: Your hotspot assistant for real news in just 30 seconds.
mempalace
The highest-scoring AI memory system ever benchmarked. And it's free.
mempalace
The highest-scoring AI memory system ever benchmarked. And it's free.