From 929bc097d26810179b12deefb40367d623519b9e Mon Sep 17 00:00:00 2001 From: weirdgiser <0106160226@csu.edu.cn> Date: Thu, 19 Jun 2025 21:34:55 +0800 Subject: [PATCH 1/6] refactor --- README.md | 1 - src/news_mcp_server/mcp_server.py | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f368f62..32cd023 100644 --- a/README.md +++ b/README.md @@ -174,7 +174,6 @@ dmake build # 构建 Docker 镜像 - 引入基于 JWT 或 OAuth2 的更安全鉴权机制 - 支持多进程/多实例共享会话(如使用 Redis Session Store) - 优化 Elasticsearch 查询性能,添加缓存层(Redis) -- 集成请求限流和熔断策略,以防止高频或恶意请求 - 增加端到端集成测试覆盖,并配置 CI/CD 流水线 - 支持 ES 聚合查询与热门关键词统计功能 - 提供 Swagger UI 或 Postman 集合示例 diff --git a/src/news_mcp_server/mcp_server.py b/src/news_mcp_server/mcp_server.py index 6d499ca..f9e05e9 100644 --- a/src/news_mcp_server/mcp_server.py +++ b/src/news_mcp_server/mcp_server.py @@ -6,10 +6,10 @@ from .services.news_service import NewsService from .clients.elastic_client import AsyncElasticClient from .middlewares.audit import AuditMiddleware -import structlog -logger = structlog.get_logger(__name__) - +from .utils.logger import logger logger.info("News MCP module") + + class NewsMCP(FastMCP): """FastMCP server with authentication middleware.""" pass From 7db8fc31c23bd028ecec4f541a17a26bbf5774d4 Mon Sep 17 00:00:00 2001 From: weirdgiser <0106160226@csu.edu.cn> Date: Thu, 19 Jun 2025 21:44:28 +0800 Subject: [PATCH 2/6] workflow: generate docs --- .github/workflows/docs.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..0be6917 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,31 @@ +name: Generate Docs + +on: + push: + branches: + - main + - dev + +jobs: + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Install documentation generator + run: pip install pdoc + + - name: Generate API documentation + run: pdoc --html src/news_mcp_server --output-dir docs + + - name: Upload docs artifact + uses: actions/upload-artifact@v3 + with: + name: api-docs + path: docs \ No newline at end of file From 3c5ab79ea056bcc73034e0f830ee4095941e1ddc Mon Sep 17 00:00:00 2001 From: weirdgiser <0106160226@csu.edu.cn> Date: Thu, 19 Jun 2025 21:45:53 +0800 Subject: [PATCH 3/6] fix --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 0be6917..e37a1ea 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -25,7 +25,7 @@ jobs: run: pdoc --html src/news_mcp_server --output-dir docs - name: Upload docs artifact - uses: actions/upload-artifact@v3 + uses: awalsh128/cache-apt-pkgs-action@v1.4.3 with: name: api-docs path: docs \ No newline at end of file From 0c8f029cf45756a0e18237936385a260fa9ff5c2 Mon Sep 17 00:00:00 2001 From: weirdgiser <0106160226@csu.edu.cn> Date: Thu, 19 Jun 2025 21:54:03 +0800 Subject: [PATCH 4/6] fix --- .github/workflows/docs.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e37a1ea..bf4ee0e 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -18,11 +18,11 @@ jobs: with: python-version: '3.12' - - name: Install documentation generator - run: pip install pdoc - - - name: Generate API documentation - run: pdoc --html src/news_mcp_server --output-dir docs + - name: Generate HTML docs with Sphinx + run: | + pip install sphinx sphinx-rtd-theme sphinx-autodoc-typehints + sphinx-apidoc -o docs/source src/news_mcp_server + make -C docs html - name: Upload docs artifact uses: awalsh128/cache-apt-pkgs-action@v1.4.3 From 44e612c17b8a3cd8479a974109b3cf74fc316d4b Mon Sep 17 00:00:00 2001 From: Weird Cat <30528939+Coolgiserz@users.noreply.github.com> Date: Thu, 19 Jun 2025 21:55:26 +0800 Subject: [PATCH 5/6] Update docs.yml --- .github/workflows/docs.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index bf4ee0e..c1006e8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -22,10 +22,9 @@ jobs: run: | pip install sphinx sphinx-rtd-theme sphinx-autodoc-typehints sphinx-apidoc -o docs/source src/news_mcp_server - make -C docs html - name: Upload docs artifact uses: awalsh128/cache-apt-pkgs-action@v1.4.3 with: name: api-docs - path: docs \ No newline at end of file + path: docs From 62a1cae320938dbdef7e6b6398848c5879a6ad9a Mon Sep 17 00:00:00 2001 From: weirdgiser <0106160226@csu.edu.cn> Date: Thu, 19 Jun 2025 22:08:41 +0800 Subject: [PATCH 6/6] fix --- .github/workflows/docs.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index bf4ee0e..6dabd2a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -22,10 +22,9 @@ jobs: run: | pip install sphinx sphinx-rtd-theme sphinx-autodoc-typehints sphinx-apidoc -o docs/source src/news_mcp_server - make -C docs html - name: Upload docs artifact - uses: awalsh128/cache-apt-pkgs-action@v1.4.3 + uses: actions/upload-artifact@v4 with: name: api-docs - path: docs \ No newline at end of file + path: docs \ No newline at end of file