tzilla-mcp is a locally running MCP (Model Context Protocol) server positioned as an MVP tool that lets MCP clients (such as Claude Desktop, Claude Code, and Cursor) act as a Trainzilla coach. It does not access the database directly; instead, it wraps the GraphQL API of api.tzilla.live, so all authentication and business rules are still enforced by the backend. The project status is a local MVP, not deployed to any environment, running entirely on the user's machine and using the user's own coach login credentials.
Main capabilities
- Read live data: whoami, list_clients, get_client_profile, client habits and compliance, training and nutrition plans, check-ins, classes, subscriptions, billing summaries, etc.
- Offline calculators: calc_tdee (BMR/TDEE/recommended calories), calc_macros (macro allocation by strategy, such as Standard 40/30/30, Pro g/kg, Keto), calc_1rm (Epley formula and %1RM weight suggestions).
- Write tools (confirmation required): all write tools return a preview by default, and only actually execute when confirm: true is passed, to avoid accidental operations. This includes creating habits, master habits, assigning master habits, creating check-ins (with questions), scheduling classes, creating training plans, creating nutrition plans, etc.
- Platform migration assistance: bulk_invite_clients supports bulk invitation of up to 200 clients (name, phone, private notes), the switch_to_trainzilla prompt, and a format-agnostic skill in skills/switch-to-trainzilla/ that lets Claude process any export file, PDF, or spreadsheet, mapping and previewing before sending.
- New coverage added in October 2026: client tracking (nutrition/training logs, daily metrics, personal bests, exercise history, progress, health reports, intake forms, clients without the app and private portal links, contact information, coach-side records); AI coach (review queue, triggers/offers, engagement, client preferences, AI plans and self-cancellation toggles); check-ins and inbox (replies, logs, recurring schedules, clearing overdue items, notifications, chatroom lists); business (plan creation/pricing/publishing/active/class rules/deletion, pause/Cancel membership, front desk payment, direct payment claim confirmation/rejection, payments, invoices and settings, share links, Coach Pro pricing/checkout links, referral program, gym seat billing); community, gym, workflows, directory, profile (community posts/comments, gym kiosk/face/check-in/resident booking/import/staff/domain, workflow edit delete and gym-level workflows, PDF plan import, food/recipe/exercise directory, branding/custom domain/global payments/localization, Google Calendar status, video calls).
- New in November 2026: insights and directory promotions (client roster segmentation, win back declining clients, all-client habit compliance, training streaks, AI run history, client subscriptions, courses, community unread counts; exercise directory browsing; promo codes; training day challenges; reusable training block templates); gym payments, settings and integrations (gym direct payments and Stripe/Razorpay connection, notification settings, away messages, display name, Calendly status/connect/disconnect/unmatched bookings, outbound webhooks, client group restrictions, per-client access/roles, optional onboarding steps); client groups (Coach Pro/gym) list, create, update, delete, member management, overview, assignment, and fan-out operations such as assigning training/diet/habits to groups, bulk messaging, scheduling check-ins, booking courses, revoking assignments, etc.; fan-out is first previewed server-side and idempotent within 10 minutes.
- Other: upload_file (local path or base64) uploads to S3 for tools that need files; API key creation/list/revocation (key is shown only once); Stripe/Razorpay connection (keys hidden in preview); start_google_calendar_connect returns a login URL.
- Chat: get_client_chat_messages reads client direct message history (requires backend clientChatMessages query support).
- Resources: tzilla://client/{clientId}/profile returns client profile as JSON.
- Prompts: weekly_client_review pulls profile/habits/compliance/courses and generates a read-only weekly report.
Usage
- Create .env (see .env.example) and fill in the coach token. The simplest way is to log in to the coach web app and get it from the browser console. The server automatically refreshes when the access token expires via refreshAccessToken.
- Local (stdio) mode: use npm run dev for development, npm start after building, and smoke test with node scripts/smoke.mjs. Suitable for Claude Desktop, etc.
- Remote (Streamable HTTP) mode: localhost only, supports multiple coaches. Use npm run http for development, npm run start:http after building, listening on http://127.0.0.1:8787/mcp(可通过 set via MCP_HTTP_PORT / MCP_HTTP_HOST). Smoke test with node scripts/smoke-http.mjs.
- Authentication: stdio mode uses environment variables TZ_ACCESS_TOKEN (and TZ_REFRESH_TOKEN) with automatic refresh; HTTP mode is pass-through, and every request must carry a coach API key (Authorization: Bearer tz_... or x-api-key). The server does not store tokens; it forwards the caller's key to the GraphQL API, and the backend enforces scope control. API keys are generated by backend features (createApiKey returns a plaintext tz_… key once, the apiKeys list does not show keys, revokeApiKey revokes; only the SHA-256 hash is stored).
- Endpoint selection: when TZ_API_URL is set, it takes priority; otherwise TZ_ENVIRONMENT=staging uses https://qa-be2.tzilla.live/graphql;其他情况默认 https://api.tzilla.live/graphql。
- Using in Claude Desktop: add the configuration to claude_desktop_config.json (Settings → Developer → Edit Config), restart, then try "Use tzilla-coach: who am I, and list my clients.".
Use cases Suitable for Trainzilla coaches to quickly query client data locally through an MCP client, perform calculations, preview and confirm write operations, bulk-migrate clients, and manage client groups and gym operations, etc. Because it is a local MVP, it is not suitable for public remote deployment or multi-tenant production use.
Limitations
- Runs locally only, not deployed; remote HTTP is limited to localhost.
- Does not support payments or refunds: the backend has no coach-facing refund operations, and client checkout is completed through the client's own payment.
- Some features depend on backend capabilities that have not yet been deployed (such as coach API keys and clientChatMessages queries), requiring backend PRs and deployment.
- Full MCP OAuth 2.1 is not yet implemented; authentication is currently pass-through.
- More resources (plan/check-in history) and prompts (such as "draft a plan") are not yet provided.