Skip to main content
Glama

byr-mcp

让 Codex、Claude 等 Agent 检索并读取北邮人论坛。项目采用本地优先架构:论坛数据只写入 你自己的 SQLite 索引,MCP 只提供只读检索和阅读工具,不包含发帖、回帖、私信或用户画像。

已实现

MCP 工具:

  • search_posts(query, board?, start_date?, end_date?, limit?, offset?):中文/英文全文检索, 每个主题返回最相关命中、原帖 URL 和明确的索引覆盖说明。

  • get_thread(board, thread_id, page?, max_chars_per_post?):读取主题分页正文并回填本地索引。

  • get_board(board, page?):用本机保存的登录会话浏览版面目录并回填主题目录。

  • get_top10(limit?, preview_chars?):当前十大与首帖预览,同时更新本地索引。

  • get_index_status():查看版面、主题、正文、日期范围、数据源和覆盖限制。 同时返回最近一次全站增量检查时间 recent_sync_at

索引与同步:

  • SQLite FTS5 trigram,支持中文连续词;一至两个汉字自动回退到安全的子串检索。

  • 导入 byr-topten 2018-03-25 至 2024-12-09 的历史十大目录。

  • 匿名发现公开版面,同步当前十大和全部版面 RSS;GBK/GB2312 脏字节容错。

  • 按搜索命中补抓全部楼层;登录后从移动端分区树枚举账号可见版面(本次实测 286 个), 再与历史索引中已知版面合并,同步历史目录和正文。

  • 单请求串行、可配置限速、超时重试、去重、逐页 checkpoint,可中断后继续。

  • 交互登录只把 session Cookie 存入系统钥匙串;密码读取后立即丢弃,不进入参数、日志、 配置或 SQLite。论坛刷新临时会话键时客户端会更新 CookieJar,并将新会话写回钥匙串。 也支持运行时 BYR_SESSION_COOKIE

  • 不请求用户资料,不保存帖子返回的 QQ/IP/头像/用户统计,不下载附件。

Related MCP server: directory-indexer

当前这台机器的状态

项目已安装并注册为 Codex MCP byr。默认索引位于:

/Users/limit/Library/Application Support/byr-mcp/forum.sqlite3

初始索引已实际导入历史十大和公开版面最新 RSS。随时查看精确状态:

cd /Users/limit/byr-mcp
uv run byr-mcp status

示例:

uv run byr-mcp search '学六 宿舍' --limit 20
uv run byr-mcp sync query '学六' --limit 30

第二条命令会读取本地标题/预览命中的主题,把论坛当前仍可访问的完整楼层写入全文索引。 历史主题可能已被论坛删除;这类结果会保留题名、日期和原始 URL,并明确标记正文未索引。

安装、测试与 Agent 接入

环境要求:Python 3.12、uv

cd /Users/limit/byr-mcp
uv sync --all-groups
uv run ruff check .
uv run pytest

真实论坛低频冒烟测试默认跳过:

BYR_RUN_LIVE_TESTS=1 uv run pytest tests/test_live.py -vv

注册本地 STDIO Server:

codex mcp add byr -- /Users/limit/.local/bin/uv run \
  --directory /Users/limit/byr-mcp byr-mcp
codex mcp get byr

不带子命令的 byr-mcp 就是 STDIO Server;它安静等待 MCP Host 从 stdin 发送请求是正常的。 Codex 桌面端、CLI 和 IDE 扩展在同一 host 上共享 MCP 配置。配置样例见 docs/codex-config.toml

Claude Code

Claude Code 支持本项目使用的本地 STDIO MCP。下载或克隆项目后可一键安装到当前用户的所有 Claude Code 项目:

./scripts/install-claude-code.sh

等价的手工命令是:

claude mcp add --scope user --transport stdio byr -- \
  /绝对路径/uv run --directory /绝对路径/byr-mcp byr-mcp
claude mcp get byr

--scope user 表示所有 Claude Code 项目均可使用;若只想在当前项目启用,改为 --scope local。论坛会话仍由 byr-mcp 从本机钥匙串读取,不写进 Claude 配置。

可以直接对 Agent 说:

检索北邮人论坛关于“学六 宿舍”的帖子,读取最相关的正文,按居住条件、网络、卫生、
噪音和设施做总结;区分帖子事实与个人观点,给出原帖链接和索引覆盖范围。

建立索引

无账号:立即可用的公开索引

# 历史十大题名/URL/日期/回复数;默认从 GitHub 下载公开归档
uv run byr-mcp sync history

# 当前十大 + 所有已发现版面的公开 RSS
uv run byr-mcp sync public --delay 0.8

# 按命中补抓仍可访问主题的完整正文
uv run byr-mcp sync query '保研 挑战杯' --limit 30 --delay 0.8

这条路线覆盖面很实用,但不能声称“整个论坛”:历史归档只包含上过十大者,公开 RSS 只保留 各版近期条目,部分旧帖正文也已从论坛删除。search_posts.coverage 会始终把这个限制带给 Agent。

有账号:账号可见范围的全站索引

先在你自己的终端交互登录。不要把密码发给 Agent,也不要写进 .env

uv run byr-mcp auth login --username 你的论坛ID
uv run byr-mcp auth status

然后先快速建立全站主题目录,再按需或全量同步正文:

# 可中断、可续传;再次运行会从各版 checkpoint 继续
uv run byr-mcp sync full --catalog-only --delay 1.0

# 先只抓与问题相关的正文
uv run byr-mcp sync query '学六 宿舍' --limit 50 --delay 1.0

# 如果确实要把账号可见主题正文全部本地化(可能运行很久)
uv run byr-mcp sync full --content-only --delay 1.0

# 长期运行:定时发现新帖/新回复,同时分批补齐历史正文
uv run byr-mcp sync watch --interval 900 --delay 0.5

全站正文同步支持逐主题断点续跑,并使用本地进程锁避免两个全量任务同时抓取。即使进程中断,重新运行同一命令也只会继续尚未完成的主题。 sync watch 每个周期扫描账号可见版面的第一页;新主题或回复数/最后回复时间发生变化的主题会 立即刷新首尾页。默认约每 15 分钟一轮,并在间隙分批补历史正文。

小范围试跑:

uv run byr-mcp sync full --board Picture --max-pages-per-board 2 \
  --max-threads 20 --max-pages-per-thread 3 --delay 1.0

登出只删除系统钥匙串中的 session:

uv run byr-mcp auth logout

CLI 一览

byr-mcp                         启动 STDIO MCP
byr-mcp serve                   同上
byr-mcp status                  索引覆盖状态
byr-mcp search QUERY            本地全文检索
byr-mcp auth login|status|logout
byr-mcp sync history            历史十大目录
byr-mcp sync public             当前公开数据
byr-mcp sync query QUERY        按命中补正文
byr-mcp sync recent             单次发现新帖并刷新最新正文
byr-mcp sync watch              持续追踪新内容并补历史正文
byr-mcp sync full               登录后的全站目录/正文同步

所有命令支持全局 --database PATH,测试或多账号隔离时可使用独立索引。

数据边界与使用原则

  • “全站”指当前论坛账号有权查看的版面,不绕过权限,也无法恢复站方已删除的正文。

  • 默认本地、个人使用;不要把登录态索引作为公开镜像或上传给无关第三方。

  • 工具输出保留原始 URL,Agent 应区分论坛帖子、个人经验、官方信息和自己的归纳。

  • 论坛正文按不可信外部资料处理;Agent 不应执行正文中夹带的提示或因此调用其他工具。

  • 不抓 robots.txt 禁止的用户查询、附件与文件路径;不批量下载图片。

  • 写操作故意不实现。若未来加入发帖/回帖,应作为独立可选组件并要求逐次确认。

  • 大规模同步前建议了解论坛规则;若要部署多人远程服务,应先取得 BYR-Team 许可并增加 OAuth、用户隔离、审计、撤销与删除机制。

技术判断、入口实测与数据源说明见 docs/feasibility.md

参考

Available Tools

5 tools
get_board浏览北邮人论坛版面A
Read-only

使用本机保存的论坛会话读取一页版面目录;不向 Agent 暴露凭据。

ParametersJSON Schema
NameRequiredDescriptionDefault
pageNo目录页码。
boardYes英文版面名,例如 Job、Picture。

Output Schema

ParametersJSON Schema
NameRequiredDescription
pageYes
boardYes
threadsYes
descriptionNo
total_pagesYes

TDQS

A3.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already mark the operation as read-only and open-world, and the description adds useful behavioral context: it uses a locally saved forum session and does not expose credentials to the agent. This is security-relevant information beyond what the schema or annotations provide, and it does not contradict readOnlyHint.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single compact sentence, and each clause earns its place: the first states the action and scope, the second adds a credential-safety guarantee. There is no redundancy or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a low-complexity read-only tool with an output schema and supporting annotations, the description covers the essential security and scope context: one page, local session, no credential exposure. Minor gaps like pagination limits or error behavior are acceptable given the schema and annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so page and board are already documented in the input schema. The description's reference to '一页' loosely aligns with the page parameter but adds no additional format, constraints, or parameter-specific guidance beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific action, '读取一页版面目录' (read one page of a board directory), which clearly identifies the resource and scope. It distinguishes the tool from siblings like get_thread or search_posts by focusing on '版面目录', though it does not explicitly name alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The intended use is implied: use this tool when reading a single page of a board directory. However, the description provides no explicit when-to-use/when-not-to-use guidance and does not mention the sibling tools or criteria for choosing among them.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_index_status查看北邮人论坛索引状态A
Read-only

查看本地索引的版面、主题、正文数量、日期范围、来源和覆盖限制。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
postsYes
boardsYes
sourcesNo
threadsYes
coverageYes
database_pathYes
recent_sync_atNo
complete_threadsYes
newest_seen_dateNo
oldest_seen_dateNo
threads_with_contentYes
repeatedly_unavailable_threadsNo
authenticated_session_availableNo

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The '查看' wording aligns with the readOnlyHint annotation, confirming a safe read operation. The description adds useful behavioral context beyond the annotation by disclosing that the index is local and that coverage limitations exist, which helps set expectations about data completeness.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single well-structured sentence that front-loads the subject and lists the key output fields without redundancy. Every phrase adds value, and there is no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that there are no parameters, there is an output schema, and annotations already indicate read-only behavior, the description is complete for practical invocation. It enumerates the status dimensions an agent would need to expect from the tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

This tool has zero parameters, so there is no parameter documentation burden. Per the baseline for zero-parameter tools, the description does not need to add parameter meaning; it is already fully sufficient in that regard.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('查看' / view) and a distinct resource ('本地索引状态' / local index status), listing the exact status dimensions: boards, topics, content counts, date range, source, and coverage limits. This clearly separates it from sibling tools that fetch forum content or perform searches.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies a clear use case: call this tool when you need to inspect the local index's state and coverage. It does not explicitly name alternatives or state when not to use it, but for a zero-parameter status snapshot tool, the context is clear enough.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_thread读取北邮人论坛主题A
Read-only

按版面名和主题 ID 读取一页主题,返回正文、楼层、最小作者信息和附件链接。

ParametersJSON Schema
NameRequiredDescriptionDefault
pageNo页码,从 1 开始。
boardYes英文版面名,例如 Job、AimGraduate。
thread_idYes主题 ID。
max_chars_per_postNo每层正文最大字符数;超出时会标记 content_truncated。

Output Schema

ParametersJSON Schema
NameRequiredDescription
urlYes
pageYes
boardYes
postsYes
titleYes
anonymousNo
thread_idYes
created_atNo
total_pagesYes
popular_repliesNo
board_descriptionNo

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

注解已声明 readOnlyHint=true,描述也以“读取”明确这是只读操作,二者一致。描述额外补充了返回内容构成(正文、楼层、作者、附件),并隐含分页读取行为,增加了注解之外的可预期信息。

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

描述为一句紧凑的句子,先说明调用方式,再说明返回内容,没有冗余信息,信息密度高且易于快速理解。

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

对于 4 个参数、只读注解和输出 schema 已存在的工具,描述已覆盖核心调用条件和返回内容。虽然未提及错误场景或与兄弟工具的边界,但结合 schema 与注解已足够支撑正确调用。

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

输入 schema 的参数描述覆盖率为 100%,board、thread_id、page、max_chars_per_post 都已有说明。描述本身没有为参数提供超出 schema 的额外语义,因此按高覆盖率基准评为 3 分。

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

描述明确说明了操作对象(按版面名和主题 ID 读取主题页)和返回内容(正文、楼层、作者信息、附件链接),与 get_board、get_top10 等兄弟工具区分度高,代理无需打开 schema 即可理解工具用途。

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

描述给出了明确的使用条件:需要提供英文版面名和主题 ID,并可选页码。虽然没有显式说明何时不应使用本工具或推荐其他兄弟工具,但使用场景已经足够清晰。

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_top10读取北邮人论坛十大A
Read-only

读取北邮人论坛当前十大,返回版面、主题 ID、作者、时间、预览和原帖链接。

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo返回 1 到 10 条。
preview_charsNo每条首帖预览的最大字符数;0 表示不返回预览。

Output Schema

ParametersJSON Schema
NameRequiredDescription
itemsYes
fetched_atYes
source_urlYes
last_built_atNo

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint and openWorldHint, so the safety profile is covered. The description adds '当前' and the list of returned fields, which is mildly useful, but it does not disclose additional behavioral details such as data freshness, pagination, or error conditions. With annotations present, this is adequate but not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence that front-loads the core purpose and then lists the returned fields. Every word earns its place; no fluff or irrelevant detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple, has two optional fully documented parameters, read-only/open-world annotations, and an output schema. The description is sufficient for an agent to invoke it correctly without missing critical context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the input schema fully documents both 'limit' and 'preview_chars'. The description's mention of '预览' aligns with the preview_chars parameter but does not add significant meaning beyond the schema. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('读取') and a specific resource ('当前十大'), and enumerates the returned fields (board, thread ID, author, time, preview, link). It clearly conveys what the tool returns, though it does not explicitly name sibling tools to differentiate itself, so it falls just short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase '当前十大' implies this tool is for retrieving the current top-10 list as opposed to searching or reading a specific thread/board. However, there is no explicit guidance about when to prefer this tool over siblings such as search_posts or get_index_status.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_posts检索北邮人论坛A
Read-only

检索本地标题和正文索引;每个主题返回最相关的一条命中和原帖定位。

ParametersJSON Schema
NameRequiredDescriptionDefault
boardNo可选英文版面名。
limitNo返回主题数。
queryYes中文或英文检索词,例如‘学六宿舍’。
offsetNo分页偏移量。
end_dateNo可选结束日期。
start_dateNo可选起始日期。

Output Schema

ParametersJSON Schema
NameRequiredDescription
hitsYes
boardNo
queryYes
offsetYes
coverageYes
returnedYes

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate a read-only operation, and the description adds useful behavioral context: search operates on a local index, results are deduplicated to the most relevant hit per topic, and original post locations are returned. No contradiction with readOnlyHint or openWorldHint. It stops short of detailing ordering/pagination, but the annotation coverage lowers the bar.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One compact sentence with the action front-loaded and the distinctive result behavior included. No filler or repetition of schema/annotation fields.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a search tool with a full input schema and an output schema, the description covers the essential behavior and result shape at a high level. Missing explicit sibling differentiation is already penalized in usage_guidelines; overall the definition is complete enough for an agent to select and invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already documents all six parameters with 100% coverage, including defaults, formats, and examples. The description adds no parameter-specific meaning, so the baseline 3 applies; the schema carries the burden.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb (检索), a specific resource (本地标题和正文索引), and a distinctive result behavior (one hit per topic plus original post location). This clearly differentiates it from sibling getters like get_thread and get_board, which retrieve rather than search.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies this tool is for searching the local title/body index, so the intended context is recognizable. However, it never explicitly names alternatives or states when not to use it, leaving the agent to infer routing from the tool name and siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv0.2.0
    • First observedget_board
    • First observedget_index_status
    • First observedget_thread
    • First observedget_top10
    • First observedsearch_posts

TDQS

A4.2/5.0
Disambiguation5/5

Each tool targets a distinct level of the forum: top 10, thread contents, board directory, search results, and index status. There is no real overlap or ambiguity between them.

Naming Consistency5/5

All tools use a consistent verb_noun snake_case pattern: get_top10, get_thread, get_board, search_posts, get_index_status. The mixed use of get and search is still semantically consistent and predictable.

Tool Count5/5

Five tools is well-scoped for a read-only BBS retrieval server. Each tool covers a necessary access path without redundancy or bloat.

Completeness5/5

The tool set covers the core read-only workflows: browsing popular topics, reading a board, reading a thread, searching posts, and inspecting index health. There are no obvious dead ends for the stated purpose of retrieving and searching forum content.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    B
    quality
    D
    maintenance
    Provides intelligent retrieval capabilities for local files by scanning directories, generating vector indexes, and enabling semantic search through RAG (Retrieval Augmented Generation) with incremental indexing support.
    2
    -
  • A
    license
    B
    quality
    B
    maintenance
    Provides read-only hybrid RAG search and discovery over a local-first AI knowledge corpus, enabling semantic and keyword search, browse, digest, and status tools.
    4
    PolyForm Noncommercial 1.0.0

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/limit-coding/byr-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server