xunji-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
xunji-mcp
A small, self-hosted Model Context Protocol bridge that connects your Xunji (训记) training history to ChatGPT and other MCP clients.
Explore your training in one conversation: an overview, a movement's progress, or a grouped query over your history. The bridge runs on Cloudflare Workers with OAuth and a rebuildable D1 analytics index. Your Xunji key stays in Worker secrets; you approve client access.
Project site · 简体中文 · Documentation · Get started · Releases
What you can ask
Question | Tool |
How has my training changed? |
|
How is one movement progressing? |
|
Compare volume by week, month, or muscle group. |
|
What happened on this day? |
|
Which dates are covered? Backfill this window. |
|
Which tools and domains are available here? |
|
The bridge also reads the movement catalog and official plans. The tool reference covers arguments, units, errors, and the bounded tools retained for v0.1 clients.
Results include metric definitions, coverage, and freshness. Empty days and unscanned days are separate states. Optional MCP_UI_ENABLED=true adds a sandboxed overview view for hosts that support MCP Apps; text remains available.
Related MCP server: Garmin Personal MCP
How it works
flowchart LR
X["Xunji · original records"] --> W["Your Cloudflare Worker"]
W --> I["D1 · derived analytics"]
I --> W
W --> C["Authorized MCP client"]
O["You · Access or passphrase"] -->|approve OAuth| WOne deployment serves one Xunji account. Xunji remains the source of truth. A Durable Object scans the history window you select, and D1 computes aggregates without sending every set to the model.
The upstream exposes daily reads with observed 15-second light / 30-second full pacing. Backfill is resumable and defaults to 100 attempted dates per UTC day. Historical reads and scans do not write the KV cache; today and yesterday use a short-lived cache with a default 300-attempt daily cache budget. OAuth storage writes are separate.
See architecture, the upstream contract, and privacy for the full data path.
Smaller results
The synthetic benchmark compares the v0.1 per-day tool shape with an indexed overview:
History | Per-day calls | Per-day output | Overview calls | Overview output |
1 year | 183 | ~43.8k tokens | 1 | ~552 tokens |
3 years | 548 | ~131.4k tokens | 1 | ~555 tokens |
The index must be backfilled first. These figures measure synthetic output and local index queries; they are not production latency measurements. Method, limitations, and reproduction.
Get started
You need Node.js 20+, a Cloudflare account, and a training Open API key from Xunji.
git clone https://github.com/DeliciousBuding/xunji-mcp.git
cd xunji-mcp
npm install
cp wrangler.example.jsonc wrangler.jsonc
npx wrangler types
npm run checkThen follow the deployment guide to create KV and D1, configure your HTTPS origin and operator gate, and provide secrets through Wrangler's secret input. Your private wrangler.jsonc is gitignored.
Connect your client through OAuth at https://your-domain.example/mcp, call xunji_capabilities, and start a history backfill:
{ "action": "backfill", "start": "2024-01-01" }Use xunji_history with action=status to follow progress. The selected start defines the covered window; earlier days are not implied. Once indexed, ask for an overview.
Deploy · Connect ChatGPT and other clients · Tool reference
Access and supported scope
Area | Current boundary |
Training reads | Daily reads, indexed queries, PR/e1RM, movement catalog, and official plans |
Authorization | OAuth code flow with PKCE S256, exact redirects, resource audience, refresh rotation, and revocation |
Operator gate | Access JWT plus email allowlist, or a deployment passphrase; no identity means no grant |
Body and nutrition | Separate keys required; adapters remain unverified against live data |
Training writes | Disabled by default; explicit enablement, |
Delete | No upstream delete API |
Xunji's training write endpoint ignores dry_run. The bridge never sends it; an accepted write is real. Write behavior has been tested with stubs, not through a production write.
Read SECURITY.md, the threat model, and the coverage matrix before exposing your instance.
Verification and contributing
The suite runs unit, contract, and integration tests inside workerd with stubbed upstream HTTP. CI checks types, ESLint, formatting, tests, credentials in the tree and history, runtime dependencies, and a Worker dry run.
ChatGPT OAuth connection and training reads have been verified in a private deployment. Each new deployment and client needs its own connection check. The optional MCP Apps view's registration is tested; ChatGPT rendering remains unverified. Acceptance status.
Contributing · Support · Code of conduct · Changelog
License
MIT. Independent project; Xunji and 训记 belong to their respective owners.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect Claude, Cursor or any MCP client to your GymUp training data.
Talk to your own gym log. Reps: Gym Workout Log (repsworkout.com) is a workout log for iPhone and Android. Connect it to Claude, ChatGPT or any MCP client to read your workout history, PRs, lift progression, weekly summaries, routines and training plan, and to save routines, plans and workouts you have already done after you confirm them. It can't change or delete a logged workout or delete your account. Sign in with an e-mail code, Apple or Google; new users can create a free account while connecting, then get the app to log workouts.
Create Hevy routines and analyze your training from chat. Unofficial; BYO Hevy PRO API key.
Remote streamable-HTTP MCP server running on a single Cloudflare Worker. Your assistant gets live Airbnb, Amazon, Booking.com, Google Flights, Maps and Reddit data, social search on X, Instagram and TikTok, the Meta Ad Library, and image/video generation without any keys. Connect your own accounts to let it send WhatsApp or Telegram messages, work an IMAP inbox, manage Meta Ads campaigns and publish to X and LinkedIn. OAuth 2.1 with PKCE; stored credentials are AES-256-GCM encrypted.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables ChatGPT or another MCP client to query a self-hosted, email-restricted Garmin Connect running archive — latest and listed runs, lap and chart details, run comparisons, trends, recovery and training context — all served read-only from a Cloudflare Worker cache with one explicit, rate-limited manual refresh. Garmin credentials are never stored, and no tool can modify the Garmin account.MIT
- AlicenseNot gradedqualityBmaintenanceEnables users to connect ChatGPT or remote MCP clients to their own Garmin cloud health and activity data through a self-hosted, read-only OAuth-protected Cloudflare Worker.MIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables Claude and other remote MCP clients to query your own read-only Garmin Connect data — recovery trends, sleep, HRV, Body Battery, stress, heart rate, and activities — through Garmin's official Personal API, with OAuth sign-in that works from the mobile apps as well as desktop. Deploys on Cloudflare Workers' free tier with no password sharing or scraping.MIT
- AlicenseNot gradedqualityCmaintenanceEnables connecting your own Garmin Connect data to Claude or another MCP client so you can ask about sleep, training, heart rate, weight, and more through read-only tools running on a Cloudflare Worker.1MIT