Tutor Lesson-Script & Transcript Retrieval MCP
Enables retrieval of tutor lesson scripts from Supabase and diarized transcripts from PencilSpaces, with Google OAuth gating to a domain.
README
Tutor Lesson-Script & Transcript Retrieval MCP Server
A minimal remote MCP server exposing one tool,
get_lesson_script, that returns the markdown tutor script for a
lesson from ps_lessons.script on your Supabase project.
Retrieval only — no scoring or rubric logic.
The tool
get_lesson_script(lesson: str) -> str
Accepts a lesson code ("401.1", "413.2"), a concept ("Suffix s", "sh"),
or a name ("Orientation", "Unit 1 Recap", "Unit 3 Passwords and Play").
It is scoped to curriculum_id = your-curriculum-uuid.
Behavior:
- One match → returns that lesson's markdown script.
- No match → a short message with the closest lesson names.
- Several matches (e.g.
"401"→401.1and401.2) → lists them and asks you to be specific. - Match but empty script → says the lesson exists but isn't populated yet.
Environment variables
| Variable | Purpose |
|---|---|
SUPABASE_URL |
https://your-project-ref.supabase.co |
SUPABASE_SERVICE_ROLE_KEY |
Supabase → Project Settings → API → service_role key. Server-side only. |
CURRICULUM_ID |
The curriculum UUID this tool is scoped to (set your own). |
CACHE_TTL |
Optional; seconds to cache lesson rows (default 60). |
Copy .env.example to .env and fill in the key for local runs.
Run locally
pip install -r requirements.txt
export $(grep -v '^#' .env | xargs) # or set the vars however you prefer
python server.py # serves Streamable HTTP at http://localhost:8000/mcp
Test it with the MCP Inspector (no code needed):
npx @modelcontextprotocol/inspector
# Transport: Streamable HTTP URL: http://localhost:8000/mcp
# then call get_lesson_script with {"lesson": "401.1"}
(Opening /mcp in a browser returns HTTP 406 — that's expected; it needs MCP headers.)
Deploy on Render
- Push this repo to GitHub.
- Render dashboard → New → Blueprint, point at the repo (uses
render.yaml). Or New → Web Service with buildpip install -r requirements.txtand startpython server.py. - Set env vars
SUPABASE_URL,SUPABASE_SERVICE_ROLE_KEY, andCURRICULUM_IDin the Render dashboard. - Deploy. Your endpoint is
https://<service-name>.onrender.com/mcp.
Free Render instances sleep after inactivity and cold-start in ~30–60s. Hit the endpoint once to warm it before a live demo, or use a paid instance.
Add as a Claude custom connector
In Claude → Customize → Connectors → + → Add custom connector:
- Name: Tutor Lesson Scripts
- URL:
https://<service-name>.onrender.com/mcp - Leave OAuth blank (this server is unauthenticated — see note below).
Then enable it per chat via the + button → Connectors, and ask, e.g., "Use Tutor Lesson Scripts to get the script for lesson 401.1."
(On Team/Enterprise plans an Owner adds the connector under Organization Settings → Connectors first, then members connect.)
Demo suggestion
Warm the endpoint, then in a fresh chat: "Get me the tutor script for 418.1." → Claude returns the markdown (spell step reads hills → jets → tan → call, etc.). Pick and rehearse one lesson beforehand so the demo is smooth.
Security note
This server is unauthenticated for a dev demo: anyone with the URL can read lesson scripts, and the service-role key stays on the server (never sent to clients). Before anything beyond dev, put it behind OAuth (Claude custom connectors support an OAuth Client ID/Secret) or a gateway, and/or use a restricted key.
Phase 3: Transcript retrieval + Google auth
Two read-only PencilSpaces tools, and Google OAuth restricting the whole server
(all three tools) to @yourdomain.org.
New tools
list_recordings(start_date, end_date)— recordings in a date range, each labeled with its lesson name (space title). Dedupes space lookups. Returns structured rows:recordingId, spaceId, lessonName, date, durationMinutes, hostUserIds.get_transcript(recording_id, space_id=None)— the diarized transcript plus lesson name and host userId(s).statusis one ofready | processing | empty | legacy | invalid_id | not_authorized | error. Segments are diarized by opaqueuserId(no name resolution — the eval skill corrects PS misattributions).
Flow: list_recordings → user picks one → get_transcript → the tutor-eval
skill calls get_lesson_script. Pass spaceId from the list into get_transcript
so it doesn't re-fetch the space.
Two auth layers
- User → server: Google OAuth, gated to
@yourdomain.org(below). - Server → PencilSpaces:
PENCIL_SPACES_TOKENBearer secret. The token's account must be a host of the spaces, or the endpoints 401.
New environment variables
SERVER_BASE_URL (this server's public HTTPS URL), GOOGLE_OAUTH_CLIENT_ID,
GOOGLE_OAUTH_CLIENT_SECRET, ALLOWED_EMAIL_DOMAIN (e.g. yourdomain.org),
JWT_SIGNING_KEY (random, stable), PENCIL_API_BASE, PENCIL_SPACES_TOKEN.
Google Cloud OAuth setup
- In the yourdomain.org Google Workspace, create/select a Google Cloud project (must be under that org so "Internal" is available).
- APIs & Services → OAuth consent screen → Internal (this is the primary
domain gate — only
@yourdomain.orgaccounts can complete sign-in). Add scopesopenidand.../auth/userinfo.email. - APIs & Services → Credentials → Create credentials → OAuth client ID →
Web application. Set:
- Authorized JavaScript origins:
https://your-service-name.onrender.com - Authorized redirect URI:
https://your-service-name.onrender.com/auth/callback(must match exactly;/auth/callbackis FastMCP's default).
- Authorized JavaScript origins:
- Copy the Client ID (
…apps.googleusercontent.com) and Secret (GOCSPX-…) into Render env vars. The server allows Claude's callback (https://claude.ai/api/mcp/auth_callback) as a client redirect.
PencilSpaces
Set PENCIL_API_BASE (confirm the exact API host) and PENCIL_SPACES_TOKEN
(a host account's Bearer token) as Render secrets. Read-only; never writes.
Connector re-connection
Turning on auth changes the existing connector: users must re-add / re-authorize it in Claude and sign in with Google. That's expected — it's the gate for handling real transcripts.
Testing with auth on
Use the MCP Inspector's OAuth flow, or the FastMCP client:
Client("https://…onrender.com/mcp", auth="oauth"). First connect opens Google login.
Verify against a real recording (one-time)
The PencilSpaces response field names in pencilspaces.py follow the phase spec but
were not verified against a live payload. On the first real recording, confirm:
- the recordings list key (
recordings) and fields (recordingId,spaceId,startingTime,duration); - transcript state markers (
code/status==TRY_AGAIN_LATER;segmentsnull vs[]); - that the host
userIdfrom the space'shostsarray matches theuserIdused in transcript segments (this overlap is what the role-tagging rests on). If the host never spoke or there are multiple hosts, note it — don't try to solve it now.
Privacy (by design)
userId pass-through, no name resolution — names never enter Claude. Real student
transcripts: run evaluations in your own account and delete prototype conversations
when done; no shared/retained transcript stores.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。