DB Analytics & Query Platform
A FastAPI-based server that enables executing SQL queries, managing database connections, and retrieving analytics reports through MCP-integrated endpoints. It allows users to interact with database schemas, performance metrics, and access logs using structured queries.
README
DB Analytics + Query Platform (FastAPI)
Project Structure
app/main.py: FastAPI app initialization and router registrationapp/core: config and security helpersapp/db: DB engine/session and initapp/models: SQLAlchemy ORM modelsapp/schemas: Pydantic request/response schemasapp/api/routes: endpoint routesapp/services: business logic servicesapp/mcp: MCP integration stubsalembic: migration configuration
Requirements
- Python 3.10+
- SQLite
Install dependencies:
pip install -r requirements.txt
Local Run
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
Open docs at http://localhost:8000/docs.
Endpoints
POST /api/auth/register: create userPOST /api/auth/token: login and retrieve JWTGET /api/auth/me: get current userPOST /api/connections/test: validate DB connectionPOST /api/connections: save connection (admin only)POST /api/queries/execute: execute SQL queryGET /api/reports/users/total: return user totalGET /api/reports/access-logsGET /api/reports/objects/summaryGET /api/metrics/performanceGET /api/metrics/top-objectsGET /api/metrics/frequencyPOST /api/mcp/run-queryGET /api/mcp/schema
Sample Flow
- Register admin
curl -X POST "http://localhost:8000/api/auth/register" -H "Content-Type: application/json" -d '{"username":"admin","email":"admin@example.com","password":"password","role":"admin"}'
- Get token
curl -X POST "http://localhost:8000/api/auth/token" -H "Content-Type: application/x-www-form-urlencoded" -d "username=admin&password=password"
- Use token for protected endpoints
curl -H "Authorization: Bearer <TOKEN>" "http://localhost:8000/api/reports/users/total"
Expected Register Response
Successful registration returns:
HTTP/1.1 200 OK
{
"id": 1,
"username": "admin",
"email": "admin@example.com",
"role": "admin",
"is_active": true,
"created_at": "2026-03-25T12:34:56.789000"
}
If the user exists:
HTTP/1.1 400 Bad Request
{
"detail": "User already exists"
}
Alembic migrations
alembic revision --autogenerate -m "init"
alembic upgrade head
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.