Astron-Hupu-MCP: 基于虎扑公开页面的自包含 MCP Server,支持 MCP 协议和 uvx 一键启动。
Project description
虎扑公开内容 MCP Server
概述
Astron-hupu-mcp 是一个基于 MCP 协议的虎扑工具服务,直接请求虎扑公开页面,并从 Next.js 页面中的 __NEXT_DATA__ 提取公开内容,无需额外部署后端服务。
当前工程形态:
- 使用
MCP Python SDK - 使用单文件
server.py承载工具定义和 HTTP 调用 - 通过独立
pyproject打包 - 支持
uvx一键启动 - 通过环境变量配置超时和 User-Agent
当前提供 6 个原子工具:
get_hot_listget_feed_listsearch_contentget_content_detailget_author_profileget_author_content_list
工具列表
1. 获取热帖 get_hot_list
- 描述:读取虎扑首页热帖。
- 参数:
limit:返回条数,默认20refresh:是否刷新,默认False
2. 获取内容流 get_feed_list
- 描述:读取虎扑首页公开内容流。
- 参数:
channel:兼容保留参数,当前未启用cursor:兼容保留参数,当前未启用limit:返回条数,默认20refresh:是否刷新,默认False
3. 搜索内容 search_content
- 描述:读取虎扑站内公开帖子搜索结果。
- 参数:
query:搜索词,必填cursor:分页游标,内部按page页码处理limit:返回条数,默认20
4. 获取内容详情 get_content_detail
- 描述:读取虎扑帖子详情。
- 参数:
content_id:帖子 IDurl:内容完整 URL
5. 获取作者主页 get_author_profile
- 描述:读取虎扑用户公开主页。
- 参数:
author_id:作者puidurl:用户主页 URL
6. 获取作者帖子列表 get_author_content_list
- 描述:读取虎扑作者公开帖子列表。
- 参数:
author_id:作者puidurl:用户主页 URLcursor:兼容保留参数,当前未启用limit:返回条数,默认20
环境变量
这个包默认不需要认证信息。
可选环境变量:
export HUPU_MCP_TIMEOUT_SECONDS="30"
export HUPU_MCP_USER_AGENT="Mozilla/5.0 ..."
说明:
HUPU_MCP_TIMEOUT_SECONDS控制公开页面请求超时。HUPU_MCP_USER_AGENT用于覆盖默认请求头。
安装与启动
推荐方式:使用 uvx 一键启动
uvx --from astron-hupu-mcp astron-hupu-mcp
如果你还没有安装 uv / uvx,可先执行:
curl -fsSL https://install.astral.sh/uv | bash
使用 pip 安装
pip install astron-hupu-mcp
hupu-mcp
本地源码运行
cd MCP/hupu-mcp
PYTHONPATH=src python3 -m hupu_mcp.server
客户端配置
使用 uvx
{
"mcpServers": {
"hupu-mcp": {
"command": "uvx",
"args": ["--from", "astron-hupu-mcp", "astron-hupu-mcp"],
"env": {
"HUPU_MCP_TIMEOUT_SECONDS": "30"
}
}
}
}
使用本地源码
{
"mcpServers": {
"hupu-mcp": {
"command": "python3",
"args": ["-m", "hupu_mcp.server"],
"env": {
"PYTHONPATH": "/path/to/MCP/hupu-mcp/src",
"HUPU_MCP_TIMEOUT_SECONDS": "30"
}
}
}
}
平台差异说明
- 这个 MCP 直接请求虎扑公开页面,不依赖额外的 Astron 后端服务。
- 当前仅面向公开内容能力,不包含登录态、私有内容或用户专属数据。
get_hot_list和get_feed_list当前都基于虎扑首页公开帖子流。search_content当前走虎扑公开搜索接口/api/v2/search2,返回公开帖子搜索结果。- 公开页面结构如果发生变化,
__NEXT_DATA__解析可能需要跟着调整。
发布说明
cd MCP/hupu-mcp
rm -rf build dist src/*.egg-info
python3 -m build --no-isolation
python3 -m twine check dist/*
python3 -m twine upload dist/*
License
Apache License 2.0. See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
astron_hupu_mcp-0.1.4.tar.gz
(12.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file astron_hupu_mcp-0.1.4.tar.gz.
File metadata
- Download URL: astron_hupu_mcp-0.1.4.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6732fdb924e34a8bb70d6da40bb33259473cade21fb082a2ec5e7e173291cabd
|
|
| MD5 |
84f99b1f8e51f69c9a4cd6a4b27ed524
|
|
| BLAKE2b-256 |
e6497fcbeaea8bf01ebfde0e88cc7637d7bd81fa5e094320ad7e3e577bfeb4df
|
File details
Details for the file astron_hupu_mcp-0.1.4-py3-none-any.whl.
File metadata
- Download URL: astron_hupu_mcp-0.1.4-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d57863706e110823d2d2c7ee91acdc02c1766cfee5a5828b7e15e277327007a
|
|
| MD5 |
90b00408d83720aeb05809adffa09eb3
|
|
| BLAKE2b-256 |
5a825040b35ada9c2e1a8d1eeab20bd8be87dbb8088c7f8f079893e0e8875864
|