透過 RESTful API 取得 Uedu 平台的公開課程與學校資料。所有請求皆需 API key 認證。
Authorization: Bearer <your_api_key>curl -H "Authorization: Bearer uedu_xxxxxxxx" \
https://uedu.tw/api/v1/universities
所有 /api/v1/* endpoint(除根路徑外)皆需要 API key。請使用 HTTP header:
Authorization: Bearer <your_api_key>
金鑰建立後只會完整顯示一次,請立即複製保存。資料庫僅儲存 SHA-256 hash,遺失需重建。
如需更高額度,請聯絡平台管理員。
GET /api/v1/universities取得大學列表。
Query 參數:
region — (可選)篩選地區GET /api/v1/courses取得公開課程列表(僅 is_public=1 的課程)。
Query 參數:
university — (可選)學校 code 或中文名稱semester — (可選)學期,例如 114-2q — (可選)課名關鍵字page — 預設 1page_size — 預設 20,最大 100GET /api/v1/courses/<course_id>取得單一公開課程詳情,包含課程目標與教學內容。
GET /api/v1/course_stats歷年公開課程開設統計,可依學期、年份或學校分組(不含個人資料)。
Query 參數:
university — (可選)學校 code 或中文名稱group_by — semester | year | school(預設 semester)GET /api/v1/papersUedu 團隊已發表的學術論文列表(教學實踐研究成果)。
Query 參數:
category — (可選)論文類別year — (可選)年份GET /api/v1/conferencesUedu 團隊參與的國際學術研討會列表。
以下是目前 Public API v1 與 MCP 對外提供的所有資料欄位。所有欄位皆屬於「公開課表級」低敏感資訊,敏感資料一律不會透過此 API 暴露。
/universitiesid、code、name_zh、name_en、short_name、region/courses僅包含教師明確設為「公開」的課程(is_public=1)
id、class_name、course_number、course_classcourse_name_chinese、course_name_englishinstructor、instructor_englishdepartment、department_english、schoolsemester、start_date、end_date/courses/<id>包含上述全部欄位,外加:
teaching_goal、teaching_goal_englishteaching_content、teaching_content_englishclass_memo/course_statskey(學期/年份/學校)、course_count、instructor_count/papersslug、title、title_zh、authors、conference、year、doi、category、uedu_feature、award/conferencesslug、name、name_short、year、dates、location、website、organizer、indexing、paper_count所有回應為 JSON,標準結構:
// 成功
{ "success": true, "data": {...} }
{ "success": true, "items": [...], "page": 1, "page_size": 20, "total": 150 }
// 失敗
{ "success": false, "error": "..." }
requests)# pip install requests
import requests
API_KEY = "uedu_xxxxxxxx"
BASE = "https://uedu.tw/api/v1"
headers = {"Authorization": f"Bearer {API_KEY}"}
# 1. 列出大學
r = requests.get(f"{BASE}/universities", headers=headers)
print(r.json())
# 2. 搜尋課程
r = requests.get(f"{BASE}/courses", headers=headers, params={
"university": "ncu",
"semester": "114-2",
"q": "人工智慧",
"page": 1,
"page_size": 20,
})
data = r.json()
for course in data["items"]:
print(course["id"], course["class_name"], course["instructor"])
# 3. 取得課程詳情
r = requests.get(f"{BASE}/courses/123", headers=headers)
print(r.json()["data"])
# 錯誤處理
if r.status_code == 401:
print("API key 無效或已撤銷")
elif r.status_code == 429:
print("已超過速率限制,請稍後再試")
elif r.status_code == 404:
print("找不到資源")
fetch)const API_KEY = "uedu_xxxxxxxx";
const BASE = "https://uedu.tw/api/v1";
const headers = { "Authorization": `Bearer ${API_KEY}` };
// 搜尋課程
const params = new URLSearchParams({
university: "ncu",
semester: "114-2",
page: 1,
page_size: 20,
});
const res = await fetch(`${BASE}/courses?${params}`, { headers });
if (!res.ok) {
if (res.status === 401) throw new Error("API key 無效");
if (res.status === 429) throw new Error("速率限制");
throw new Error(`HTTP ${res.status}`);
}
const data = await res.json();
console.log(data.items);
我們提供了一個 MCP(Model Context Protocol)server,讓你可以直接在 Claude Desktop、Claude Code、Cursor、VS Code 等支援 MCP 的工具中,用自然語言查詢 Uedu 的公開資料,完全不需要寫程式。
下載 uedu_mcp_server.py 並安裝依賴:
pip install mcp httpx
# 下載 server 腳本
curl -O https://uedu.tw/static/mcp/uedu_mcp_server.py
Claude Desktop
編輯設定檔:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json{
"mcpServers": {
"uedu": {
"command": "python",
"args": ["/absolute/path/to/uedu_mcp_server.py"],
"env": {
"UEDU_API_KEY": "uedu_xxxxxxxx"
}
}
}
}
儲存後重啟 Claude Desktop 即可生效。
Claude Code (CLI)
使用內建指令快速新增:
claude mcp add uedu \
--env UEDU_API_KEY=uedu_xxxxxxxx \
-- python /absolute/path/to/uedu_mcp_server.py
Cursor
編輯 ~/.cursor/mcp.json (全域)或專案內 .cursor/mcp.json:
{
"mcpServers": {
"uedu": {
"command": "python",
"args": ["/absolute/path/to/uedu_mcp_server.py"],
"env": {
"UEDU_API_KEY": "uedu_xxxxxxxx"
}
}
}
}
在 Cursor 的「Settings → MCP」頁面也可以圖形化新增。
VS Code
GitHub Copilot Chat 已支援 MCP(需 Agent Mode)。在專案根目錄建立 .vscode/mcp.json:
{
"servers": {
"uedu": {
"type": "stdio",
"command": "python",
"args": ["${workspaceFolder}/uedu_mcp_server.py"],
"env": {
"UEDU_API_KEY": "uedu_xxxxxxxx"
}
}
}
}
使用 Continue 擴充套件的話,也可在其設定中加入相同的 MCP server 區塊。
設定完成後,直接在對話中問:
LLM 會自動呼叫對應的 MCP tool,回傳結果並用自然語言摘要。