sjtu-pan-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., "@sjtu-pan-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.
sjtu-pan-mcp — 交大云盘 MCP 工具
⚠️ AI 辅助生成,谨慎使用
📢 免责声明:本项目与上海交通大学没有任何关系,是第三方个人开发者生成的非官方工具,不代表官方立场。
让 AI agent 直接浏览上海交通大学云盘(pan.sjtu.edu.cn)里的文件,并下载到本地。
基于对交大云盘 Web 前端实际接口的逆向(两层 API:user_token 会话层 → 空间 access_token 层),不接触账号密码,只复用一次扫码登录产生的会话。
适用任何支持 MCP 的客户端:ZCode、Claude Code、Claude Desktop、Cherry Studio 等。
功能
工具 | 作用 |
| 弹出浏览器窗口扫码登录(jAccount),自动保存登录态 |
| 账户信息与登录态自检(用户、组织、空间列表) |
| 列出全部空间(个人空间/团队空间) |
| 列出某个目录下的文件和子目录 |
| 全局搜索文件(关键词) |
| 查看单个文件/目录的元信息 |
| 下载单个文件到本地 |
| 递归下载整个目录(保留子目录结构) |
Related MCP server: yifangyun-mcp-server
安装
pip install "sjtu-pan-mcp[gui,cookie]"或从源码安装:
git clone https://github.com/Mccount666/sjtu-pan-mcp.git
cd sjtu-pan-mcp
pip install ".[gui,cookie]"gui:弹窗扫码登录用的 Playwright(装完执行一次playwright install chromium)cookie:可选的“从本地浏览器 cookie 库提取登录态”备选路径
安装后得到命令行入口 sjtu-pan-mcp。
配置(三步)
第一步:登录
交大云盘用 jAccount 登录。本工具不接触你的账号密码——运行:
sjtu-pan-mcp login会发生这些事:
自动弹出一个浏览器窗口,打开交大云盘登录页并自动跳到 jAccount 统一身份认证页
你用交我办 App 或微信扫码(也可以账号密码登录)
登录态被自动抓取并校验,写入配置文件,窗口自动关闭
也可以让 agent 代劳:对 agent 说“登录交大云盘”,它会调用 pan_login 工具,同样弹窗,并阻塞等待你扫码完成。
如果弹窗登录不可用(比如无桌面环境),用手动兜底:浏览器登录 pan.sjtu.edu.cn 后,F12 → 应用程序/Application → Cookies → https://pan.sjtu.edu.cn → 复制 USER_TOKEN 的值,写入配置文件(见下一步)的 user_token 字段。
第二步:确认登录态
sjtu-pan-mcp status输出账户、组织和空间列表即成功。登录态默认存放在:
~/.sjtu-pan-mcp/config.json # Windows: C:\Users\<你>\.sjtu-pan-mcp\config.json完整配置示例(仓库里的 config.example.json):
{
"user_token": "登录后自动写入;也可手动粘贴 USER_TOKEN cookie 值",
"default_download_dir": "~/Downloads/sjtu-pan",
"organization_id": 0,
"allowed_url_hosts": [
"pan.sjtu.edu.cn",
".sjtu.edu.cn",
".myqcloud.com",
".qcloud.com"
]
}配置项 | 说明 |
| 登录态(必填)。 |
| 默认下载目录,不填则为 |
| 固定组织(多组织账号用,0 = 自动选择) |
| 出站请求主机白名单(安全加固,见下) |
也可以用环境变量(优先级高于配置文件):
环境变量 | 作用 |
| 直接传登录态 |
| 指定配置文件路径 |
| 指定配置目录 |
第三步:接入 MCP 客户端
在客户端的 MCP 配置里加一个 stdio 服务器(以安装后的可执行文件路径为准):
{
"mcpServers": {
"sjtu-pan": {
"command": "sjtu-pan-mcp",
"args": [],
"env": {}
}
}
}Windows 上如果 sjtu-pan-mcp 不在 PATH,写成完整路径,例如:
{
"mcpServers": {
"sjtu-pan": {
"command": "C:\\Users\\<你>\\AppData\\Local\\Programs\\Python\\Python313\\Scripts\\sjtu-pan-mcp.exe",
"args": [],
"env": {}
}
}
}登录态在 ~/.sjtu-pan-mcp/config.json 里全局共享,多个客户端无需分别登录。配置好后重启客户端,对 agent 说“看看我交大云盘里有什么”即可。
token 过期怎么办
登录态有效期取决于登录时是否勾选“记住登录态”(约 10 天,否则约 2 小时)。过期时任何工具会返回 InvalidUserToken,重新跑一次 sjtu-pan-mcp login 或让 agent 调 pan_login 扫码即可。
安全约束
所有出站请求仅允许
http/https,且目标主机必须在白名单内(默认pan.sjtu.edu.cn、.sjtu.edu.cn及其 S3 存储域名)请求前校验主机名及其解析 IP,拒绝 localhost、环回、私有、链路本地、保留和多播地址——防止 SSRF 打到内网
重定向逐跳重新校验;远程文件名会做净化(剥离路径分隔符、NTFS ADS、保留设备名),且本地落盘路径被限制在目标目录内
本项目不存储、不上传任何账号密码;配置文件中只有会话 token,
config.json已被.gitignore排除
使用示例
“看看我交大云盘个人空间根目录有什么” →
pan_list_dir“把 /论文/2026 整个目录下载到 D:\pan-download” →
pan_download_dir“搜一下云盘里叫 paper 的文件” →
pan_search“下载 /论文/2026/paper.pdf 到桌面” →
pan_download_file
开发备注
项目结构:
src/sjtu_pan_mcp/(client.py两层 API 客户端、login.py弹窗登录、auth.py登录态解析、security.pyURL 校验、server.pyMCP 工具)测试:
python smoke_test.py(本地逻辑 + 有 token 时的真实列目录/下载)、python smoke_mcp.py(MCP 协议握手)、python test_gui_login_e2e.py(弹窗登录全链路,注入 cookie 模拟扫码)已知细节:文件下载是 302 到预签名 S3 URL,跟随重定向时不能携带原 query 参数否则签名失效;
user_id参数仅用于流量统计接口响应字段未公开文档,客户端对 JSON 形状做了容错解析;如交大云盘改版,优先改
client.py里的归一化函数
Contributors
Mccount666 — 项目作者
Claude — AI 辅助开发
License
Available Tools
8 toolspan_accountB
交大云盘账户信息与登录态自检(用户ID、组织、空间列表)
Inputs: no named parameters.
pan_download_dirA
递归下载交大云盘整个目录到本地(保留子目录结构)
Inputs: remote_dir (required), space, local_dir, max_files.
pan_download_fileB
把交大云盘上的单个文件下载到本地目录
Inputs: remote_path (required), space, local_dir.
pan_file_infoA
查看交大云盘单个文件/目录的元信息(大小、修改时间等)
Inputs: path (required), space.
pan_list_dirB
列出交大云盘某个目录下的文件和子目录
Inputs: path, space.
pan_list_spacesA
列出交大云盘的全部空间(个人空间/团队空间),含 space_id
Inputs: no named parameters.
pan_loginA
弹出浏览器窗口登录交大云盘(jAccount 扫码/账号密码),登录成功后自动保存登录态。调用后会阻塞等待用户完成登录
Inputs: timeout.
pan_searchA
在交大云盘全局搜索文件(按关键词)
Inputs: keyword (required), space.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
每个工具都有明确用途:下载目录 vs 下载文件、列出空间 vs 列出目录、搜索 vs 文件信息等,没有任何重叠或混淆。登录与账户检查也区分清晰。
所有工具以 pan_ 前缀开头,但动词模式不一致:有 pan_download_dir/file 和 pan_list_spaces/dir 使用动词+名词,而 pan_search、pan_account、pan_login、pan_file_info 则混合了纯动词和名词形式,缺乏统一模式。
8个工具对于一个云盘访问服务器来说是合理的,覆盖了登录、账户、列表、搜索、下载等核心操作,既不过多也不显单薄。
明显缺少上传、删除、创建目录、重命名等写入操作,整个工具集仅限于读取和下载。对于云盘服务,这是一个显著缺口,可能导致用户无法完成完整工作流。
Maintenance
Related MCP Connectors
Swiss encrypted cloud drive for Claude, ChatGPT and AI agents: search, read and save files.
Search, organize and share the files in your S3-compatible buckets from your AI assistant.
Persistent file storage for AI agents. Save files over MCP, get a link a human can open.
Persistent file storage for AI agents via MCP and curl. Upload, download, and version files.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn implementation of the Model Context Protocol that allows AI models to interact with 360 AI Cloud Drive, providing comprehensive file management capabilities including uploading, downloading, searching, and sharing files.1149 npm5Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to access Yifangyun cloud drive via MCP, supporting queries of enterprise organization, department folders, file details, and download links.52 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to manage files on Synology NAS via the File Station API, supporting operations like browsing, searching, uploading/downloading, creating, renaming, copying, moving, deleting, compressing, and extracting.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to manage China Unicom Cloud Drive files and shares through 25 MCP tools, including upload/download, organization, trash handling, and batch backup, with destructive actions previewed by default.1MIT