d2l-mcp服务器概念
MCP服务器将D2L连接到Notion
建筑
┌─────────────────────────────────────────────────────────┐
│ Client / AI Agent │
└────────────────────────┬────────────────────────────────┘
│ HTTP
┌────────────────────────▼────────────────────────────────┐
│ FastAPI (main.py) │
│ /courses /assignments /sync/* │
└──────────┬───────────────────────────┬──────────────────┘
│ │
┌──────────▼──────────┐ ┌────────────▼────────────────┐
│ mcp_tools.py │ │ notion_sync.py │
│ (business logic) │ │ (Notion API client) │
└──────────┬──────────┘ └─────────────────────────────┘
│
┌──────┴───────┐
│ │
┌───▼────┐ ┌──────▼──────┐
│db.py │ │d2l_client.py│
│(SQLAlc │ │(httpx + │
│ hemy + │ │ Valence API)│
│Postgres│ └─────────────┘
└───┬────┘
│
┌───▼───────────────┐
│ PostgreSQL │ ← persistent store
│ Redis (cache) │ ← TTL cache for D2L responses
└───────────────────┘______________________________________________________________________
端点
| 方法 | 路径 | 描述 |
|---|---|---|
GET | /health | 活体探针 |
GET | /courses | 列出所有已同步的课程 |
POST | /sync/courses | 从D2L获取课程→ PostgreSQL |
GET | /assignments/{course_id} | 列出课程作业 |
POST | /sync/{course_id}/assignments | 获取作业→ PostgreSQL |
GET | /quizzes/{course_id} | 列出课程的测验 |
POST | /sync/{course_id}/quizzes | 获取测验→ PostgreSQL |
GET | /syllabus/{course_id} | 从D2L获取教学大纲 |
POST | /sync/{course_id}/syllabus | 同步教学大纲→ 通知页面 |
完整的交互式文档可在 http://localhost:8000/docs 跑步时。
______________________________________________________________________
快速开始
使用Docker(推荐)
git clone https://github.com/larrywg/d2l-mcp-server-notion.git
cd campusmcp
cp .env.example .env
# Fill in D2L_API_TOKEN, NOTION_API_TOKEN in .env
docker compose up --buildAPI将在 http://localhost:8000.
没有Docker
# Requires Python 3.14+ and a running PostgreSQL instance
pip install uv
uv sync
cp .env.example .env
# Fill in all values in .env
uvicorn main:app --reload______________________________________________________________________
