nwafu-mcp
nwafu-mcp · 西农家林科技学学校园信息 MCP 工具集
为部署在任意智能体平台上的 Agent 提供一套符合 MCP 协议 的工具,覆盖三个核心能力:
校园频道热门总结:抓取 西农家林科技大学 官方 QQ 频道(pd.qq.com/g/inwafu1934)近期热门帖子,按互动量排序并自动归类为「活动 / 竞赛 / 通知 / 推荐 / 贴士 / 求助」等类别,每条重要信息均附来源帖子标题与链接,保证可溯源。
官网快速查询:通过学校官网(www.nwafu.edu.cn)与新闻网的全文索引,快速查询最近的活动、竞赛、通知、招聘信息;支持传入「植保学院」「教务处」等关键词缩小检索范围。
跨站自定义检索:把用户问题自动拆成检索词,同时在官网全文索引与校园频道近期帖子中检索并合并输出,所有结果排版为易读的 Markdown,并附带原文链接。
功能特性
MCP 标准实现:基于官方
mcpPython SDK(FastMCP),stdio 传输,可直接接入 Claude Desktop、Cursor、Windsurf 以及各类支持 MCP 的智能体平台。信息可溯源:所有结论性条目都带来源标题 + 原文链接,重要信息单独「重点提示 / 时效性提示」区块。
分类智能:规则引擎自动把频道帖子归类到「推荐 / 贴士 / 活动 / 竞赛 / 通知 / 求助」等类别,组内按热度(点赞 + 评论加权)排序。
关键词精检索:官网查询支持任意关键词缩小范围(如学院名、部门名、事项名)。
健壮容错:请求超时、重试、限速随延迟、Cookie 过期提示,单工具失败不影响其他工具。
隐私合规:只抓取公开可见内容,不绕过登录/权限校验;Cookie 通过环境变量注入,不写入代码仓库。
Related MCP server: NanoSearchMCP
工具列表
工具 | 用途 | 关键参数 |
| 校园 QQ 频道近期热门帖子智能总结(热度榜 + 分类 + 重点信息) |
|
| 官网最近通知/活动/竞赛/招聘快速查询与总结 |
|
| 官网全文检索(自定义关键词) |
|
| 跨「官网 + 校园频道」自定义问题检索 |
|
所有工具输出均为 Markdown 文本,结构包含:数据来源、抓取时间、查询条件、结果列表(标题 / 日期 / 来源 / 摘要 / 链接)与重点提示。
工作原理
校园 QQ 频道
腾讯频道 Web 端为纯前端渲染,公开数据来自 protobuf-over-JSON 网关:
POST https://pd.qq.com/qunng/guild/gotrpc/noauth/trpc.qchannel.commreader.ComReader/<Method>
x-oidb: {"uint32_service_type": 11 时间线 | 5 评论}匿名可读公开内容,但网关要求浏览器级会话 Cookie(p_uin + uuid + EO-Bot-Js-Token)。本工具:
默认拉取「帖子广场」子版块(
670126629)最近 N 条帖子(按发布时间);用
点赞数 + 2 × 评论数估算热度,取窗口内最热帖子;规则引擎自动分类,重要信息(通知/公告/报名/截止/考试等)单独提示;
可选为热度榜帖子抓取热评(
GetFeedComments)。
说明:
GetGuildFeeds的「热门排序」接口经实测返回空数据,故热度榜采用「近期帖子 × 互动量」方案,更符合「近期热门」语义。
学校官网
学校主站与新闻网使用通元 CMS 全文检索:
GET https://www.nwsuaf.edu.cn/cms/web/search/index.jsp
?query=<关键词>&siteID=<站点ID>&searchScope=0&channelID=&matchType=0
&sortField=publishDate&order=1&date=<3|6|12>&page=<页码>siteID=32e6d9be...为主站索引(覆盖全校各学院/部门);按分类生成检索词(通知/公告、活动/讲座/论坛、竞赛/大赛、招聘等),合并用户关键词后分页拉取,解析标题、日期、来源、摘要与原文链接;
时间范围默认近 90 天(映射到索引的 3/6/12 个月过滤)。
快速开始(本地运行)
cd nwafu-mcp
uv sync --extra dev1. 配置频道 Cookie(可选,仅频道类工具需要)
uv run nwafu-export-cookies --out cookies.json脚本会用本机 Edge/Chrome 打开频道页建立会话并导出 Cookie。然后把 cookies.json 中的 cookie_header 写入环境变量:
$env:PDQQ_COOKIES = "p_uin=xxx; uuid=xxx; EO-Bot-Js-Token=xxx"
# 或
$env:NWAFU_COOKIE_FILE = "F:\path\to\cookies.json"Cookie 会过期(反爬 token 与浏览器实例绑定),云端部署建议定期刷新。
2. 直接测试工具函数(不经过 MCP 客户端)
uv run python -c "
import os
os.environ['NWAFU_COOKIE_FILE'] = 'cookies.json'
from nwafu_mcp.server import official_site_recent
print(official_site_recent(category='通知', keyword='植保学院'))
"3. 以 MCP Server 方式运行
uv run nwafu-mcp接入 MCP 客户端
Claude Desktop(claude_desktop_config.json)
{
"mcpServers": {
"nwafu-campus": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/unielevotor/nwafu-AgentPlatformMCP",
"nwafu-mcp"
],
"env": {
"PDQQ_COOKIES": "p_uin=xxx; uuid=xxx; EO-Bot-Js-Token=xxx"
}
}
}
}Cursor / Windsurf / 通用平台(JSON 形式)
{
"mcpServers": {
"nwafu-campus": {
"command": "uvx",
"args": ["--from", "git+https://github.com/unielevotor/nwafu-AgentPlatformMCP", "nwafu-mcp"],
"env": {
"PDQQ_COOKIES": "p_uin=xxx; uuid=xxx; EO-Bot-Js-Token=xxx",
"PDQQ_GUILD_ID": "inwafu1934",
"PDQQ_CHANNEL_ID": "670126629"
}
}
}
}也可用 pip install git+https://github.com/unielevotor/nwafu-AgentPlatforMCP 安装后,以 nwafu-mcp 命令直接启动。
GitHub 部署步骤
推送到 GitHub 仓库(
unielevotor/nwafu-AgentPlatforMCP):
git remote add origin https://github.com/unielevotor/nwafu-AgentPlatformMCP.git
git push -u origin main确认仓库为 Public(私有仓库时,目标智能体平台需能访问 GitHub 凭据)。
在智能体平台的 MCP 配置中填入上面的
uvx --from git+...启动命令,并注入PDQQ_COOKIES等环境变量。
环境变量
变量 | 必填 | 说明 |
| 频道工具需要 | QQ 频道浏览器会话 Cookie |
| 频道工具需要 | 指向 |
| 否 | 频道标识,默认 |
| 否 | 子版块 ID,默认 |
| 否 | 频道请求间隔(秒),默认 0.3–0.8 |
| 否 | 单请求超时(秒),默认 30 |
参考 .ene.example。
输出示例(节选)
# 🎓 西农校园频道 · 近期热门总结
> 数据来源:西北农林科技大学官方 QQ 频道 | 时间窗口:近 72 小时 | 帖子数:48
## 🔥 热度榜
1. **中元节鬼是真的多啊…**(👍7 · 💬1 · 08-27)
来源:[中元节鬼是真的多啊](https://pd.qq.com/g/inwafu1934/post/...)
## 🏆 竞赛(2)
- **关于举办2026年创新创业大赛的通知**(👍5 · 💬2 · 08-26)
来源:[…](https://pd.qq.com/g/inwafu1934/post/...)
## ⚠️ 重点信息(建议优先查看)
- [关于选课时间安排的通知](https://pd.qq.com/g/inwafu1934/post/...)# 📢 西北农林科技大学官网 · 近期信息查询
> 查询条件:分类=通知 | 关键词=植保学院 | 时间范围:近 90 天 | 结果数:12
1. **关于举办2026年植保论坛系列学术报告会(十七)的通知**(2026-08-26 · 植物保护学院)
[查看原文](https://ppc.nwafu.edu.cn/xzbg/...)合规与使用建议
只抓取公开可见内容,不绕过登录、付费或权限校验。
已内置随机 UA、随机延迟与失败重试,部署时请勿调小延迟做高频抓取,遵守目标平台服务条款与《个人信息保护法》等适用法规。
重要信息(报名截止、考试安排等)请以官方原文为准,工具输出仅供速览。
频道 Cookie 含会话标识,切勿提交到公开仓库,务必通过环境变量注入。
常见问题
现象 | 处理 |
频道工具提示「未配置 Cookie」 | 本地执行 |
频道工具报 | Cookie 失效或缺失反爬 token,重新导出 |
官网查询结果为空 | 放宽 |
云端无 Edge/Chrome | 安装 |
目录结构
src/nwafu_mcp/
server.py MCP 服务器与四个工具定义
qq_channel.py QQ 频道数据层(时间线/热评)
official_site.py 官网全文检索数据层
classify.py 帖子分类与热度评分
format.py Markdown 报告排版
config.py 环境变量与默认配置
export_cookies.py 本地导出频道 Cookie 的 CLI
tests/ 单元测试
scripts/mcp_smoke.py 端到端 MCP 冒烟测试(连接 stdio server 并调用全部工具)Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenancecc98-mcp enables AI assistants to search, read, and aggregate posts from the Zhejiang University campus forum CC98, using official read-only API tools.101MIT
- FlicenseNot gradedqualityCmaintenanceProvides web search, page fetching, and A-stock data access (financial reports, announcements, research reports, penalties, IR meetings) via MCP tools.1
- FlicenseNot gradedqualityBmaintenanceMCP server that aggregates department notices and provides structured answers to queries about courses, schedules, and academic dates via tool calling.
- FlicenseAqualityCmaintenanceEnables interaction with Zhejiang University's learning platform (学在浙大 / 智云课堂) via MCP tools, allowing natural language commands to check todos, view schedules, fetch lecture transcripts, and submit homework.73
Related MCP Connectors
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Search Hacker News, Bluesky, and Substack from a single MCP interface
Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/unielevotor/nwafu-AgentPlatformMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server