๐ Khan Academy MCP Server
An open-source Model Context Protocol (MCP) server that lets AI assistants search, browse, and read Khan Academy's educational content.
๐ No API key required.
๐ Quick Start
npx khanmcp
Or install globally:
npm install -g khanmcp
khanacademy-mcp
๐ฅ๏ธ Claude Desktop Configuration
Add this to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"khanacademy": {
"command": "npx",
"args": ["-y", "khanmcp"]
}
}
}
๐งฐ Tools
| Tool |
Description |
search |
Search Khan Academy for videos, articles, exercises, and courses |
list_subjects |
List all top-level subjects and popular courses |
get_topic_tree |
Browse the subject/topic hierarchy by slug with configurable depth |
get_content |
Get details about a specific content item (video, article, exercise) |
get_course |
Get full course structure with units, lessons, and content items |
get_transcript |
Get video transcripts (timestamped or full text) |
get_article |
Read the full text content of a Khan Academy article |
get_lesson |
Get all content items in a specific lesson |
embed_video |
Embed a video with thumbnail image, metadata, chapters, and optional transcript |
get_exercise |
Get exercise details with related study content (videos, articles) and practice URL |
get_quiz |
List all quizzes, unit tests, and course challenge for a course with prep material |
study_guide |
Build a structured study plan for any topic |
๐งฉ Tool Details
๐ search
query: string โ Search query (e.g., "photosynthesis", "quadratic formula")
limit?: number โ Max results (1-30, default: 10)
๐งพ list_subjects
No parameters. Returns all top-level subjects and popular courses.
๐ณ get_topic_tree
slug: string โ Topic slug (e.g., "math", "science/biology")
depth?: number โ Levels to fetch (0-3, default: 1)
๐ get_content
slug: string โ Content slug or full URL
๐ get_course
slug: string โ Course slug or URL (e.g., "math/algebra")
๐ฌ get_transcript
slug: string โ Video slug, KA URL, YouTube URL, or YouTube ID
language?: string โ Language code (default: "en")
format?: string โ "full", "timestamped", or "both" (default: "full")
๐ฐ get_article
slug: string โ Article slug or full URL (articles have "/a/" in the path)
๐ get_lesson
slug: string โ Lesson slug or full URL
๐บ embed_video
slug: string โ Video slug, KA URL, YouTube URL, or YouTube ID
include_transcript?: bool โ Include the full transcript (default: false)
language?: string โ Language code for transcript (default: "en")
๐๏ธ get_exercise
slug: string โ Exercise slug or full URL (exercises have "/e/" in the path)
โ get_quiz
slug: string โ Course slug or URL (e.g., "math/algebra")
kind?: string โ "all", "quiz", "unit-test", or "course-challenge" (default: "all")
๐ง study_guide
topic: string โ Topic or concept to study (e.g., "quadratic equations")
depth?: string โ "quick", "standard", or "comprehensive" (default: "standard")
๐ Workflows
Topic exploration:
list_subjects โ get_topic_tree โ get_course โ get_lesson โ get_content / get_transcript
Quick lookup:
search โ get_content or get_article โ get_transcript (if video)
Study session:
search or get_topic_tree โ study_guide for review, then get_article / get_transcript for deep dives
Course overview:
get_course โ pick a unit/lesson โ get_lesson โ get_content
Test prep:
get_quiz โ review covered lessons โ get_exercise for practice โ get_transcript / get_article to study weak areas
๐ ๏ธ Development
git clone https://github.com/aicoder2009/khanacademyMCP.git
cd khanacademyMCP
npm install
npm run build
Test with:
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node dist/index.js
โ๏ธ How It Works
Khan Academy deprecated their public API in 2020. This MCP server uses:
- Khan Academy's internal GraphQL API โ safelisted queries for content metadata and search
- YouTube transcript API โ fetches video captions/subtitles
- Page scraping โ extracts structured data from Khan Academy web pages as a fallback
- Static catalog โ hardcoded top-level subjects for reliable
list_subjects
All access is read-only with rate limiting (500ms between requests) and in-memory caching to be respectful of Khan Academy's servers.
โ ๏ธ Limitations
- No authentication โ cannot access user-specific data (progress, recommendations)
- Khan Academy's internal API may change without notice โ static fallbacks ensure basic functionality
- Transcript availability depends on YouTube captions being present
- Rate-limited to avoid overloading Khan Academy's servers
๐ License
MIT