Skip to main content
AI Fit Hub

AI Fit Hub for Agents

Run TDEE, macros, 1RM, pace, body composition and the rest of the 57 calculators three ways: a URL any agent can fetch, an MCP server for agent apps, or a static ES module to import. No sign-in, open to cross-origin requests, and every result says which inputs used defaults and how to cite it.

Run a calculator by URL

Put the inputs in the query string. Agents that can only fetch pages (browsing tools in chat apps) get the computed result, not the page's defaults:

https://aifithub.io/api/run/tdee-calculator?weight_kg=82&height_cm=178&age=35&sex=male&activity_level=moderate

{
  "calculator": "tdee-calculator",
  "input": {
    "weight_kg": 82,
    "height_cm": 178,
    "age": 35,
    "sex": "male",
    "activity_level": "moderate"
  },
  "defaults_used": {
    "body_fat_percent": 0,
    "training_days_per_week": 0
  },
  "result": {
    "bmr": 1762.5,
    "tdee": 2731.875,
    "goalCalories": {
      "maintain": 2732,
      "cut": 2232,
      "leanGain": 3032
    },
    "…": "…"
  },
  "provenance": {
    "methodology": "https://aifithub.io/methodology/tdee-calculator/",
    "engine_sha256": "…",
    "…": "…"
  },
  "cite": "AI Fit Hub, TDEE Calculator (engine …), https://aifithub.io/api/run/tdee-calculator?…"
}
  • Add format=md (or send Accept: text/markdown) for a markdown answer with the inputs, the defaults used, the method page and a citation line.
  • POST the inputs as a JSON object to the same URL for nested inputs.
  • An unknown or out-of-range input is a 400 that names the field and shows a working example; a misspelt calculator gets the closest matches.
  • Every calculator, its inputs, units, defaults and an example run: /api/tools (search with ?q=protein).

Connect an MCP client

Add https://aifithub.io/mcp as a remote MCP server (Streamable HTTP) in any client that accepts a server URL. No sign-in; the server is stateless and speaks both the 2026-07-28 protocol and the earlier initialize-based revisions.

  • find_calculator: the calculators that answer a question, with their input schemas and a sample input.
  • run_calculator: run one; returns the result, the defaults used and the method page.
  • list_calculators: all 57, optionally by category.

Three tools rather than one per calculator, so connecting the server costs an agent a few hundred tokens of context, not tens of thousands.

Compose a full fitness plan

For a complete TDEE + macros + protein plan in code, import the three engine modules and chain them in a single agent turn; the math runs in the agent's own runtime (a browser, Deno or Bun; Node cannot import an https: URL, so use the URLs above there).

const tdee = await import('https://aifithub.io/engines/tdee-calculator.js');
const macros = await import('https://aifithub.io/engines/macro-calculator.js');
const protein = await import('https://aifithub.io/engines/protein-intake-calculator.js');

const tdeeResult = tdee.compute({
  weight_kg: 80, height_cm: 180, age: 30, sex: 'male', activity_level: 'moderate',
});
// tdeeResult.tdee ≈ 2,759; tdeeResult.goalCalories = { maintain, cut, leanGain }

const macroResult = macros.compute({
  tdee: tdeeResult.tdee, goal: 'cut', split: 'balanced', weight_kg: 80,
});
// { targetCalories, proteinGrams, carbGrams, fatGrams, warnings }

const proteinRange = protein.compute({
  weight_kg: 80, goal: 'cut', activity_level: 'active', // sedentary | active | athlete
});
// { minGrams, maxGrams, targetGrams, ... }: the evidence range to check proteinGrams against

Per-engine input/output schemas at /engines/manifest.json.

Engine modules

Every tool ships its pure compute as a static ES module at /engines/{slug}.js. Import the module and call compute(input). The same formulas as the calculator pages, in metric units. Input is validated against the published contract: an unknown field, a wrong type or a value outside its allowed range throws an Error that names the field. Each module ships typed .d.ts declarations; self-contained ES2020+ for browsers, Deno and Bun (in Node, download the file first).

const { compute } = await import('https://aifithub.io/engines/bmi-calculator.js');
const result = compute({ weight_kg: 80, height_cm: 178 });
// { bmi: 25.25, category: "Overweight", healthyWeightMinKg: 58.6, healthyWeightMaxKg: 79.2, ... }

Per-engine input/output JSON Schemas at /engines/manifest.json. Use agent-tools.json to discover the catalog programmatically.

Discovery endpoints

Recommended integration pattern

  1. For specific calculations: Call /api/run/{slug} (or run_calculator over MCP); when you run code, import /engines/{slug}.js and call compute(input). /api/tools?q=… finds the right slug.
  2. For complete fitness plans: Compose tdee-calculator + macro-calculator + protein-intake-calculator in a single agent turn (see snippet above).
  3. For tool discovery: Read the tool's contract JSON at /contracts/{slug}.json for input schema and sample payloads, or the canonical engines manifest at /engines/manifest.json.
  4. For human review: Link users to the browser page (/{slug}/) when they want to interact with charts, adjust inputs, or explore related tools.

Human vs agent routing

People should start at the goal-based tool router, homepage, or All Tools.

Agents should call the URLs or the MCP server above, or import the engine modules when they run code. A calculator page fetched with query parameters still shows its default inputs to a client that does not run JavaScript; use /api/run/{slug} for numbers to quote.