N Lobby MCP Server
N Lobby CLI
注意: 开发者不对使用此工具可能导致的任何损害承担责任。本软件仅为教育目的开发,不保证其运行效果。
一个用于访问 N Lobby 学校门户数据的双模式 CLI 和模型上下文协议 (MCP) 服务器。可以通过 nlobby 在终端交互式使用,或通过 nlobby serve 将其作为 MCP 服务器连接到 AI 助手。
功能特性
CLI 模式:直接从终端访问 N Lobby 数据——包括新闻、课程表、课程、个人资料等
MCP 模式:完全兼容 Claude、Cursor 及其他支持 MCP 的 AI 助手的 MCP 服务器
基于浏览器的身份验证:通过自动化的 Puppeteer 浏览器窗口进行交互式登录
会话持久化:CLI 模式将 Cookie 保存至
~/.nlobby/session,以便后续无缝使用学校信息访问:获取公告、课程表和学习资源
必修课管理:访问必修课信息和学术数据
多种日历类型:支持个人日历和学校日历
用户角色支持:针对学生、家长和教职员工的不同访问级别
Related MCP server: MCP Server Sample
安装
选项 1:从 npm 安装(推荐)
npm install -g nlobby-cli选项 2:开发安装
克隆仓库:
git clone https://github.com/minagishl/nlobby-cli.git
cd nlobby-cli安装依赖:
pnpm install构建项目:
pnpm run build配置
如果需要覆盖默认设置,请创建 .env 文件(可选):
NLOBBY_BASE_URL=https://nlobby.nnn.ed.jp
MCP_SERVER_NAME=nlobby-cli
MCP_SERVER_VERSION=1.0.0CLI 使用方法
身份验证
# Interactive browser login (recommended)
nlobby login
# Set cookies manually
nlobby cookies set "__Secure-next-auth.session-token=ey...;"
# Check current authentication status
nlobby cookies check新闻
# List latest news (default: 10, newest first)
nlobby news
# Filter and sort
nlobby news --limit 20 --category お知らせ --sort oldest --unread
# Show full article
nlobby news show 980
# Download the first attachment to /tmp
nlobby news download 980 --index 1 --output-dir /tmp
# Mark as read
nlobby news read 980课程表与日历
# Today's schedule
nlobby schedule
# Specific date
nlobby schedule 2026-04-01
# This week's personal calendar
nlobby calendar
# School calendar for a date range
nlobby calendar --type school --from 2026-04-01 --to 2026-04-07课程
# All required courses
nlobby courses
# Filter by grade / semester
nlobby courses --grade 2 --semester 2025个人资料与健康
nlobby profile
nlobby healthMCP 服务器
# Start MCP server (stdio transport)
nlobby serve
# or
nlobby mcp所有命令均支持
--json参数,以输出原始 JSON 而非格式化文本。
MCP 使用方法
Cursor IDE 设置
将以下内容添加到您的 Cursor 设置 (~/.cursor/config.json) 中:
{
"mcpServers": {
"nlobby": {
"command": "npx",
"args": ["-y", "nlobby-cli", "serve"],
"env": {
"NLOBBY_BASE_URL": "https://nlobby.nnn.ed.jp"
}
}
}
}Claude Desktop 设置
添加到您的 Claude Desktop 配置中(macOS 上位于 ~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"nlobby": {
"command": "npx",
"args": ["-y", "nlobby-cli", "serve"],
"env": {
"NLOBBY_BASE_URL": "https://nlobby.nnn.ed.jp"
}
}
}
}其他 MCP 客户端
对于任何兼容 MCP 的客户端,请使用:
命令:
nlobby serve(如果已全局安装)或node /path/to/dist/index.js serve协议:stdio
环境变量:配置部分中列出的可选环境变量
MCP 资源
URI | 描述 |
| 学校新闻和通知 |
| 每日课程表和活动 |
| 必修课程和学术信息 |
| 当前用户信息 |
MCP 工具
身份验证
工具 | 描述 |
| 打开浏览器进行手动登录(推荐) |
| 个性化登录帮助和故障排除 |
| 手动设置身份验证 Cookie |
| 检查身份验证 Cookie 状态 |
| 验证所有客户端的身份验证状态 |
新闻
工具 | 关键参数 | 描述 |
|
| 获取带有过滤条件的学校新闻 |
|
| 特定文章的详细信息 |
|
| 将文章标记为已读 |
| 未读计数和重要新闻标记 |
课程表与日历
工具 | 关键参数 | 描述 |
|
| 指定日期的课程表 (YYYY-MM-DD) |
|
| 日历事件(个人/学校) |
|
| 测试两个日历端点 |
| Lobby 日历过滤器定义 |
课程与考试
工具 | 关键参数 | 描述 |
|
| 带有进度跟踪的必修课程 |
|
| 检查某天是否为考试日 |
| 结束考试日模式 | |
| 获取考试一次性密码 |
账户与导航
工具 | 描述 |
| 从 Next.js 页面提取账户信息 |
| 截取学生证截图 |
| 更新最后访问时间戳 |
| 主导航菜单列表 |
| 通知消息 |
| 用户兴趣标签(包含可选图标数据) |
| 兴趣权重等级定义 |
调试
工具 | 关键参数 | 描述 |
| 测试 N Lobby API 连接 | |
|
| 详细的连接调试 |
|
| 页面内容获取测试 |
|
| 测试特定的 tRPC 端点 |
身份验证流程
方法 1:交互式浏览器登录(推荐)
CLI:
nlobby loginMCP 工具: interactive_login
浏览器窗口会自动打开。完成 N Lobby 登录后,Cookie 将被提取并保存。
方法 2:手动设置 Cookie
在您的 Web 浏览器中登录 N Lobby
打开开发者工具 → 应用程序 (Application) / 存储 (Storage) → Cookie
将所有 Cookie 复制为字符串
CLI:
nlobby cookies set "__Secure-next-auth.session-token=ey...;"MCP 工具: set_cookies cookies="__Secure-next-auth.session-token=ey...;"
用户类型
服务器根据电子邮件域名支持三种用户类型:
类型 | 电子邮件域名 |
学生 |
|
教职员工 |
|
家长 | 其他任何已注册的电子邮件 |
项目结构
src/
├── index.ts # Entry point — CLI vs MCP mode detection
├── config.ts # Configuration management
├── logger.ts # Logging utilities
├── trpc-client.ts # tRPC client for API calls
├── types.ts # TypeScript type definitions
├── api/
│ ├── index.ts # NLobbyApi facade + session persistence
│ ├── context.ts # ApiContext interface
│ ├── shared.ts # Shared utilities (fetchRenderedHtml, …)
│ ├── news.ts # News functions
│ ├── schedule.ts # Schedule / calendar functions
│ ├── courses.ts # Course / exam functions
│ ├── account.ts # Account info / student card functions
│ ├── navigation.ts # Navigation / notification / interest functions
│ └── health.ts # Health check / debug functions
├── auth/
│ ├── browser.ts # Puppeteer browser authentication
│ ├── nextauth.ts # NextAuth.js session handling
│ └── credentials.ts # Credential validation and guidance
├── cli/
│ ├── index.ts # Commander program wiring
│ ├── commands/ # login, news, schedule, courses, profile, health, serve
│ └── formatters/ # Human-readable output formatters
└── mcp/
└── server.ts # MCP server (28 tools, 4 resources)开发
脚本
pnpm run build # Build (esbuild bundle + tsc type declarations)
pnpm run dev # Watch mode
pnpm run start # Start MCP server
pnpm run lint # Lint
pnpm run format # Format安全说明
CLI Cookie 存储在
~/.nlobby/session中(纯文本 — 请妥善保护)MCP 模式仅将所有身份验证令牌保留在内存中
浏览器自动化仅用于身份验证,不用于数据抓取
不会记录任何敏感数据
许可证
本项目采用 MIT 许可证 — 详情请参阅 LICENSE 文件。
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/minagishl/nlobby-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server