Skip to main content
Glama
Personal PB Vision MCP Server

Personal PB Vision MCP Server

by noahsw

Personal PB Vision MCP server

A small MCP server for one player's PB Vision library, hosted on Vercel and added to Claude as a custom connector. It lets Claude find all your recorded games, so you no longer have to paste video links one at a time. A scheduled Claude routine can then review each new game and keep a running list of things to work on.

  • Official API only. It uses PB Vision's Connected Apps OAuth API with the profile:read, library:read and trends:read scopes. All three are read-only.

  • Works with PB Vision's own MCP. This server finds your games and returns your trends. For shot-by-shot analysis Claude passes each game's videoId and sessionNum to PB Vision's public MCP server (https://share.pb.vision/mcp), which you add as a second connector.

  • Only you. Signing in to the connector means signing in to PB Vision. The first PB Vision account that connects claims the server, and any other account is refused (its token is revoked right away). You can set OWNER_PBV_UID to pin the owner explicitly.

  • Stores almost nothing. Redis holds OAuth bookkeeping, short-lived rate-limit counters (keyed by a hash of the caller's IP), your PB Vision token (encrypted with AES-256-GCM), and the coach's own notes plus the list of game IDs it has reviewed. Game data is fetched live from PB Vision on every call and never cached.

Tools

Tool

What it does

list_games

Your games, newest first. A video with several games becomes one entry per game. Each entry has videoId, sessionNum, title, date, minutes, folder, starred/new/processing flags, and whether the coach has reviewed it. Filters: days, since, until, folder, unreviewed_only, include_hidden, limit.

list_folders

Your folders, with a game count for each.

get_trends

PB Vision's per-game trend data, ratings and stats.

get_profile

Your PB Vision UID and display name.

get_coach_notes / save_coach_notes

The coach's running notes (markdown, up to 20k characters): focus areas, evidence, drills, progress.

mark_games_reviewed

Records which games the coach has reviewed, so list_games with unreviewed_only skips them next time.

The last three write only to this server's Redis, never to PB Vision.

Related MCP server: claudex-strava-mcp

Setup

You'll do six things: deploy to Vercel, add Redis, register a Connected App with PB Vision, set environment variables, connect in Claude, and (optionally) schedule the coach.

1. Deploy to Vercel

  1. Fork or import this repo into Vercel (Add New → Project). Leave the framework as Other, since vercel.json sets the build.

  2. Pick a project name that's unique to you, for example pbvision-mcp-yourname. Your production address becomes https://pbvision-mcp-yourname.vercel.app. PB Vision matches the callback URL exactly, so settle on this name before registering.

  3. Deploy once. It will answer server_misconfigured until the next steps are done; that's expected.

2. Add Redis

In the Vercel project, open Storage → Create Database → Upstash for Redis (the free plan is enough) and connect it to Production only. That adds KV_REST_API_URL and KV_REST_API_TOKEN. (UPSTASH_REDIS_REST_URL / UPSTASH_REDIS_REST_TOKEN also work.)

Upstash's free plan allows only one database per account. If you already use it for another app, open Storage, pick that database, and connect it to this project instead of creating a new one. Every key this server writes starts with pbvision-mcp: (change it with REDIS_KEY_PREFIX), so it won't collide with the other app's keys.

3. Register a Connected App with PB Vision

Registration is manual. Apply at pb.vision/apps or email support@pb.vision with:

  • Display name: e.g. "Pickleball Coach MCP". It's shown on PB Vision's consent screen and in your Connected apps list.

  • Description: a personal MCP server that lists my own games and trends so my AI assistant can review them.

  • Redirect URI: https://<your-vercel-address>/pbvision/callback, exactly as written.

  • Client type: confidential (hosted backend; the secret stays on the server).

  • Scopes: profile:read, library:read, trends:read.

PB Vision sends back a Client ID and a Client Secret. Keep both out of the repo and out of chats.

4. Set environment variables in Vercel

In Settings → Environment Variables, set these for Production only. If Preview builds had them, a preview could read your stored sign-in.

Variable

Value

PBV_CLIENT_ID

from PB Vision

PBV_CLIENT_SECRET

from PB Vision

TOKEN_ENCRYPTION_KEY

a random string, e.g. the output of openssl rand -base64 32

OWNER_PBV_UID

recommended after your first sign-in: your PB Vision UID (see below)

PUBLIC_URL

optional: only if you use a custom domain (defaults to Vercel's production address)

ALLOWED_REDIRECT_URIS

optional: comma-separated list of MCP client callbacks. The default allows Claude (https://claude.ai/api/mcp/auth_callback and its claude.com twin) and the Gemini app. Add http://localhost/callback to allow Claude Code. Setting this replaces the whole list.

SESSION_EPOCH

optional: any value (default 1). Change it and redeploy to sign every connected client out.

Then Redeploy. Opening https://<your-vercel-address>/ should say "Personal PB Vision MCP server".

Pin the owner. After your first sign-in, copy the Redis key owner:pbv_uid from the Upstash console, or call the get_profile tool, then put that value in OWNER_PBV_UID and redeploy. Once that's set, a lost or reset Redis can't hand the server to another account.

Deployment protection. Under Settings → Deployment Protection, choose Standard Protection. Per-deployment URLs then sit behind Vercel's login, while your production address stays public for Claude.

5. Add the connectors in Claude

  1. In Claude, open Settings → Connectors → Add custom connector. Give it a name (e.g. "PB Vision library") and the URL https://<your-vercel-address>/mcp. Leave the advanced OAuth fields empty. Click Connect, approve on PB Vision's consent screen, and you're sent back to Claude.

  2. If you haven't already, add PB Vision's own MCP as a second custom connector: https://share.pb.vision/mcp.

  3. Try: "List my last 10 PB Vision games, then analyze my dinking in the most recent one."

6. Optional: schedule the coach

Create a scheduled routine in Claude (for example weekly, or the morning after you usually play) with both connectors enabled. Use coach-routine.md as the prompt. Each run reads the coach's notes, finds games it hasn't reviewed, analyzes them with PB Vision's tools, updates the notes, and marks the games reviewed. You get a short report back.

Disconnecting

  • Remove the connector in Claude, and disconnect the app in PB Vision under Settings → Account → Connected apps. The second step revokes the PB Vision token.

  • To sign every MCP client out at once, change SESSION_EPOCH and redeploy. Clients can also revoke their own tokens at /revoke (RFC 7009).

  • To drop the stored sign-in, delete the pbv:token key in Upstash (and owner:pbv_uid if a different account should claim the server). Delete coach:notes and coach:reviewed to reset the coach.

Notes on PB Vision's API

  • PB Vision access tokens don't expire, and PB Vision issues no refresh tokens. If you disconnect in PB Vision, reconnect the connector in Claude.

  • Authorizing again with the same scopes returns the same token. Authorizing with different scopes issues a new token and invalidates the old one, so this server always asks for all three scopes.

  • PB Vision doesn't document rate limits or pagination for /library/get, so list_games fetches the whole library on each call. The response shape of /trend/get isn't documented either, so get_trends passes it through as is (truncated at 150k characters).

  • When you authorize, PB Vision may attribute a referral to the app's registrant. See their guide for details.

Development

npm install
npm test         # vitest, with a fake PB Vision API
npm run build    # tsc → dist/, which api/index.js loads on Vercel

How it fits together:

  • api/index.js: the single Vercel function. vercel.json rewrites every path to it.

  • src/app.ts: router, CORS, and the stateless Streamable HTTP MCP endpoint at /mcp.

  • src/oauth.ts: a minimal OAuth 2.1 server for MCP clients (discovery metadata, dynamic client registration limited to known callback URLs, PKCE S256, rotating refresh tokens, revocation). Sign-in is delegated to PB Vision through a second PKCE flow.

  • src/pbvision.ts: the PB Vision Connected Apps client (OAuth code exchange, revoke, read-only API calls).

  • src/mcp.ts: the tools.

  • src/ratelimit.ts: per-caller limits on the public sign-in endpoints.

Adapted from the structure of a personal WHOOP MCP server. Not affiliated with or endorsed by PB Vision.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables Claude to access and query your Garmin Connect data, including sleep, activities, training load, and health metrics, through a set of read-only MCP tools.
      28
      7
      MIT
    • F
      license
      A
      quality
      Not graded
      maintenance
      Connects Claude to your Strava fitness data, enabling natural language queries about your training history such as activities, stats, and routes.
      8
      -
    • A
      license
      B
      quality
      B
      maintenance
      Enables Claude to access and query your Garmin Connect data—sleep, training, heart rate, and more—through a suite of read-only tools, with an optional write path for creating strength workouts.
      63
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Claude to read Garmin Connect data such as activities, sleep, HRV, VO2 max and training readiness, and optionally view or manage TrainingPeaks workouts and sync them to a watch, over streamable HTTP secured with MCP OAuth 2.1 and GitHub login.
      MIT