Skip to main content

PSC MCP 服务器

License Python Version PyPI

基于 FastMCP 框架开发的普通话水平测试(PSC)考试报名查询系统,提供全国各省份测试站点的报名信息查询服务。

目录

功能特性

  • 🌍 省份列表获取 - 获取支持的所有省份列表
  • 📅 报名信息查询 - 实时查询各省份开放报名的测试站点
  • ⏱️ 即将开考查询 - 查看即将举行考试的测试站点信息
  • 🚀 高性能架构 - 基于 FastMCP 框架,提供高效的 API 服务
  • 🐳 容器化部署 - 支持 Docker 快速部署

安装

作为包安装

pip install pscmcp

开发环境安装

推荐使用 uv 管理依赖:

uv sync

或者使用 pip 安装依赖:

pip install -r requirements.txt

作为包使用

安装后,您可以直接在 Python 代码中使用该包:

from pscmcp import get_provinces, get_open_stations, get_next_stations

# 获取省份列表
provinces = get_provinces()
print(provinces)

# 获取宁夏开放报名的测试站点
ningxia_stations = get_open_stations("ningxia")
print(ningxia_stations)

# 获取宁夏即将开考的测试站点
next_stations = get_next_stations("ningxia")
print(next_stations)

作为MCP服务运行

默认方式(stdio)

默认情况下,服务以 stdio 方式运行,适合与支持 MCP 协议的客户端集成:

pscmcp

HTTP 服务模式

支持多种 HTTP 传输方式:

标准 HTTP 模式:

pscmcp --transport http --host 127.0.0.1 --port 8000 --path /mcp

SSE 模式(Server-Sent Events):

pscmcp --transport sse --host 127.0.0.1 --port 8000 --path /mcp

Streamable HTTP 模式:

pscmcp --transport streamable-http --port 8000

服务器将在 http://localhost:8000/mcp 启动。

开发环境安装

推荐使用 uv 管理依赖:

uv sync

或者使用 pip 安装依赖:

pip install -r requirements.txt

Docker 部署

构建 Docker 镜像:

docker build -t pscmcp .

运行容器:

docker run -p 8000:8000 pscmcp

API 接口

方法 路径 描述
GET /provinces 获取省份列表
GET /open-stations/{province_id} 获取指定省份开放报名的测试站点
GET /next-stations/{province_id} 获取指定省份即将开考的测试站点

示例请求

  1. 获取省份列表:

    curl http://localhost:8000/provinces
    
  2. 查询宁夏开放报名的测试站点:

    curl http://localhost:8000/open-stations/ningxia
    
  3. 查询宁夏即将开考的测试站点:

    curl http://localhost:8000/next-stations/ningxia
    

项目结构

pscmcp/
├── src/
│   ├── __init__.py
│   ├── __main__.py
│   └── psc.py              # 主应用文件
├── Dockerfile              # Docker 配置文件
├── pyproject.toml          # 项目配置和依赖声明
├── README.md               # 项目说明文档
└── LICENSE                 # 许可证文件

许可证

本项目采用 MIT 许可证。详情请见 LICENSE 文件。

Metadata

Release files for pscmcp 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pscmcp 0.2.0
File Size Uploaded Provenance
pscmcp-0.2.0.tar.gz 10.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pscmcp 0.2.0
File Interpreter ABI Platform
pscmcp-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.4 kB

Release files / pscmcp-0.2.0.tar.gz

Download URL pscmcp-0.2.0.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b18bc0f65e9c3c8ea8d940794ce722c9955db264a1c5158298972c54c56af845
BLAKE2b-256 checksum
How to use checksums
c73ce7b09fc523d0913b472cdbaa502394898e021df920778ca5e312e0c8a2b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pscmcp-0.2.0-py3-none-any.whl

Download URL pscmcp-0.2.0-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08cf8170a9e10c3489a466b97a90fc2a8a0c6181f5d6bbcee3a354d50e10465d
BLAKE2b-256 checksum
How to use checksums
cc6b097b11264c1251747154b38f10ffe4157a2122b9c348fc9c16acfc8cd73c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pscmcp 0.2.0

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page