Skip to main content
Glama

YKB-MCP

医考帮(yikaobang)个人账号数据 MCP 服务器。让 AI Agent(Claude、opencode 等任何支持 MCP 的客户端)读取你在医考帮的评论、评论点赞、错题、收藏、笔记、已斩题目,并支持少量写操作(点赞评论、发表评论、斩题)。

协议实现参考并提炼自开源项目 nanguaguag/yibubang(医不帮,MIT License)中对医考帮官方 App 接口的逆向与抓包成果,在此致谢。

免责声明:本项目为非官方工具,仅用于读取你自己账号的数据、辅助个人学习。请遵守医考帮用户协议与相关法律法规;内置限速以避免对官方服务器造成压力;请勿使用本工具批量抓取、传播题库内容。使用风险自负。

功能一览

分组

工具

说明

账号

ykb_login

打开本地网页登录(127.0.0.1 一次性页面),密码不经过 AI 对话

账号

ykb_login_status

查询网页登录进度/结果

账号

ykb_whoami / ykb_logout

登录状态与缓存统计 / 退出

账号

ykb_identities

身份树(可用题库:临床期末、口腔期末、执业医师等)

做题

ykb_answer_records

做题记录,filter=wrong|cut|right|all(错题/已斩/做对)

题目

ykb_chapters

科目/章节目录(含题量)

题目

ykb_chapter_questions

整章题目(DES 解密:题干/选项/答案/收藏/已斩标记)

题目

ykb_question

单题详情(缓存优先,含解析)

收藏

ykb_collections

收藏列表(缓存优先 + 实验性接口探测)

收藏

ykb_collections_scan

按章节扫描收藏标记(限速、断点续传)

评论

ykb_comments

题目热门评论(最多点赞/最高热度/最多回复/最新)

评论

ykb_my_praises / ykb_my_comments

某题下我点赞的 / 我发表的评论

评论

ykb_my_praises_all / ykb_my_comments_all

全局我点赞的 / 我发表的评论(缓存+增量扫描)

笔记

ykb_notes / ykb_notes_all

某题笔记 / 全局笔记归纳

同步

ykb_sync

批量同步点赞/评论/笔记到本地缓存(限速、可续跑)

搜索

ykb_search_local

本地缓存全文搜索(题干/评论/笔记)

写

ykb_praise_comment

【写】点赞评论

写

ykb_publish_comment

【写】发表评论

写

ykb_cut_question

【写】斩题/取消斩题

Related MCP server: Mfuns MCP Server

安装

需要 Python ≥ 3.10。推荐 uv:

git clone https://github.com/pkx07/YKB-MCP.git
cd YKB-MCP
uv sync

配置 MCP 客户端

opencode

opencode.json:

{
  "mcp": {
    "ykb": {
      "type": "local",
      "command": ["uv", "run", "--directory", "/path/to/YKB-MCP", "ykb-mcp"],
      "enabled": true
    }
  }
}

Claude Desktop / Claude Code

{
  "mcpServers": {
    "ykb": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/YKB-MCP", "ykb-mcp"]
    }
  }
}

也可以 uv pip install -e . 后直接使用 ykb-mcp 命令(stdio 传输)。

使用流程

  1. 对 Agent 说「登录医考帮」,调用 ykb_login() 会在本机启动一个仅 127.0.0.1 可访问的一次性登录页并自动打开浏览器。手机号和密码在浏览器里输入,由本地进程直接提交官方接口,全程不经过 AI 对话。登录成功后凭据保存在 ~/.ykb-mcp/credentials.json(仅 token/secret/user_id,权限 600,不存储密码)。页面 5 分钟有效,连续失败 5 次自动关闭。

    • 也可以不经 agent 手动登录:uv run ykb-mcp-login

  2. ykb_identities 查看题库身份 → ykb_answer_records(identity_id, filter="wrong") 拉错题。

  3. ykb_chapters → ykb_chapter_questions 获取题目内容;ykb_question 查单题解析。

  4. ykb_my_praises_all / ykb_my_comments_all / ykb_notes_all 全局归纳;首次调用会限速增量扫描,remaining>0 时重复调用续扫,或用 ykb_sync 批量同步。

  5. ykb_search_local 在本地缓存中搜索。

数据与限速

  • 缓存:~/.ykb-mcp/cache.db(SQLite)。可用环境变量 YKB_MCP_HOME 改目录。

  • 所有请求自动限速约 1.2~2 秒/请求(YKB_MCP_MIN_INTERVAL / YKB_MCP_JITTER 可调),模拟正常刷题节奏,降低风控风险。

  • 登录过期(业务码 309)会自动清除凭据并提示重新登录;203 表示章节无权限(VIP/题库未购买)。

  • 官方没有「收藏/我的评论/我的点赞/笔记」的全局列表接口(参考实现亦按题扫描),本工具用「已做题集合 + 限速扫描 + 本地缓存」归纳,首次全量扫描较慢,请耐心续跑。

真实账号冒烟测试

uv run python -m ykb_mcp.smoke

密码在本机交互输入(getpass),只调用只读接口,验证登录/身份树/做题记录/章节解密/评论/笔记全链路。

开发

uv sync
uv run pytest

单元测试覆盖:签名算法(固定向量)、DES 解密(来自参考仓库的真实接口密文)、请求头/凭据注入/309 处理、缓存层、以及基于 Mock 传输的全部 MCP 工具端到端测试。

协议与接口细节见 docs/PROTOCOL.md。

许可证

MIT

Available Tools

23 tools
ykb_answer_recordsYkb Answer RecordsA

拉取账号在指定身份(题库)下的做题记录。filter: all=全部, wrong=错题, cut=已斩题, right=做对的题。记录含 question_id、我的答案、对错、已斩状态、用时、更新时间;写入本地缓存。identity_id 来自 ykb_identities,父身份自动展开为叶子身份逐个拉取(限速)。refresh=False 仅读缓存。

Inputs: identity_id (required), limit, app_id, filter, +1 more. Returns: object

ykb_chapter_questionsYkb Chapter QuestionsA

拉取并解密一个章节的全部题目(题干、选项、答案、收藏/已斩标记),写入本地缓存。full=True 时额外包含解析(内容较长)。chapter_id 来自 ykb_chapters。无权限章节返回 203 提示。

Inputs: chapter_id (required), identity_id (required), full, am_pm, +2 more. Returns: object

ykb_chaptersYkb ChaptersA

获取指定身份下的科目/章节目录(含每章题量),用于定位 ykb_chapter_questions 的 chapter_id。identity_id 建议用 ykb_identities 中的叶子身份或可选学科节点。

Inputs: identity_id (required), app_id, refresh, module_type. Returns: object

ykb_collectionsYkb CollectionsA

获取账号收藏的题目。优先读本地缓存;refresh=True 时探测官方收藏列表接口(实验性)。探测不到时用 ykb_collections_scan 按章节扫描收藏标记。

Inputs: refresh, identity_id. Returns: object

ykb_collections_scanYkb Collections ScanA

按章节扫描指定身份下的收藏标记(is_collection_question),结果写入本地缓存。budget=本次最多扫描章节数(每章 1 请求,自动限速);断点续传,重复调用直到 remaining=0。

Inputs: identity_id (required), budget. Returns: object

ykb_commentsYkb CommentsA

获取某题的热门评论。sort: likes=最多点赞, hot=最高热度, replies=最多回复, newest=最新发布。列表中本人已点赞/已发表的评论会自动归档到本地缓存。题目元数据优先从缓存解析,必要时显式传 identity_id/subject_id/app_id。

Inputs: question_id (required), page, sort, app_id, +2 more. Returns: object

ykb_cut_questionYkb Cut QuestionB

【写操作】斩题/取消斩题(标记该题已掌握),会改动账号数据,请谨慎使用。需要 chapter_id(题目已缓存时自动读取,否则请显式传入)。

Inputs: question_id (required), cut, app_id, chapter_id, +2 more. Returns: object

ykb_identitiesYkb IdentitiesA

获取医考帮身份树(可用题库/学期,如临床期末、口腔期末、执业医师)。返回扁平身份列表:identity_id、名称、路径、是否叶子。做题记录/章节工具需要 identity_id;父身份会自动展开为叶子身份。默认读缓存,refresh=True 强制刷新。

Inputs: refresh. Returns: object

ykb_loginYkb LoginA

打开本地网页登录医考帮:在 127.0.0.1 启动一次性登录页并自动打开浏览器(结果中也附 URL)。手机号与密码由用户在浏览器中输入,由本地进程直接提交官方接口,全程不经过对话。严禁向用户索要手机号/密码。默认等待登录完成(120 秒);返回 pending 时让用户继续操作,之后用 ykb_login_status 查询。凭据仅存本地 ~/.ykb-mcp/credentials.json(600 权限),不存储密码。

Inputs: wait_seconds. Returns: object

ykb_login_statusYkb Login StatusA

查询本地网页登录的进度与结果(ykb_login 返回 pending 后使用)。logged_in=true 表示登录成功。

Inputs: no named parameters. Returns: object

ykb_logoutYkb LogoutA

退出当前医考帮账号:清除本地凭据,保留缓存数据。

Inputs: no named parameters. Returns: object

ykb_my_commentsYkb My CommentsC

获取某题下我发表过的评论(官方 func=mycomment),写入本地缓存。

Inputs: question_id (required), app_id, subject_id, identity_id. Returns: object

ykb_my_comments_allYkb My Comments AllA

全局「我发表过的所有评论」列表:先读本地缓存,再对未扫描的已做题限速增量扫描(scan_budget=本次请求数)。remaining>0 时重复调用可续扫;全量同步用 ykb_sync(scope='mycomment')。identity_id 可选,限定某个题库。

Inputs: limit, identity_id, scan_budget. Returns: object

ykb_my_praisesYkb My PraisesB

获取某题下我点赞过的评论(官方 func=mypraise),写入本地缓存。

Inputs: question_id (required), app_id, subject_id, identity_id. Returns: object

ykb_my_praises_allYkb My Praises AllA

全局「我点赞过的所有评论」列表:先读本地缓存,再对未扫描的已做题限速增量扫描(scan_budget=本次请求数)。remaining>0 时重复调用可续扫;全量同步用 ykb_sync(scope='praise')。identity_id 可选,限定某个题库。

Inputs: limit, identity_id, scan_budget. Returns: object

ykb_notesYkb NotesA

获取某题下我的笔记(官方 getNote,含笔记图片 URL),写入本地缓存。题目元数据优先从缓存解析,必要时显式传 identity_id/subject_id/app_id。

Inputs: question_id (required), page, size, app_id, +2 more. Returns: object

ykb_notes_allYkb Notes AllA

全局「我的所有笔记」列表:先读本地缓存,再对未扫描的已做题限速增量扫描(scan_budget=本次请求数)。remaining>0 时重复调用可续扫;全量同步用 ykb_sync(scope='notes')。identity_id 可选,限定某个题库。

Inputs: limit, identity_id, scan_budget. Returns: object

ykb_praise_commentYkb Praise CommentB

【写操作】给一条评论点赞,会改动账号数据,请谨慎使用。成功后自动归档到本地「我的点赞」。comment_id 可来自 ykb_comments。

Inputs: comment_id (required), question_id (required), app_id, subject_id, +1 more. Returns: object

ykb_publish_commentYkb Publish CommentB

【写操作】在某题下发表评论,会改动账号数据,请谨慎使用。成功后自动归档到本地「我的评论」。

Inputs: content (required), question_id (required), app_id, subject_id, +1 more. Returns: object

ykb_questionYkb QuestionA

获取单题完整内容(题干、选项、答案、解析)。优先读缓存;未命中时尝试官方 question/info 接口;提供 identity_id+chapter_id 可整章定位。

Inputs: question_id (required), app_id, chapter_id, identity_id. Returns: object

ykb_search_localYkb Search LocalA

在本地缓存中按关键词搜索(questions=题干, comments=评论内容, notes=笔记内容, all=全部)。数据来自此前拉取/同步过的内容,不发起网络请求。

Inputs: keyword (required), kind, limit. Returns: object

ykb_syncYkb SyncA

批量同步我的点赞/我的评论/我的笔记到本地缓存(限速、断点续传)。scope: praise|mycomment|notes|all。budget=每个类别本次最多扫描题数。重复调用直到各类别 remaining=0。扫描范围=已做题∪已缓存题目∪已有评论/笔记的题目。

Inputs: scope, budget, identity_id. Returns: object

ykb_whoamiYkb WhoamiA

查询当前医考帮登录状态与本地缓存统计(题目/做题记录/评论/笔记/收藏数量)。

Inputs: no named parameters. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 23 tools

    Disambiguation3/5

    Core tools (identity tree, chapters, chapter questions, single question, answer records) are clearly separated, but there are several near-duplicate families: ykb_collections vs ykb_collections_scan, and the per-question (ykb_my_praises/ykb_my_comments/ykb_notes) vs global (_all) vs bulk ykb_sync trio. Descriptions do explain which to use when, but an agent still has to reason about cache-first vs incremental-scan vs full-sync before picking.

    Naming Consistency3/5

    All names share a stable ykb_ prefix and snake_case, with consistent suffixes (_all, _scan, _status), which helps readability. However, the convention is mixed: most names are resource nouns (ykb_chapters, ykb_question, ykb_notes) while others are verb-led (ykb_login, ykb_search_local, ykb_sync, ykb_publish_comment, ykb_cut_question), so there is no single predictable verb_noun pattern.

    Tool Count3/5

    23 tools is heavy for the apparent scope; the auth trio (login/login_status/whoami/logout) plus the three parallel _all scan tools and ykb_sync create redundancy that could be consolidated. Each tool does have a stated role, so it is over-scoped rather than bloated with filler.

    Completeness4/5

    Coverage of the read/analysis lifecycle is strong: auth/lifecycle, identity tree, chapters, questions, answer records, collections, comments, notes, and batch sync with resume. Gaps exist on the write side — no tool to add/remove a question collection and no note create/edit/delete, while comments and 斩题 are writable — which will leave some user workflows as dead ends.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to directly operate Zhihu, including login, publishing articles and videos, searching content, getting recommendations, and commenting.
      7
      -
    • F
      license
      A
      quality
      C
      maintenance
      Enables AI agents to browse, interact with, and manage Mfuns community content through 17 standardized MCP tools, including feeds, threads, posts, comments, reactions, and video publishing.
      19
      1
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI clients to read and write Yuque documents through MCP, providing tools for managing user info, knowledge bases, and documents with dual authentication modes (official API or cookie).
      4
      -
    • A
      license
      A
      quality
      B
      maintenance
      Enables 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.
      6
      1
      MIT