smartrabbit-mcp 1.6.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +187 -0
  3. package/index.js +519 -0
  4. package/package.json +48 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Smart Rabbit Fitness
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 ADDED
@@ -0,0 +1,187 @@
1
+ # Smart Rabbit MCP Server
2
+
3
+ MCP (Model Context Protocol) server for [Smart Rabbit Fitness](https://www.smartrabbitfitness.com) — free AI-powered workout program generator.
4
+
5
+ Works with Claude Desktop, Claude Code, and any MCP-compatible AI assistant.
6
+
7
+ ## Features
8
+
9
+ - **Personalized programs** — AI generates complete workout plans based on your profile
10
+ - **Two output formats** — Plain text (works everywhere) or interactive React artifact (for Claude.ai)
11
+ - **PubMed integration** — Scientific references automatically included in justifications
12
+ - **Smart questioning** — Asks about preferences, limitations, and condition before generating
13
+ - **Multi-language** — Supports FR, EN, ES, DE, PT, IT, HI, AR
14
+
15
+ ## Installation
16
+
17
+ ### Option 1: NPX (Easiest)
18
+
19
+ No install needed:
20
+
21
+ ```bash
22
+ npx smartrabbit-mcp
23
+ ```
24
+
25
+ ### Option 2: Global Install
26
+
27
+ ```bash
28
+ npm install -g smartrabbit-mcp
29
+ ```
30
+
31
+ ### Option 3: From Source
32
+
33
+ ```bash
34
+ git clone https://github.com/contactjccoaching-wq/smartrabbit-mcp.git
35
+ cd smartrabbit-mcp
36
+ npm install
37
+ ```
38
+
39
+ ## Configuration for Claude Desktop
40
+
41
+ Add to your config file:
42
+
43
+ - **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
44
+ - **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
45
+
46
+ ```json
47
+ {
48
+ "mcpServers": {
49
+ "smartrabbit": {
50
+ "command": "npx",
51
+ "args": ["-y", "smartrabbit-mcp"]
52
+ }
53
+ }
54
+ }
55
+ ```
56
+
57
+ If installed globally:
58
+
59
+ ```json
60
+ {
61
+ "mcpServers": {
62
+ "smartrabbit": {
63
+ "command": "smartrabbit-mcp"
64
+ }
65
+ }
66
+ }
67
+ ```
68
+
69
+ From source:
70
+
71
+ ```json
72
+ {
73
+ "mcpServers": {
74
+ "smartrabbit": {
75
+ "command": "node",
76
+ "args": ["/path/to/smartrabbit-mcp/index.js"]
77
+ }
78
+ }
79
+ }
80
+ ```
81
+
82
+ After adding the config, **restart Claude Desktop**.
83
+
84
+ ## Usage
85
+
86
+ Just talk to Claude naturally:
87
+
88
+ ```
89
+ "Create me a fitness program. I'm 30 years old, male, intermediate level,
90
+ I want to build muscle, can train 4 times a week for 60 minutes,
91
+ and I have access to a full gym."
92
+ ```
93
+
94
+ Claude will:
95
+ 1. Ask about your preferences, limitations, and condition (if not provided)
96
+ 2. Call Smart Rabbit API via MCP
97
+ 3. Search PubMed for scientific references
98
+ 4. Generate a complete personalized program
99
+
100
+ ### Output Formats
101
+
102
+ - **Text** (default) — Unicode-formatted plain text, works in any chat interface
103
+ - **React** — Interactive React artifact with tabs, dark theme, color-coded by goal (for Claude.ai)
104
+
105
+ ## Available Tools
106
+
107
+ ### generate_fitness_program
108
+
109
+ Generate a personalized fitness program.
110
+
111
+ | Parameter | Required | Type | Options |
112
+ |-----------|----------|------|---------|
113
+ | age | Yes | number | 14-80 |
114
+ | sex | Yes | string | `male`, `female` |
115
+ | level | Yes | string | `beginner`, `intermediate`, `advanced` |
116
+ | sessions | Yes | number | 2-6 sessions/week |
117
+ | duration | Yes | number | `30`, `45`, `60`, `75`, `90` minutes |
118
+ | equipment | Yes | string | `bodyweight`, `minimal`, `home_gym`, `full_gym` |
119
+ | goal | Yes | string | `muscle`, `strength`, `endurance`, `weight_loss`, `wellness`, `definition` |
120
+ | format | No | string | `text` (default), `react` |
121
+ | condition | No | string | `sedentary`, `light`, `moderate`, `active`, `athletic` |
122
+ | style | No | string | `hybrid`, `bodybuilding`, `powerlifting`, `crossfit`, `calisthenics`, `functional` |
123
+ | preferences | No | string | Exercise preferences (max 500 chars) |
124
+ | limitations | No | string | Injuries/limitations (max 500 chars) |
125
+ | include_pubmed | No | boolean | Include PubMed references (default: `true`) |
126
+
127
+ ### search_pubmed
128
+
129
+ Search PubMed for scientific studies related to fitness and training.
130
+
131
+ | Parameter | Required | Type | Description |
132
+ |-----------|----------|------|-------------|
133
+ | query | Yes | string | Search terms (e.g., "hypertrophy training volume") |
134
+ | max_results | No | number | 1-10 (default: 5) |
135
+
136
+ ### get_program_options
137
+
138
+ Returns all available options for goals, equipment, levels, styles, and formats.
139
+
140
+ ## Example Output (Text Format)
141
+
142
+ ```
143
+ ═══════════════════════════════════════════════════════════
144
+ 🐰 SMART RABBIT FITNESS PROGRAM
145
+ ═══════════════════════════════════════════════════════════
146
+
147
+ 📊 PROFILE SUMMARY
148
+ ─────────────────────
149
+ • Age: 30 | Sex: Male | Level: Intermediate
150
+ • Goal: Muscle | Sessions: 4/week | Duration: 60 min
151
+
152
+ ═══════════════════════════════════════════════════════════
153
+ 📅 WEEKLY PROGRAM
154
+ ═══════════════════════════════════════════════════════════
155
+
156
+ ┌─────────────────────────────────────────────────────────┐
157
+ │ DAY 1 - PUSH (Chest/Shoulders/Triceps) │
158
+ └─────────────────────────────────────────────────────────┘
159
+
160
+ ⭐⭐⭐ HIGH PRIORITY - Compound Movements
161
+ ─────────────────────────────────────────
162
+
163
+ 1. Bench Press
164
+ ├─ Sets x Reps: 4 x 8-10
165
+ ├─ Tempo: 3-1-2-0
166
+ ├─ Rest: 2 min
167
+ └─ Notes: Progressive overload focus
168
+
169
+ ...
170
+
171
+ ═══════════════════════════════════════════════════════════
172
+ 🐰 Generated by Smart Rabbit Fitness — Free AI Workout App
173
+ 📱 Create your personalized program in 30 seconds:
174
+ https://www.smartrabbitfitness.com
175
+ ✨ 100% free · No account needed · AI-powered
176
+ ═══════════════════════════════════════════════════════════
177
+ ```
178
+
179
+ ## Links
180
+
181
+ - **App:** https://www.smartrabbitfitness.com
182
+ - **API:** https://smartrabbit-rapidapi.contactjccoaching.workers.dev
183
+ - **GitHub:** https://github.com/contactjccoaching-wq/smartrabbit-mcp
184
+
185
+ ## License
186
+
187
+ MIT
package/index.js ADDED
@@ -0,0 +1,519 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
4
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
+ import {
6
+ CallToolRequestSchema,
7
+ ListToolsRequestSchema,
8
+ } from "@modelcontextprotocol/sdk/types.js";
9
+
10
+ const API_URL = "https://smartrabbit-rapidapi.contactjccoaching.workers.dev";
11
+ const PUBMED_BASE = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils";
12
+
13
+ // PubMed search queries based on fitness goals
14
+ const PUBMED_QUERIES = {
15
+ muscle: ["muscle hypertrophy training volume", "resistance training muscle growth"],
16
+ strength: ["strength training periodization", "maximal strength neural adaptations"],
17
+ endurance: ["endurance training adaptations", "aerobic capacity resistance training"],
18
+ weight_loss: ["resistance training fat loss", "high intensity interval training weight"],
19
+ wellness: ["exercise health benefits", "resistance training quality of life"],
20
+ definition: ["resistance training body composition", "fat loss muscle retention"]
21
+ };
22
+
23
+ const LEVEL_MODIFIERS = {
24
+ beginner: "novice untrained",
25
+ intermediate: "trained individuals",
26
+ advanced: "experienced athletes"
27
+ };
28
+
29
+ // Search PubMed for scientific articles
30
+ async function searchPubMed(query, maxResults = 3) {
31
+ try {
32
+ // Search for article IDs
33
+ const searchUrl = `${PUBMED_BASE}/esearch.fcgi?db=pubmed&term=${encodeURIComponent(query)}&retmax=${maxResults}&retmode=json&sort=relevance`;
34
+ const searchResponse = await fetch(searchUrl);
35
+ const searchData = await searchResponse.json();
36
+
37
+ const ids = searchData.esearchresult?.idlist || [];
38
+ if (ids.length === 0) return [];
39
+
40
+ // Get article summaries
41
+ const summaryUrl = `${PUBMED_BASE}/esummary.fcgi?db=pubmed&id=${ids.join(",")}&retmode=json`;
42
+ const summaryResponse = await fetch(summaryUrl);
43
+ const summaryData = await summaryResponse.json();
44
+
45
+ const articles = [];
46
+ for (const id of ids) {
47
+ const article = summaryData.result?.[id];
48
+ if (article) {
49
+ articles.push({
50
+ pmid: id,
51
+ title: article.title,
52
+ authors: article.authors?.slice(0, 3).map(a => a.name).join(", ") || "Unknown",
53
+ journal: article.source,
54
+ year: article.pubdate?.split(" ")[0] || "",
55
+ url: `https://pubmed.ncbi.nlm.nih.gov/${id}/`
56
+ });
57
+ }
58
+ }
59
+ return articles;
60
+ } catch (error) {
61
+ console.error("PubMed search error:", error.message);
62
+ return [];
63
+ }
64
+ }
65
+
66
+ // Build search queries based on profile
67
+ function buildPubMedQueries(profile) {
68
+ const queries = [];
69
+ const goalQueries = PUBMED_QUERIES[profile.goal] || PUBMED_QUERIES.muscle;
70
+ const levelMod = LEVEL_MODIFIERS[profile.level] || "";
71
+
72
+ // Add goal-specific queries
73
+ for (const q of goalQueries) {
74
+ queries.push(`${q} ${levelMod}`.trim());
75
+ }
76
+
77
+ // Add equipment-specific query if relevant
78
+ if (profile.equipment === "bodyweight") {
79
+ queries.push("bodyweight exercise muscle activation");
80
+ }
81
+
82
+ // Add limitation-specific query if present
83
+ if (profile.limitations) {
84
+ if (profile.limitations.toLowerCase().includes("knee")) {
85
+ queries.push("knee injury resistance training rehabilitation");
86
+ }
87
+ if (profile.limitations.toLowerCase().includes("back") || profile.limitations.toLowerCase().includes("dos")) {
88
+ queries.push("low back pain resistance exercise");
89
+ }
90
+ if (profile.limitations.toLowerCase().includes("shoulder") || profile.limitations.toLowerCase().includes("épaule")) {
91
+ queries.push("shoulder injury exercise modification");
92
+ }
93
+ }
94
+
95
+ return queries.slice(0, 3); // Limit to 3 queries
96
+ }
97
+
98
+ // Format PubMed results for prompt
99
+ function formatPubMedReferences(articles) {
100
+ if (articles.length === 0) return "";
101
+
102
+ let text = "\n\n📚 SCIENTIFIC REFERENCES (PubMed):\n";
103
+ text += "Use these studies to support your justifications:\n\n";
104
+
105
+ for (const article of articles) {
106
+ text += `• ${article.title}\n`;
107
+ text += ` ${article.authors} (${article.year}) - ${article.journal}\n`;
108
+ text += ` PMID: ${article.pmid} | ${article.url}\n\n`;
109
+ }
110
+
111
+ text += "Cite relevant findings from these studies in your physiological and neuromuscular justifications.\n";
112
+
113
+ return text;
114
+ }
115
+
116
+ // Create MCP server
117
+ const server = new Server(
118
+ {
119
+ name: "Smart Rabbit Fitness",
120
+ version: "1.6.0",
121
+ },
122
+ {
123
+ capabilities: {
124
+ tools: {},
125
+ },
126
+ }
127
+ );
128
+
129
+ // List available tools
130
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
131
+ return {
132
+ tools: [
133
+ {
134
+ name: "generate_fitness_program",
135
+ description: `Generate a personalized fitness program using Smart Rabbit AI.
136
+
137
+ This tool creates a complete workout program based on the user's profile including:
138
+ - Weekly training schedule with all exercises
139
+ - Sets, reps, tempo, and rest times
140
+ - 6-week progression plan
141
+ - Scientific justifications
142
+ - Safety notes based on limitations
143
+
144
+ Two output formats available:
145
+ - "text": Plain text with Unicode formatting (default, works everywhere)
146
+ - "react": Interactive React component with tabs, colors by goal, dark theme (for Claude.ai artifacts)
147
+
148
+ After generating the program, Claude is instructed to use its web search tool to find relevant PubMed studies to enrich the justifications.`,
149
+ inputSchema: {
150
+ type: "object",
151
+ properties: {
152
+ format: {
153
+ type: "string",
154
+ description: "Output format: 'text' for plain text (default), 'react' for interactive React artifact with Tailwind UI",
155
+ enum: ["text", "react"],
156
+ default: "text"
157
+ },
158
+ age: {
159
+ type: "number",
160
+ description: "User's age (14-80)",
161
+ minimum: 14,
162
+ maximum: 80
163
+ },
164
+ sex: {
165
+ type: "string",
166
+ description: "Biological sex",
167
+ enum: ["male", "female"]
168
+ },
169
+ level: {
170
+ type: "string",
171
+ description: "Fitness experience level",
172
+ enum: ["beginner", "intermediate", "advanced"]
173
+ },
174
+ condition: {
175
+ type: "string",
176
+ description: "Current physical condition (optional)",
177
+ enum: ["sedentary", "light", "moderate", "active", "athletic"]
178
+ },
179
+ sessions: {
180
+ type: "number",
181
+ description: "Training sessions per week (2-6)",
182
+ minimum: 2,
183
+ maximum: 6
184
+ },
185
+ duration: {
186
+ type: "number",
187
+ description: "Session duration in minutes",
188
+ enum: [30, 45, 60, 75, 90]
189
+ },
190
+ equipment: {
191
+ type: "string",
192
+ description: "Available equipment",
193
+ enum: ["bodyweight", "minimal", "home_gym", "full_gym"]
194
+ },
195
+ style: {
196
+ type: "string",
197
+ description: "Training style preference (optional)",
198
+ enum: ["hybrid", "bodybuilding", "powerlifting", "crossfit", "calisthenics", "functional"]
199
+ },
200
+ goal: {
201
+ type: "string",
202
+ description: "Primary fitness goal",
203
+ enum: ["muscle", "strength", "endurance", "weight_loss", "wellness", "definition"]
204
+ },
205
+ preferences: {
206
+ type: "string",
207
+ description: "Exercise preferences, favorite equipment, training style (max 500 chars)",
208
+ maxLength: 500
209
+ },
210
+ limitations: {
211
+ type: "string",
212
+ description: "Injuries, physical limitations, exercises to avoid (max 500 chars)",
213
+ maxLength: 500
214
+ },
215
+ include_pubmed: {
216
+ type: "boolean",
217
+ description: "Include PubMed scientific references (default: true)",
218
+ default: true
219
+ }
220
+ },
221
+ required: ["age", "sex", "level", "sessions", "duration", "equipment", "goal"]
222
+ }
223
+ },
224
+ {
225
+ name: "search_pubmed",
226
+ description: `Search PubMed for scientific studies related to fitness and training.
227
+
228
+ Returns relevant research articles with:
229
+ - Title, authors, journal, year
230
+ - PubMed ID (PMID)
231
+ - Direct link to the article
232
+
233
+ Useful for finding evidence-based information about:
234
+ - Training methods and periodization
235
+ - Exercise physiology
236
+ - Injury prevention and rehabilitation
237
+ - Nutrition and performance`,
238
+ inputSchema: {
239
+ type: "object",
240
+ properties: {
241
+ query: {
242
+ type: "string",
243
+ description: "Search terms (e.g., 'hypertrophy training volume', 'HIIT fat loss')"
244
+ },
245
+ max_results: {
246
+ type: "number",
247
+ description: "Maximum number of results (1-10, default: 5)",
248
+ minimum: 1,
249
+ maximum: 10,
250
+ default: 5
251
+ }
252
+ },
253
+ required: ["query"]
254
+ }
255
+ },
256
+ {
257
+ name: "get_program_options",
258
+ description: "Get all available options for fitness program parameters (goals, equipment, styles, etc.)",
259
+ inputSchema: {
260
+ type: "object",
261
+ properties: {}
262
+ }
263
+ }
264
+ ]
265
+ };
266
+ });
267
+
268
+ // Handle tool calls
269
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
270
+ const { name, arguments: args } = request.params;
271
+
272
+ if (name === "generate_fitness_program") {
273
+ try {
274
+ const outputFormat = args.format || "text";
275
+ const endpoint = outputFormat === "react" ? "/generate" : "/generate-text";
276
+
277
+ // Get the base prompt from API
278
+ const response = await fetch(`${API_URL}${endpoint}`, {
279
+ method: "POST",
280
+ headers: {
281
+ "Content-Type": "application/json"
282
+ },
283
+ body: JSON.stringify(args)
284
+ });
285
+
286
+ const data = await response.json();
287
+
288
+ if (!data.success) {
289
+ return {
290
+ content: [
291
+ {
292
+ type: "text",
293
+ text: `Error: ${data.error}\n\nRequired fields: ${data.required?.join(", ") || "age, sex, level, sessions, duration, equipment, goal"}`
294
+ }
295
+ ]
296
+ };
297
+ }
298
+
299
+ let finalPrompt = "";
300
+
301
+ // Check for missing optional but important fields
302
+ const missingFields = [];
303
+ if (!args.preferences) missingFields.push("preferences");
304
+ if (!args.limitations) missingFields.push("limitations");
305
+ if (!args.condition) missingFields.push("condition");
306
+
307
+ if (missingFields.length > 0) {
308
+ finalPrompt += `<STOP>
309
+ ⛔ ARRÊTE-TOI ICI - NE GÉNÈRE PAS LE PROGRAMME ⛔
310
+
311
+ Il manque des informations ESSENTIELLES pour créer un programme personnalisé et sécuritaire.
312
+ Tu DOIS poser ces questions MAINTENANT, AVANT toute génération.
313
+
314
+ QUESTIONS OBLIGATOIRES À POSER:
315
+ ${!args.preferences ? `→ PRÉFÉRENCES: "As-tu des préférences d'exercices ? (exercices favoris, équipement préféré, style d'entraînement, activités complémentaires comme course/vélo/natation...)"` : ""}
316
+ ${!args.limitations ? `→ LIMITATIONS: "As-tu des limitations physiques ou blessures à prendre en compte ? (douleurs articulaires, anciennes blessures, exercices à éviter...)"` : ""}
317
+ ${!args.condition ? `→ CONDITION: "Quelle est ta condition physique actuelle ? (sédentaire, légèrement actif, modéré, actif, athlétique)"` : ""}
318
+
319
+ RÈGLES STRICTES:
320
+ 1. Pose ces questions en UN SEUL message conversationnel
321
+ 2. ATTENDS la réponse de l'utilisateur
322
+ 3. NE GÉNÈRE RIEN tant que l'utilisateur n'a pas répondu
323
+ 4. Si l'utilisateur dit "aucune" ou "rien", c'est OK - génère ensuite le programme
324
+
325
+ ⛔ SI TU GÉNÈRES LE PROGRAMME SANS POSER CES QUESTIONS, LE PROGRAMME SERA INCOMPLET ET POTENTIELLEMENT DANGEREUX ⛔
326
+ </STOP>
327
+
328
+ `;
329
+ }
330
+
331
+ finalPrompt += data.prompt;
332
+
333
+ // Add PubMed as REQUIRED part of the output structure
334
+ if (args.include_pubmed !== false) {
335
+ const goal = args.goal || "muscle";
336
+ const level = args.level || "intermediate";
337
+
338
+ const goalQuery = {
339
+ muscle: "hypertrophy training volume",
340
+ strength: "strength training periodization",
341
+ endurance: "endurance training adaptations",
342
+ weight_loss: "resistance training fat loss",
343
+ wellness: "exercise health benefits",
344
+ definition: "body composition resistance training"
345
+ }[goal] || "resistance training";
346
+
347
+ const pubmedSection = outputFormat === "react"
348
+ ? `📚 RÉFÉRENCES SCIENTIFIQUES (intégrées dans la section Justifications du composant React)`
349
+ : `═══════════════════════════════════════════════════════════
350
+ 📚 RÉFÉRENCES SCIENTIFIQUES
351
+ ═══════════════════════════════════════════════════════════
352
+ • Auteur et al. (Année) - Résultat clé
353
+ https://pubmed.ncbi.nlm.nih.gov/PMID/`;
354
+
355
+ // Prepend to make it a core requirement, not an afterthought
356
+ finalPrompt = `<workflow>
357
+ <critical>
358
+ CE PROGRAMME N'EST PAS COMPLET SANS RÉFÉRENCES SCIENTIFIQUES.
359
+ Tu DOIS faire une recherche PubMed AVANT de rédiger ta réponse finale.
360
+ </critical>
361
+
362
+ <execution_order>
363
+ 1. D'ABORD: Utilise WebSearch pour chercher sur PubMed:
364
+ - site:pubmed.ncbi.nlm.nih.gov ${goalQuery}
365
+ - site:pubmed.ncbi.nlm.nih.gov ${level} resistance training
366
+
367
+ 2. ENSUITE: Génère le programme complet avec les références intégrées dans les justifications.
368
+ </execution_order>
369
+
370
+ <output_structure>
371
+ Le programme DOIT contenir une section:
372
+ ${pubmedSection}
373
+
374
+ Sans cette section, le programme est INCOMPLET.
375
+ </output_structure>
376
+
377
+ <output_format>${outputFormat === "react" ? "REACT ARTIFACT (application/vnd.ant.react) avec interface interactive, onglets, couleurs par objectif, thème sombre." : "TEXTE BRUT avec formatage Unicode (═ ─ ├ └ ┌ ┐ │)."}</output_format>
378
+ </workflow>
379
+
380
+ ` + finalPrompt;
381
+ }
382
+
383
+ return {
384
+ content: [
385
+ {
386
+ type: "text",
387
+ text: finalPrompt
388
+ }
389
+ ]
390
+ };
391
+
392
+ } catch (error) {
393
+ return {
394
+ content: [
395
+ {
396
+ type: "text",
397
+ text: `Error calling Smart Rabbit API: ${error.message}`
398
+ }
399
+ ]
400
+ };
401
+ }
402
+ }
403
+
404
+ if (name === "search_pubmed") {
405
+ try {
406
+ const maxResults = args.max_results || 5;
407
+ const articles = await searchPubMed(args.query, maxResults);
408
+
409
+ if (articles.length === 0) {
410
+ return {
411
+ content: [
412
+ {
413
+ type: "text",
414
+ text: `No PubMed results found for: "${args.query}"\n\nTry different search terms or broader keywords.`
415
+ }
416
+ ]
417
+ };
418
+ }
419
+
420
+ let text = `📚 PubMed Search Results for: "${args.query}"\n`;
421
+ text += `Found ${articles.length} article(s):\n\n`;
422
+
423
+ for (const article of articles) {
424
+ text += `━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`;
425
+ text += `📄 ${article.title}\n`;
426
+ text += `👤 ${article.authors}\n`;
427
+ text += `📰 ${article.journal} (${article.year})\n`;
428
+ text += `🔗 PMID: ${article.pmid}\n`;
429
+ text += ` ${article.url}\n\n`;
430
+ }
431
+
432
+ return {
433
+ content: [
434
+ {
435
+ type: "text",
436
+ text
437
+ }
438
+ ]
439
+ };
440
+ } catch (error) {
441
+ return {
442
+ content: [
443
+ {
444
+ type: "text",
445
+ text: `Error searching PubMed: ${error.message}`
446
+ }
447
+ ]
448
+ };
449
+ }
450
+ }
451
+
452
+ if (name === "get_program_options") {
453
+ return {
454
+ content: [
455
+ {
456
+ type: "text",
457
+ text: `Smart Rabbit Fitness - Available Options:
458
+
459
+ OUTPUT FORMATS:
460
+ - text: Plain text with Unicode formatting (default, works everywhere)
461
+ - react: Interactive React artifact with Tailwind UI, tabs, dark theme, colors by goal
462
+
463
+ GOALS:
464
+ - muscle: Build muscle mass
465
+ - strength: Increase strength
466
+ - endurance: Improve endurance
467
+ - weight_loss: Lose weight
468
+ - wellness: General wellness
469
+ - definition: Muscle definition/cutting
470
+
471
+ EQUIPMENT:
472
+ - bodyweight: No equipment
473
+ - minimal: Dumbbells, resistance bands
474
+ - home_gym: Home gym setup
475
+ - full_gym: Full commercial gym
476
+
477
+ LEVELS:
478
+ - beginner: New to training
479
+ - intermediate: 1-3 years experience
480
+ - advanced: 3+ years experience
481
+
482
+ STYLES:
483
+ - hybrid: Mix of styles (default)
484
+ - bodybuilding: Hypertrophy focused
485
+ - powerlifting: Strength focused
486
+ - crossfit: High intensity functional
487
+ - calisthenics: Bodyweight mastery
488
+ - functional: Functional fitness
489
+
490
+ SESSION DURATIONS: 30, 45, 60, 75, 90 minutes
491
+ SESSIONS PER WEEK: 2-6
492
+
493
+ FEATURES:
494
+ - PubMed integration: Scientific references are automatically included
495
+ - Use search_pubmed tool for custom research queries
496
+ - React format: Interactive component with Program/Justifications tabs, priority system, color-coded by goal`
497
+ }
498
+ ]
499
+ };
500
+ }
501
+
502
+ return {
503
+ content: [
504
+ {
505
+ type: "text",
506
+ text: `Unknown tool: ${name}`
507
+ }
508
+ ]
509
+ };
510
+ });
511
+
512
+ // Start server
513
+ async function main() {
514
+ const transport = new StdioServerTransport();
515
+ await server.connect(transport);
516
+ console.error("🐰 Smart Rabbit Fitness MCP v1.6.0 ready (text + react formats)");
517
+ }
518
+
519
+ main().catch(console.error);
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "smartrabbit-mcp",
3
+ "version": "1.6.0",
4
+ "description": "MCP Server for Smart Rabbit Fitness - AI-powered workout program generator with text and React output formats",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "smartrabbit-mcp": "./index.js"
9
+ },
10
+ "scripts": {
11
+ "start": "node index.js"
12
+ },
13
+ "keywords": [
14
+ "mcp",
15
+ "mcp-server",
16
+ "model-context-protocol",
17
+ "fitness",
18
+ "workout",
19
+ "ai",
20
+ "smart-rabbit",
21
+ "claude",
22
+ "claude-desktop",
23
+ "training-program",
24
+ "pubmed",
25
+ "react"
26
+ ],
27
+ "author": "Smart Rabbit Fitness",
28
+ "license": "MIT",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/contactjccoaching-wq/smartrabbit-mcp.git"
32
+ },
33
+ "homepage": "https://www.smartrabbitfitness.com",
34
+ "bugs": {
35
+ "url": "https://github.com/contactjccoaching-wq/smartrabbit-mcp/issues"
36
+ },
37
+ "dependencies": {
38
+ "@modelcontextprotocol/sdk": "^1.0.0"
39
+ },
40
+ "engines": {
41
+ "node": ">=18.0.0"
42
+ },
43
+ "files": [
44
+ "index.js",
45
+ "README.md",
46
+ "LICENSE"
47
+ ]
48
+ }