wimsta-mcp 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +61 -2
- package/index.js +112 -0
- package/package.json +19 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 WIMSTA
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,62 @@
|
|
|
1
|
-
#
|
|
1
|
+
# WIMSTA MCP server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Evidence-based body calculators for AI assistants. Ask Claude, Cursor or any
|
|
4
|
+
[MCP](https://modelcontextprotocol.io) client for your BMI, body-fat %, calorie needs or max heart
|
|
5
|
+
rate and get **a range across published formulas, not one made-up number**, with the formulas,
|
|
6
|
+
their original studies and a medical disclaimer.
|
|
7
|
+
|
|
8
|
+
Results come from the public [WIMSTA Calculation API](https://wimsta.com/tools/#calculation-api),
|
|
9
|
+
so they always match the calculators on [wimsta.com](https://wimsta.com). No API key, no account, no tracking.
|
|
10
|
+
|
|
11
|
+
## Tools
|
|
12
|
+
|
|
13
|
+
| Tool | What it returns |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `bmi` | BMI range: classic Quetelet + Trefethen "new BMI", WHO category |
|
|
16
|
+
| `body_fat` | Body-fat % range across Deurenberg, CUN-BAE, US Navy, RFM, Covert Bailey (whatever your measurements allow), Gallagher category |
|
|
17
|
+
| `bmr` | Basal metabolic rate range: Mifflin–St Jeor, Harris–Benedict 1984/1919, WHO/FAO, Katch–McArdle |
|
|
18
|
+
| `tdee` | Maintenance calories (TDEE) range for an activity level |
|
|
19
|
+
| `max_heart_rate` | Max heart rate range across nine formulas + five training zones |
|
|
20
|
+
| `waist_to_height` | Waist-to-height ratio, Ashwell zone, healthy waist range |
|
|
21
|
+
| `get_formula` | One formula from the open [WIMSTA formula registry](https://wimsta.com/registry/) (CC BY 4.0): equation, citation, validation population, limitations |
|
|
22
|
+
| `list_formulas` | Registry index, or all formulas of a category |
|
|
23
|
+
|
|
24
|
+
Metric units (kg, cm), adults 18–100.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
Claude Desktop / Claude Code / Cursor (`mcpServers` config):
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"mcpServers": {
|
|
33
|
+
"wimsta": { "command": "npx", "args": ["-y", "wimsta-mcp"] }
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Claude Code: `claude mcp add wimsta -- npx -y wimsta-mcp`
|
|
39
|
+
|
|
40
|
+
Requires Node.js 18+.
|
|
41
|
+
|
|
42
|
+
## Example
|
|
43
|
+
|
|
44
|
+
> "I'm a 35-year-old woman, 168 cm, 65 kg, moderately active. How many calories do I burn a day?"
|
|
45
|
+
|
|
46
|
+
The assistant calls `tdee` and answers with a range (about 2,100–2,200 kcal/day), names the
|
|
47
|
+
formulas behind it and links to each one.
|
|
48
|
+
|
|
49
|
+
## Why ranges
|
|
50
|
+
|
|
51
|
+
Every body-composition and energy formula was fitted on a particular population and carries an
|
|
52
|
+
error of several percent. Showing the spread between validated equations is more honest than
|
|
53
|
+
picking one. See the [WIMSTA methodology](https://wimsta.com/registry/).
|
|
54
|
+
|
|
55
|
+
## Disclaimer
|
|
56
|
+
|
|
57
|
+
Estimates, not diagnoses. These tools are for general information and are not a substitute for
|
|
58
|
+
professional medical advice. Talk to a doctor before acting on any result.
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
Code: MIT. Formula registry data: CC BY 4.0, cite as "WIMSTA (wimsta.com)".
|
package/index.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// WIMSTA MCP server: evidence-based body calculators (BMI, body fat, BMR, TDEE,
|
|
3
|
+
// max heart rate, waist-to-height) and the open WIMSTA formula registry.
|
|
4
|
+
// Every number comes from the public WIMSTA Calculation API (https://wimsta.com/tools/#calculation-api),
|
|
5
|
+
// so results always match the calculators on wimsta.com. No API key, no tracking.
|
|
6
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { readFileSync } from 'node:fs';
|
|
10
|
+
|
|
11
|
+
const BASE = (process.env.WIMSTA_BASE_URL || 'https://wimsta.com').replace(/\/$/, '');
|
|
12
|
+
const { version } = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'));
|
|
13
|
+
const UA = `wimsta-mcp/${version} (+https://github.com/getwimsta/wimsta-mcp)`;
|
|
14
|
+
|
|
15
|
+
async function call(path, params = {}) {
|
|
16
|
+
const qs = new URLSearchParams();
|
|
17
|
+
for (const [k, v] of Object.entries(params)) if (v !== undefined && v !== null) qs.set(k, String(v));
|
|
18
|
+
const url = `${BASE}${path}${qs.size ? `?${qs}` : ''}`;
|
|
19
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
20
|
+
const res = await fetch(url, { headers: { 'User-Agent': UA, Accept: 'application/json' } });
|
|
21
|
+
if (res.status === 429 && attempt < 2) {
|
|
22
|
+
const wait = Math.min(Number(res.headers.get('retry-after')) || 1, 5);
|
|
23
|
+
await new Promise((r) => setTimeout(r, wait * 1000 + 250));
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const text = await res.text();
|
|
27
|
+
let body;
|
|
28
|
+
try { body = JSON.parse(text); } catch { body = { error: text.slice(0, 300) }; }
|
|
29
|
+
return { ok: res.ok, status: res.status, body };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const asResult = ({ ok, status, body }) => ({
|
|
34
|
+
isError: !ok,
|
|
35
|
+
content: [{ type: 'text', text: ok ? JSON.stringify(body, null, 2) : `WIMSTA API error ${status}: ${body.error || JSON.stringify(body)}` }],
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const sex = z.enum(['female', 'male']).describe('Biological sex used by the published equations');
|
|
39
|
+
const weight = z.number().min(20).max(350).describe('Body weight in kilograms');
|
|
40
|
+
const height = z.number().min(100).max(250).describe('Height in centimetres');
|
|
41
|
+
const age = z.number().int().min(18).max(100).describe('Age in years (adults only)');
|
|
42
|
+
const cm = (lo, hi, what) => z.number().min(lo).max(hi).optional().describe(`${what}, centimetres`);
|
|
43
|
+
|
|
44
|
+
const server = new McpServer({ name: 'wimsta', version });
|
|
45
|
+
|
|
46
|
+
const NOTE = ' Returns a range across several published formulas (not one number), the formulas used with links, and a medical disclaimer. Estimates, not diagnoses.';
|
|
47
|
+
|
|
48
|
+
server.registerTool('bmi', {
|
|
49
|
+
title: 'BMI (range)',
|
|
50
|
+
description: 'Body Mass Index as a range: classic Quetelet BMI and Trefethen "new BMI", with the WHO category.' + NOTE,
|
|
51
|
+
inputSchema: { weight_kg: weight, height_cm: height },
|
|
52
|
+
}, async (a) => asResult(await call('/api/calc/bmi', a)));
|
|
53
|
+
|
|
54
|
+
server.registerTool('body_fat', {
|
|
55
|
+
title: 'Body fat % (range)',
|
|
56
|
+
description: 'Body-fat percentage as a range across every validated formula the given measurements allow (Deurenberg, CUN-BAE, US Navy, RFM, Covert Bailey), with the Gallagher category. Give as many optional measurements as you have.' + NOTE,
|
|
57
|
+
inputSchema: {
|
|
58
|
+
sex, height_cm: height,
|
|
59
|
+
weight_kg: weight.optional(), age: age.optional(),
|
|
60
|
+
waist_cm: cm(45, 160, 'Natural waist'),
|
|
61
|
+
abdomen_cm: cm(50, 170, 'Abdomen at the navel (US Navy, men)'),
|
|
62
|
+
neck_cm: cm(20, 60, 'Neck'), hip_cm: cm(60, 180, 'Hips'),
|
|
63
|
+
wrist_cm: cm(10, 25, 'Wrist'), forearm_cm: cm(15, 45, 'Forearm'),
|
|
64
|
+
thigh_cm: cm(30, 90, 'Thigh'), calf_cm: cm(20, 60, 'Calf'),
|
|
65
|
+
},
|
|
66
|
+
}, async (a) => asResult(await call('/api/calc/body-fat', a)));
|
|
67
|
+
|
|
68
|
+
const bmrShape = {
|
|
69
|
+
sex, weight_kg: weight, height_cm: height, age,
|
|
70
|
+
body_fat_pct: z.number().min(3).max(65).optional().describe('Body-fat %, if known (adds Katch–McArdle)'),
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
server.registerTool('bmr', {
|
|
74
|
+
title: 'Basal metabolic rate (range)',
|
|
75
|
+
description: 'Basal metabolic rate in kcal/day as a range: Mifflin–St Jeor, Harris–Benedict 1984 and 1919, WHO/FAO, plus Katch–McArdle when body-fat % is given.' + NOTE,
|
|
76
|
+
inputSchema: bmrShape,
|
|
77
|
+
}, async (a) => asResult(await call('/api/calc/bmr', a)));
|
|
78
|
+
|
|
79
|
+
server.registerTool('tdee', {
|
|
80
|
+
title: 'Daily calorie needs / TDEE (range)',
|
|
81
|
+
description: 'Total daily energy expenditure (maintenance calories, kcal/day) = the BMR range × an activity multiplier.' + NOTE,
|
|
82
|
+
inputSchema: {
|
|
83
|
+
...bmrShape,
|
|
84
|
+
activity: z.enum(['sedentary', 'light', 'moderate', 'extra', 'extreme']).describe('Activity level'),
|
|
85
|
+
},
|
|
86
|
+
}, async (a) => asResult(await call('/api/calc/tdee', a)));
|
|
87
|
+
|
|
88
|
+
server.registerTool('max_heart_rate', {
|
|
89
|
+
title: 'Maximum heart rate and training zones',
|
|
90
|
+
description: 'Maximum heart rate (bpm) as a range across nine published formulas (Fox, Tanaka, Gulati, Gellish, Nes and others) plus five training zones.' + NOTE,
|
|
91
|
+
inputSchema: { age, sex: sex.optional() },
|
|
92
|
+
}, async (a) => asResult(await call('/api/calc/max-heart-rate', a)));
|
|
93
|
+
|
|
94
|
+
server.registerTool('waist_to_height', {
|
|
95
|
+
title: 'Waist-to-height ratio',
|
|
96
|
+
description: 'Waist-to-height ratio (a measurement, not an estimate) with the Ashwell zone and the healthy waist range for the given height. Includes a medical disclaimer.',
|
|
97
|
+
inputSchema: { waist_cm: z.number().min(45).max(160).describe('Natural waist, centimetres'), height_cm: height },
|
|
98
|
+
}, async (a) => asResult(await call('/api/calc/waist-to-height', a)));
|
|
99
|
+
|
|
100
|
+
server.registerTool('get_formula', {
|
|
101
|
+
title: 'Look up a formula in the WIMSTA registry',
|
|
102
|
+
description: 'Get one formula from the open WIMSTA formula registry (CC BY 4.0): equation, original study citation, population it was validated on, known limitations. Call list_formulas first to find ids.',
|
|
103
|
+
inputSchema: { id: z.string().min(1).describe('Formula id, e.g. "cun-bae", "tanaka", "harris-benedict-1984"') },
|
|
104
|
+
}, async ({ id }) => asResult(await call('/api/formulas', { id })));
|
|
105
|
+
|
|
106
|
+
server.registerTool('list_formulas', {
|
|
107
|
+
title: 'List formulas in the WIMSTA registry',
|
|
108
|
+
description: 'List the formulas in the open WIMSTA formula registry (CC BY 4.0), optionally filtered by category. Without a category returns the index of ids and categories.',
|
|
109
|
+
inputSchema: { category: z.string().optional().describe('Category to filter by, one of body-fat, body-fat-ranges, bmi, waist-to-height, max-heart-rate, bmr; omit for the full index') },
|
|
110
|
+
}, async ({ category }) => asResult(await call('/api/formulas', { category })));
|
|
111
|
+
|
|
112
|
+
await server.connect(new StdioServerTransport());
|
package/package.json
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wimsta-mcp",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP server for evidence-based body calculators: BMI, body fat %, BMR, TDEE, max heart rate and waist-to-height as honest ranges across published formulas, plus the open WIMSTA formula registry. No API key.",
|
|
5
|
+
"mcpName": "io.github.getwimsta/wimsta",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": { "wimsta-mcp": "index.js" },
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"files": ["index.js", "README.md", "LICENSE"],
|
|
10
|
+
"engines": { "node": ">=18" },
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
13
|
+
"zod": "^4.0.0"
|
|
14
|
+
},
|
|
15
|
+
"keywords": ["mcp", "model-context-protocol", "bmi", "body-fat", "bmr", "tdee", "calorie-calculator", "heart-rate", "fitness", "health", "nutrition"],
|
|
16
|
+
"homepage": "https://wimsta.com/tools/#calculation-api",
|
|
17
|
+
"repository": { "type": "git", "url": "git+https://github.com/getwimsta/wimsta-mcp.git" },
|
|
18
|
+
"bugs": { "url": "https://github.com/getwimsta/wimsta-mcp/issues" },
|
|
19
|
+
"author": "WIMSTA (https://wimsta.com)",
|
|
20
|
+
"license": "MIT"
|
|
21
|
+
}
|