Sponsored by Deepsite.site

Health Information API

Created By
sryno7 months ago
Simple MCP server to provide health related metrics
Content

Health 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

  1. Clone the repository:
git clone https://github.com/yourusername/bmi_calc.git
cd bmi_calc
  1. Install dependencies:
pip install -r requirements.txt
  1. 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:

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

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Serper MCP ServerA Serper MCP Server
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Amap Maps高德地图官方 MCP Server
DeepChatYour AI Partner on Desktop
ChatWiseThe second fastest AI chatbot™
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
WindsurfThe new purpose-built IDE to harness magic
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Playwright McpPlaywright MCP server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
CursorThe AI Code Editor
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Tavily Mcp
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors