MCP Server · 成都青年之家活动抓取器(Python)
一个基于 Model Context Protocol (MCP) 的服务端,抓取并解析 成都青年之家 的最新「精彩活动」列表,返回结构化活动数组。
- 语言:Python 3.9+
- 传输:SSE(Server-Sent Events)
- 框架:Starlette + Uvicorn
- SDK:
mcp(官方 Python SDK)+FastMCP - 解析:httpx + BeautifulSoup4 + lxml
✨ 功能特性
- 🔍 GET 抓取:请求
https://cdyouth.cdcyl.org.cn/jgc/,直接解析首页 HTML。 - 📝 结构化输出:活动 ID、标题、标签、分类、时间、地址、状态、浏览量、封面图、详情链接等。
- 🧩 MCP Tool:
fetch_chengdu_youth_activities(limit?: int)。 - 🔄 SSE 传输:提供
/sse(建立会话)与/messages(客户端发消息)端点。 - ❤️ 健康检查:
/healthz返回 200ok,便于托管/监控。
📦 安装
方式 A:从源代码本地安装(推荐开发用)
# 创建虚拟环境(可用 uv/pipenv/venv,以下以 uv 为例)
uv venv
uv pip install -e .
Metadata
Release files for mcp-cd-youth 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mcp_cd_youth-1.0.3.tar.gz | 4.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_cd_youth-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.5 kB
Release files / mcp_cd_youth-1.0.3.tar.gz
| Download URL | mcp_cd_youth-1.0.3.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
491220badaec67baca3ae84bd898b15a23687f768bc84f14c3f844016ef98c35
|
|
BLAKE2b-256 checksum How to use checksums |
9b6d76b2f7b465682ba559df012999984fab6089f18284804196fd81d3a52080
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.18
|
Release files / mcp_cd_youth-1.0.3-py3-none-any.whl
| Download URL | mcp_cd_youth-1.0.3-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d566b62781ae00d5ab5195cf71219b80f3eba16da5326a82571e5200007408f
|
|
BLAKE2b-256 checksum How to use checksums |
9e85a2c02ea7180663e54e794bde203e5688d292e3aed5230dddf5e90961df2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.18
|
Security for mcp-cd-youth 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.