fitness-tracker-mcp
Offline MCP server for logging workouts, tracking dietary macros, and retrieving daily summaries, all stored in local SQLite. Enables fitness tracking via natural language in MCP-compatible clients.
README
🏋️ Fitness Tracker — MCP Server
A fully offline Model Context Protocol server that lets any MCP‑compatible client (Claude Code, Claude Desktop, etc.) log workouts, track dietary macros, and retrieve daily summaries — all stored in a local SQLite database.
| Layer | Technology |
|---|---|
| MCP framework | FastMCP (stdio) |
| Database | SQLite 3 |
| Validation | Pydantic v2 |
| Testing | Pytest |
📂 Project Structure
MCP_Project/
├── server.py # MCP server — tools, schemas, DB logic
├── test_server.py # Pytest suite (22 tests)
├── requirements.txt # pip dependencies
├── README.md # You are here
└── fitness_tracker.db # Created automatically on first run
🚀 Quick Start
1. Install Dependencies
pip install -r requirements.txt
2. Run the Test Suite
pytest test_server.py -v
You should see 22 tests pass, covering:
- ✅ Pydantic schema validation (valid inputs, bad dates, negative numbers, missing fields, SQL injection strings)
- ✅ Database insert and retrieve logic
- ✅ Daily summary aggregation and date isolation
3. Run the Server Standalone (optional)
python server.py
The server starts on stdio — it reads JSON‑RPC from stdin and writes to stdout. You will not see a prompt; this is intended for MCP client consumption.
🔌 Connect to Claude Code
Run this once in your terminal to register the server:
claude mcp add fitness-tracker --transport stdio -- python server.py
Tip: Use the full absolute path to
server.pyif Claude Code is not launched from this directory:claude mcp add fitness-tracker --transport stdio -- python "C:\Users\Mayan\OneDrive\Documents\MCP_Project\server.py"
After registering, Claude Code can call the three tools below whenever you ask fitness-related questions.
🛠️ Exposed Tools
log_workout
Log a single workout session.
| Parameter | Type | Constraint | Example |
|---|---|---|---|
date |
str |
YYYY‑MM‑DD | 2026-08-04 |
type |
str |
1–100 chars | running |
duration |
float |
> 0 (minutes) | 30 |
calories |
float |
≥ 0 | 300 |
log_macros
Log dietary macronutrients for a meal or full day.
| Parameter | Type | Constraint | Example |
|---|---|---|---|
date |
str |
YYYY‑MM‑DD | 2026-08-04 |
protein |
float |
≥ 0 (g) | 150 |
carbs |
float |
≥ 0 (g) | 200 |
fat |
float |
≥ 0 (g) | 60 |
get_daily_summary
Retrieve a combined workout + nutrition summary for a given date.
| Parameter | Type | Constraint | Example |
|---|---|---|---|
date |
str |
YYYY‑MM‑DD | 2026-08-04 |
Returns aggregated totals: workout count, total duration, total calories burned, macro totals (protein / carbs / fat in grams), and estimated calories consumed (using 4 / 4 / 9 kcal per gram).
🔒 Safety
- Parameterised queries — all SQL uses
?placeholders; user input is never interpolated into query strings. - Pydantic validation — every tool input is parsed through a strict schema before touching the database, so malformed LLM outputs fail immediately with a clear error.
- Offline by design — stdio transport means zero network traffic.
📝 License
MIT — use freely.
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.
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.
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.
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.