Skip to main content
Glama
README.md
# šŸŽ“ Udemy MCP Server (Python)

A **Model Context Protocol (MCP)** server that connects AI assistants — such as Claude Desktop, Antigravity, Cursor, and others — to the **Udemy** platform.

With your regular Udemy account you get access to both **public features** (searching courses, viewing curricula, reading reviews) **and private features** (your enrolled courses and profile info).

---

## ✨ Features

- šŸ” **Search courses** — by keyword, category, price, level, language, and more
- šŸ“– **View course details** — descriptions, learning goals, prerequisites, ratings
- šŸ“š **Browse curricula** — lecture outlines, durations, and free preview flags
- ⭐ **Read reviews** — student ratings and written feedback
- šŸ·ļø **List categories** — discover all top-level Udemy categories
- šŸ‘¤ **View your profile** — display name, title, and avatar
- šŸ“¦ **List enrolled courses** — see everything you're currently learning

---

## šŸ“ Project Structure

```
UdemyMcpPython/
ā”œā”€ā”€ main.py              # Entry point — starts the MCP server
ā”œā”€ā”€ requirements.txt     # Python dependencies
ā”œā”€ā”€ .env.example         # Template for environment variables
ā”œā”€ā”€ .gitignore
ā”œā”€ā”€ README.md
└── src/
    ā”œā”€ā”€ __init__.py      # Package marker
    ā”œā”€ā”€ server.py        # MCP tool definitions (7 tools)
    └── client.py        # Async Udemy API client (httpx)
```

---

## šŸš€ Getting Started

### Prerequisites

- **Python 3.10+**
- A **Udemy account** (free or paid)

### 1. Clone the repository

```bash
git clone https://github.com/<your-username>/UdemyMcpPython.git
cd UdemyMcpPython
```

### 2. Create a virtual environment & install dependencies

```bash
python -m venv .venv
source .venv/bin/activate        # macOS / Linux
# .venv\Scripts\activate         # Windows

pip install -r requirements.txt
```

### 3. Configure environment variables

```bash
cp .env.example .env
```

Open `.env` and fill in your credentials (see [Authentication](#-authentication) below).

### 4. Run the server

```bash
python main.py
```

---

## šŸ”‘ Authentication

The server supports **two authentication methods**. You only need to set up one.

### Method 1: Access Token (⭐ Recommended)

Use the session cookie from your regular Udemy login — gives access to **all** tools including private ones.

1. Log into [udemy.com](https://www.udemy.com) in your browser.
2. Open **Developer Tools** (`F12` or `Cmd + Option + I` on Mac / `Ctrl + Shift + I` on Windows).
3. Navigate to **Application** → **Cookies** → `https://www.udemy.com` (in Firefox: **Storage** → **Cookies**).
4. Find the cookie named **`access_token`** and copy its value.
5. Paste it into your `.env` file:

```env
UDEMY_ACCESS_TOKEN=your_access_token_here
```

### Method 2: API Client Credentials

If you have Udemy Developer / Affiliate API keys:

1. Go to [Udemy API Clients](https://www.udemy.com/user/edit-api-clients/).
2. Copy your **Client ID** and **Client Secret**.
3. Add them to `.env`:

```env
UDEMY_CLIENT_ID=your_client_id
UDEMY_CLIENT_SECRET=your_client_secret
```

> [!NOTE]
> API Client credentials provide access to public endpoints only (course search, details, curriculum, reviews, categories). Private endpoints (profile, enrolled courses) require Method 1.

---

## šŸ› ļø Available MCP Tools

| Tool | Description | Auth Required |
| :--- | :--- | :---: |
| `get_my_profile` | Fetch profile details of the logged-in user | āœ… Access Token |
| `get_my_enrolled_courses` | List courses you are enrolled in (with completion %) | āœ… Access Token |
| `search_udemy_courses` | Search courses with rich filters (category, price, rating, level, language, ordering) | āŒ |
| `get_udemy_course_details` | Get course overview, prerequisites, learning goals, instructors, and subscriber count | āŒ |
| `get_udemy_course_curriculum` | View lecture outline, content durations, and free preview availability | āŒ |
| `get_udemy_course_reviews` | Read student ratings and review comments (filterable by star rating) | āŒ |
| `list_udemy_categories` | List all top-level course categories on Udemy | āŒ |

---

## āš™ļø MCP Client Configuration

Add the following to your MCP client's configuration file (`mcp_config.json`, `claude_desktop_config.json`, etc.):

```json
{
  "mcpServers": {
    "udemy": {
      "command": "/absolute/path/to/UdemyMcpPython/.venv/bin/python",
      "args": ["/absolute/path/to/UdemyMcpPython/main.py"],
      "env": {
        "UDEMY_ACCESS_TOKEN": "YOUR_ACCESS_TOKEN_HERE"
      }
    }
  }
}
```

> [!TIP]
> Replace `/absolute/path/to/UdemyMcpPython` with the actual path where you cloned the project. On Windows, use the `.venv\Scripts\python.exe` path instead.

---

## 🧰 Tech Stack

| Component | Technology |
| :--- | :--- |
| Language | Python 3.10+ |
| MCP Framework | [`mcp[cli]`](https://pypi.org/project/mcp/) ≄ 1.2.0 |
| HTTP Client | [`httpx`](https://www.python-httpx.org/) ≄ 0.27.0 |
| Config | [`python-dotenv`](https://pypi.org/project/python-dotenv/) ≄ 1.0.0 |
| Validation | [`pydantic`](https://docs.pydantic.dev/) ≄ 2.0.0 |

---

## šŸ“„ License

This project is open-source. Feel free to use and modify it for your own purposes.