pierre_mcp_server
pierre_mcp_server copied to clipboard
MCP/A2A/Rest Fitness Intelligence platform.
Pierre Fitness Platform
Pierre Fitness Platform connects AI assistants to fitness data from Strava, Garmin, Fitbit, WHOOP, and Terra (150+ wearables). Implements Model Context Protocol (MCP), A2A protocol, OAuth 2.0, and REST APIs for Claude, ChatGPT, and other AI assistants.
Intelligence System
Sports science-based fitness analysis:
- Training Load: TSS, CTL (42-day fitness), ATL (7-day fatigue), TSB (form)
- Race Predictions: VDOT (Jack Daniels), Riegel formula
- Sleep & Recovery: NSF/AASM scoring, HRV-based recovery, TSB normalization
- Nutrition: Mifflin-St Jeor BMR, TDEE, macros, USDA FoodData Central (350k+ foods)
- Pattern Detection: Training consistency, hard/easy alternation, volume progression
- Configurable Algorithms: Runtime selection via environment variables
See Intelligence Methodology and Nutrition Methodology.
Features
- MCP Protocol: JSON-RPC 2.0 for AI assistant integration
- A2A Protocol: Agent-to-agent communication
- OAuth 2.0 Server: RFC 7591 dynamic client registration
- 47 MCP Tools: Activities, goals, analysis, sleep, recovery, nutrition, recipes, configuration
- TypeScript SDK:
pierre-mcp-clientnpm package - Pluggable Providers: Compile-time provider selection
- TOON Format: Token-Oriented Object Notation output for ~40% LLM token reduction (spec)
Provider Support
| Provider | Feature Flag | Capabilities |
|---|---|---|
| Strava | provider-strava |
Activities, Stats, Routes |
| Garmin | provider-garmin |
Activities, Sleep, Health |
| WHOOP | provider-whoop |
Sleep, Recovery, Strain |
| Fitbit | provider-fitbit |
Activities, Sleep, Health |
| Terra | provider-terra |
150+ wearables, Activities, Sleep, Health |
| Synthetic | provider-synthetic |
Development/Testing |
Build with specific providers:
cargo build --release # all providers
cargo build --release --no-default-features --features "sqlite,provider-strava" # strava only
See Pluggable Provider Architecture.
LLM Interaction
AI assistants query fitness data through natural language:
| Request | Tools Used |
|---|---|
| "Calculate my daily nutrition needs for marathon training" | calculate_daily_nutrition, get_nutrient_timing, search_food |
| "Get my last 10 activities and analyze training load" | get_activities, analyze_training_load, calculate_daily_nutrition |
| "Compare my three longest runs this month" | get_activities, compare_activities, analyze_performance_trends |
| "Analyze this meal: 150g chicken, 200g rice, 100g broccoli" | analyze_meal_nutrition, get_food_details |
| "Do I need a recovery day based on my training load?" | analyze_training_load, get_activities, generate_recommendations |
Quick Start
git clone https://github.com/Async-IO/pierre_mcp_server.git
cd pierre_mcp_server
cp .envrc.example .envrc # edit with your settings
direnv allow # or: source .envrc
./bin/setup-and-start.sh # complete setup: fresh DB, admin user, server start
Server starts on http://localhost:8081. See Getting Started for detailed setup.
MCP Client Configuration
Add to Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"pierre-fitness": {
"command": "npx",
"args": ["-y", "pierre-mcp-client@next", "--server", "http://localhost:8081"]
}
}
}
The SDK handles OAuth 2.0 authentication automatically. See SDK Documentation.
Available MCP Tools
47 tools organized in 8 categories:
| Category | Tools | Description |
|---|---|---|
| Core Fitness | 6 | Activities, athlete profile, provider connections |
| Goals | 4 | Goal setting, suggestions, feasibility, progress |
| Analysis | 10 | Metrics, trends, patterns, predictions, recommendations |
| Sleep & Recovery | 5 | Sleep quality, recovery score, rest recommendations |
| Nutrition | 5 | BMR/TDEE, macros, USDA food search, meal analysis |
| Recipes | 7 | Training-aware meal planning and recipe storage |
| Configuration | 6 | User settings, training zones, profiles |
| Fitness Config | 4 | Fitness parameters, thresholds |
Full tool reference: docs/tools-reference.md
Server Management
./bin/setup-and-start.sh # complete setup: fresh DB, admin user, server start
./bin/start-server.sh # start backend only (loads .envrc)
./bin/stop-server.sh # stop backend
./bin/start-frontend.sh # start dashboard (http://localhost:5173)
Options for setup-and-start.sh:
--skip-fresh-start- preserve existing database--run-tests- run workflow tests after startup--admin-email EMAIL- custom admin email--admin-password PWD- custom admin password
User Portal Dashboard
Web-based dashboard for users and administrators at http://localhost:5173.
Features
- Role-Based Access: super_admin, admin, user roles with permission hierarchy
- User Registration: Self-registration with admin approval workflow
- API Key Management: Create, view, deactivate API keys
- MCP Tokens: Generate tokens for Claude Desktop and AI assistants
- Usage Analytics: Request patterns, tool usage charts
- Super Admin Impersonation: View dashboard as any user for support
User Roles
| Role | Capabilities |
|---|---|
| User | Own API keys, MCP tokens, analytics |
| Admin | + User approval, all users analytics |
| Super Admin | + Impersonation, admin tokens, system config |
First Admin Setup
cargo run --bin admin-setup -- create-admin-user \
--email [email protected] \
--password SecurePassword123 \
--super-admin
See Frontend Documentation for detailed dashboard documentation.
Documentation
Reference
- Getting Started - installation, configuration, first run
- Architecture - system design, components, request flow
- Protocols - MCP, OAuth2, A2A, REST
- Authentication - JWT, API keys, OAuth2 flows
- Configuration - environment variables, algorithms
Development
- Development Guide - workflow, dashboard, testing
- Scripts Reference - 30+ development scripts
- CI/CD - GitHub Actions, pipelines
- Contributing - code standards, PR workflow
Learning
- Tutorial (31 chapters) - comprehensive Rust learning path
Components
- SDK - TypeScript client for MCP integration
- Frontend - React dashboard
Methodology
- Intelligence - sports science formulas
- Nutrition - dietary calculations
Testing
cargo test # all tests
./scripts/lint-and-test.sh # full CI suite
./scripts/smoke-test.sh # quick validation (~3 min)
See Testing Documentation.
Contributing
See Contributing Guide.
License
Dual-licensed under Apache 2.0 or MIT.