Skip to main content
Glama

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:开发安装

  1. 克隆仓库:

git clone https://github.com/minagishl/nlobby-cli.git
cd nlobby-cli
  1. 安装依赖:

pnpm install
  1. 构建项目:

pnpm run build

配置

如果需要覆盖默认设置,请创建 .env 文件(可选):

NLOBBY_BASE_URL=https://nlobby.nnn.ed.jp
MCP_SERVER_NAME=nlobby-cli
MCP_SERVER_VERSION=1.0.0

CLI 使用方法

身份验证

# 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 health

MCP 服务器

# Start MCP server (stdio transport)
nlobby serve
# or
nlobby mcp

所有命令均支持 --json 参数,以输出原始 JSON 而非格式化文本。


MCP 使用方法

Cursor IDE 设置

安装 MCP 服务器

将以下内容添加到您的 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

描述

nlobby://news

学校新闻和通知

nlobby://schedule

每日课程表和活动

nlobby://required-courses

必修课程和学术信息

nlobby://user-profile

当前用户信息

MCP 工具

身份验证

工具

描述

interactive_login

打开浏览器进行手动登录(推荐)

login_help

个性化登录帮助和故障排除

set_cookies

手动设置身份验证 Cookie

check_cookies

检查身份验证 Cookie 状态

verify_authentication

验证所有客户端的身份验证状态

新闻

工具

关键参数

描述

get_news

category? limit? sort?

获取带有过滤条件的学校新闻

get_news_detail

newsId markAsRead?

特定文章的详细信息

mark_news_as_read

ids (数组)

将文章标记为已读

get_unread_news_info

未读计数和重要新闻标记

课程表与日历

工具

关键参数

描述

get_schedule

date?

指定日期的课程表 (YYYY-MM-DD)

get_calendar_events

calendar_type? from_date? to_date? period?

日历事件(个人/学校)

test_calendar_endpoints

from_date? to_date?

测试两个日历端点

get_calendar_filters

Lobby 日历过滤器定义

课程与考试

工具

关键参数

描述

get_required_courses

grade? semester? category?

带有进度跟踪的必修课程

check_exam_day

date?

检查某天是否为考试日

finish_exam_day_mode

结束考试日模式

get_exam_otp

获取考试一次性密码

账户与导航

工具

描述

get_account_info

从 Next.js 页面提取账户信息

get_student_card_screenshot

截取学生证截图

update_last_access

更新最后访问时间戳

get_navigation_menus

主导航菜单列表

get_notifications

通知消息

get_user_interests

用户兴趣标签(包含可选图标数据)

get_interest_weights

兴趣权重等级定义

调试

工具

关键参数

描述

health_check

测试 N Lobby API 连接

debug_connection

endpoint?

详细的连接调试

test_page_content

endpoint? length?

页面内容获取测试

test_trpc_endpoint

method params?

测试特定的 tRPC 端点


身份验证流程

方法 1:交互式浏览器登录(推荐)

CLI:

nlobby login

MCP 工具: interactive_login

浏览器窗口会自动打开。完成 N Lobby 登录后,Cookie 将被提取并保存。

  1. 在您的 Web 浏览器中登录 N Lobby

  2. 打开开发者工具 → 应用程序 (Application) / 存储 (Storage) → Cookie

  3. 将所有 Cookie 复制为字符串

CLI:

nlobby cookies set "__Secure-next-auth.session-token=ey...;"

MCP 工具: set_cookies cookies="__Secure-next-auth.session-token=ey...;"


用户类型

服务器根据电子邮件域名支持三种用户类型:

类型

电子邮件域名

学生

@nnn.ed.jp

教职员工

@nnn.ac.jp

家长

其他任何已注册的电子邮件


项目结构

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 文件。

Install Server
A
security – no known vulnerabilities
A
license - permissive license
B
quality - B tier

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