About Health Information API
Health Information API is a FastAPI application for people building health and nutrition services. It offers calculators for body metrics, daily macros, and food nutrition data.
Key features
- 01BMI calculation
- 02Body frame size estimation
- 03U.S. Navy body fat calculation
- 04Daily calorie and macro targets
- 05Food nutrition lookup via USDA FoodData Central
Use cases
- 01Calculate BMI from height and weight
- 02Estimate body fat percentage from measurements
- 03Plan daily calorie and macronutrient targets
- 04Total nutrition values for recipe ingredients
MCP support
The application uses FastAPI-MCP to provide its health and nutrition calculators to MCP clients.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEHealth Information API
A FastAPI application that provides various health and nutrition calculators using FastAPI-MCP.
Features
- BMI Calculator
- Body Frame Size Calculator
- Body Fat Percentage Calculator (U.S. Navy Method)
- Macronutrient Calculator
- Food Nutrition Calculator (using USDA FoodData Central API)
Installation
- Clone the repository:
git clone https://github.com/yourusername/bmi_calc.git
cd bmi_calc
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables:
# For the USDA FoodData Central API
# Get your API key from https://fdc.nal.usda.gov/api-key-signup.html
export USDA_API_KEY="your_api_key_here"
# (Optional) For the OpenAI API
export OPENAI_API_KEY="your_api_key_here"
Running the Application
uvicorn main:app --reload
The API will be available at http://localhost:8000
API Documentation
Once the application is running, you can access the interactive API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
API Endpoints
BMI Calculator
Endpoint: POST /bmi
Calculate Body Mass Index (BMI) based on weight and height.
Request Body:
{
"weight_kg": 70,
"height_cm": 175
}
Response:
{
"bmi": 22.86,
"category": "Normal weight"
}
Body Frame Size Calculator
Endpoint: POST /body-frame
Determine body frame size based on wrist circumference and height.
Request Body:
{
"wrist_circumference_cm": 18,
"height_cm": 180,
"gender": "male"
}
Response:
{
"frame_size": "MEDIUM"
}
Body Fat Percentage Calculator
Endpoint: POST /body-fat
Calculate body fat percentage using the U.S. Navy method.
Request Body (Male):
{
"gender": "male",
"age": 30,
"weight_kg": 80,
"height_cm": 180,
"neck_circumference_cm": 38,
"waist_circumference_cm": 85
}
Request Body (Female):
{
"gender": "female",
"age": 30,
"weight_kg": 65,
"height_cm": 165,
"neck_circumference_cm": 32,
"waist_circumference_cm": 70,
"hip_circumference_cm": 95
}
Response:
{
"body_fat_percentage": 15.3,
"category": "Fitness"
}
Macronutrient Calculator
Endpoint: POST /macros
Calculate daily calorie and macronutrient targets.
Request Body:
{
"gender": "male",
"age": 30,
"weight_kg": 80,
"height_cm": 180,
"activity_level": "moderate",
"goal": "maintain",
"body_fat_percentage": 15
}
Response:
{
"calories": 2800,
"protein_g": 122,
"carbs_g": 350,
"fat_g": 78
}
Food Nutrition Calculator
Endpoint: GET /food-nutrition
Calculate the nutritional content of a list of food ingredients and amounts.
Query Parameters:
ingredients: List of food ingredients (e.g., 'apple', 'chicken breast')amounts: List of amounts in grams corresponding to each ingredient
Example Request:
GET /food-nutrition?ingredients=apple&ingredients=chicken%20breast&amounts=100&amounts=150
Response:
{
"total_calories": 278.5,
"total_protein_g": 31.45,
"total_carbs_g": 14.8,
"total_fat_g": 8.7,
"total_fiber_g": 2.4,
"total_sugar_g": 10.4,
"foods": [
{
"name": "Apple, raw",
"amount_g": 100,
"calories": 52,
"protein_g": 0.3,
"carbs_g": 13.8,
"fat_g": 0.2,
"fiber_g": 2.4,
"sugar_g": 10.4
},
{
"name": "Chicken, breast, meat only, cooked, roasted",
"amount_g": 150,
"calories": 226.5,
"protein_g": 31.15,
"carbs_g": 1,
"fat_g": 8.5,
"fiber_g": 0,
"sugar_g": 0
}
]
}
Running Tests
pytest -v
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.