pku-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@pku-mcp 我这周还有哪些作业没交?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
pku-mcp 让你的 AI 助手能直接上北大教学网和校内门户:查作业和截止时间、看公告、下课件、看课表和成绩。开学时说一句话,它就能把整个学期的课程资料下载到你电脑里,按课程分好文件夹。
登录全自动:密码和手机令牌只在你自己的电脑上,过期了它会自己重新登录、自己生成动态口令,不用你每次手动输入。
一句话安装
把这句话发给你的 AI 助手(Claude Code、Codex、Cursor……能在你电脑上执行命令的都行):
请阅读 https://raw.githubusercontent.com/a1henu/pku-mcp/main/docs/install-for-agents.md ,按里面的步骤帮我安装 pku-mcp。接下来它会一步步带你做:装好后浏览器会打开一个本机网页,你在里面填学号和密码;如果开了手机令牌,再按页面提示粘贴一下令牌二维码;最后点「测试登录」就完成了。全程不需要把密码告诉 AI,电脑上也不用事先装 Python 或 Git。
Related MCP server: bb-mcp
装好以后,直接这样说
你说 | 它会做 |
「开学了,帮我把这学期的课程资料整理好」 | 下载每门课的课件、作业附件、公告附件,按课程归档,生成学期总览 |
「我这周还有哪些作业没交?」 | 列出未交作业、截止时间、作业要求 |
「明天几点在哪上课?」 | 查个人课表:节次、钟点、教室、单双周 |
「帮我做计算机网络的 lab2」 | 找到要求、下好附件,在作业文件夹里和你一起写(不会替你提交) |
「最近有什么新公告?」 | 汇总各课最新公告 |
「我上学期 GPA 多少?」 | 查成绩和绩点 |
整理出来的文件夹长这样,之后随时可以再说一次「同步一下资料」,只会补新文件,不会动你自己放进去的东西:
~/PKU/26-27学年第1学期/
├── README.md 学期总览:上课时间地点、考试、未交作业
├── 数据结构与算法/
│ ├── 课程信息.md 这门课的作业截止、公告、资料索引
│ └── 资料/ 作业/ 公告/
└── …更多用法见 功能与用法。
放心用
只在你的电脑上运行,直接连北大的网站,中间没有任何第三方服务器。
只读:只查询和下载,不会替你提交作业、选课,也不会改动教学网上的任何东西。
密码和令牌密钥存在
~/.pku-mcp(只有你的系统账户能读),AI 看不到。不用了运行pku-mcp forget一键删除。登录失败后会先暂停一会儿,避免把账号试到被北大锁住。
细节见 安全与隐私。
常见问题
没开手机令牌能用吗? 能,跳过令牌那一步就行。开了令牌但不想交给电脑也可以:目前作业、公告、资料登录时不需要令牌,只有课表和成绩需要。
怎么更新? 跟 AI 说「帮我更新 pku-mcp」,或者自己运行:
uv tool install --reinstall --refresh --python 3.12 https://github.com/a1henu/pku-mcp/archive/refs/heads/main.zipWindows 上请先退出 AI 应用再更新。
改了密码 / 换了令牌? 跟 AI 说「打开 pku-mcp 配置页」,或在终端运行 pku-mcp setup。
怎么卸载? pku-mcp forget 删除保存的账号,再 uv tool uninstall pku-mcp。
文档
功能与用法:全部工具、预设流程、命令行
许可证
MIT:可以自由使用、修改和分发,保留版权声明即可。
Available Tools
12 toolsannouncement_listB
教学网公告(新到旧):标题、发布时间、发布人、正文、附件。默认汇总本学期未隐藏的课程。
Inputs: limit, refresh, course_id, include_history. Returns: object
assignment_listA
教学网作业:截止时间 due_at(没有钟点时只有 deadline_raw)、是否已交、最后提交时间、成绩、要求和附件,按截止排序。
默认只列未交、跳过 hidden 课程;缓存 10 分钟,refresh=true 强制重新抓取。
已交不等于已评分;只在公告里布置的任务不在这里,需要再看 announcement_list。
Inputs: refresh, course_id, include_hidden, include_submitted. Returns: object
attachment_downloadA
下载一个教学网附件(url 来自其他工具的结果)到 dest 目录,默认 ~/PKU/下载。
不覆盖同名文件,内容相同则复用已有文件。返回本地路径、SHA-256 和大小。
Inputs: url (required), dest. Returns: object
auth_setupA
打开本机配置网页(只在 127.0.0.1),让用户在浏览器里填学号密码、绑定手机令牌、测试登录。
首次使用、换密码、令牌失效时调用。把返回的 url 告诉用户(浏览器通常已自动打开),等用户说完成后再调用 auth_status 确认。
Inputs: no named parameters. Returns: object
auth_statusA
本机配置与登录状态(不含密码、密钥、Cookie)。check_login=true 时实际验证教学网和门户,失效会自动重新登录。
Inputs: check_login. Returns: object
content_listB
一门课的教学内容(含子文件夹):标题、类型(作业/项目/文件/内容文件夹…)、所在栏目、正文和附件链接。
不给 query 时正文只截前 300 字;按标题或正文关键词 query 过滤时返回完整正文。
Inputs: course_id (required), kind, query, refresh. Returns: object
course_hideA
在本机把一门课标为退课/不关注(hidden=false 取消)。作业、公告和学期整理默认跳过它;不修改教学网。
Inputs: course_id (required), hidden. Returns: object
course_listB
教学网课程:course_id、名称、学期、hidden(用户标记的退课/不关注)。默认只列当前学期。
Inputs: refresh, include_history. Returns: object
grade_listB
各学期成绩与 GPA(校内门户)。term 形如 25-26-1 时只返回该学期。
Inputs: term, refresh. Returns: object
otp_codeA
当前手机令牌口令(OTP),供用户本人授权的北大网页登录使用。约 30 秒内有效,不要写进文件或日志。
Inputs: no named parameters. Returns: object
schedule_listA
个人课表(校内门户):星期、节次与钟点、地点、教师、周次、单双周、考试安排。
weekday 取 mon…sun;date 取 YYYY-MM-DD 会换算成星期。term 形如 26-27-1,默认当前学期。 工具不推断教学周,单双周需要结合当前是第几周判断。
Inputs: date, term, refresh, weekday. Returns: object
semester_syncA
整理学期资料:把每门课的资料、作业附件、公告附件下载到本机,按「课程/资料|作业|公告/条目」分文件夹, 并生成学期总览 README.md 和每门课的 课程信息.md(上课时间地点、考试、作业截止与状态、公告、资料索引)。
dest 默认 ~/PKU/<学期名>。可反复调用,只补新文件,不覆盖、不删除已有文件;超过 max_file_mb 的文件跳过并列出。
单次调用约 45 秒,返回 done=false 时用相同参数再调用,直到 done=true。course_id 只整理一门课。
Inputs: dest, course_id, max_file_mb, include_hidden. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Most tools target clearly distinct resources: auth_setup (browser wizard), auth_status (state check), and otp_code (token) are separable by their descriptions, as are course_list vs course_hide. The only mild overlap is between content_list (which includes 作业/项目 items inside course folders) and assignment_list, plus semester_sync vs attachment_download, but the descriptions explicitly cross-reference and clarify these boundaries.
All names use consistent snake_case with a predictable noun_action or noun_list pattern (course_list, course_hide, attachment_download, semester_sync, auth_setup). A few names are noun-only (otp_code) or aggregate-style (semester_sync), which is a minor deviation but still readable and predictable.
Twelve tools is well within the ideal 3-15 range and each maps to a distinct capability: auth, OTP, courses, assignments, grades, announcements, content, downloads, semester sync, schedule. No tool feels redundant or padded.
The surface covers the read-only lifecycle well: authentication, course listing/hiding, assignments, grades, announcements, course content, attachment download, bulk semester sync, and schedule/exams. Minor gaps exist, such as no per-assignment detail/submission view and content_list requiring a course_id with no cross-course search, but these are workable.
Maintenance
Related MCP Connectors
Connect AI assistants to Edusign attendance, courses, learners, documents, and API docs via OAuth.
Your personal data for AI — Telegram, bank, courses, Zoom & more, scoped to you.
Build study flashcards and exam-prep decks from your AI chat, all stored locally.
Web search, data extraction and controlled browser automation for AI assistants via OAuth.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to directly query Chaoxing/Xuexitong courses and homework status via fast HTTP calls, with persistent login and automatic re-authentication.16MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to interact headlessly with the CUHK-SZ Blackboard instance, including downloading courseware, inspecting and submitting assignments, and reading announcements via automatic credential-based login.4MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to read courses, upcoming deadlines, assignment details, grades, announcements, modules, files, inbox, and timetable from U of T Quercus and ACORN through read-only tools.1MIT
- AlicenseAqualityBmaintenanceEnables AI assistants to read a student's own university academic data — class timetables, exam schedules, grades, available terms, and empty classrooms — from Qiangzhi (jsxsd) or Zhengfang V9 systems via a session imported from the browser. All access is strictly read-only, never performing course selection, withdrawal, or evaluations.61MIT