Refactor mcp_server.py into a modular gitea_tools package #65

Open
opened 2026-07-02 05:43:19 -05:00 by jcwalker3 · 0 comments
Owner

mcp_server.py is approaching 1700 lines and currently contains MCP tool registration, config parsing, auth/profile handling, API request logic, audit helpers, issue/PR business logic, tracker hygiene, and return-payload construction.

This makes the code harder to maintain, harder to test, and risky to extend as Jenkins/GlitchTip/MCP Control Plane work is considered.

Recommended target structure:

gitea_tools/
  api.py
  auth.py
  config.py
  audit.py
  issues.py
  prs.py
  tracker.py
  labels.py
  reviews.py
mcp_server.py

mcp_server.py should become a thin MCP registration layer.

Acceptance criteria

  • mcp_server.py no longer owns all business logic.
  • API request/pagination/error handling lives in a reusable module.
  • Auth/profile/allowed operation logic lives in a reusable module.
  • Audit/redaction helpers live in a reusable module.
  • Issue/PR/tracker/label logic is split by domain.
  • Existing tool names and payloads remain backward compatible.
  • Full test suite passes.
  • No behavioral changes beyond module movement unless explicitly documented.
`mcp_server.py` is approaching 1700 lines and currently contains MCP tool registration, config parsing, auth/profile handling, API request logic, audit helpers, issue/PR business logic, tracker hygiene, and return-payload construction. This makes the code harder to maintain, harder to test, and risky to extend as Jenkins/GlitchTip/MCP Control Plane work is considered. Recommended target structure: ```text gitea_tools/ api.py auth.py config.py audit.py issues.py prs.py tracker.py labels.py reviews.py mcp_server.py ``` `mcp_server.py` should become a thin MCP registration layer. ## Acceptance criteria * `mcp_server.py` no longer owns all business logic. * API request/pagination/error handling lives in a reusable module. * Auth/profile/allowed operation logic lives in a reusable module. * Audit/redaction helpers live in a reusable module. * Issue/PR/tracker/label logic is split by domain. * Existing tool names and payloads remain backward compatible. * Full test suite passes. * No behavioral changes beyond module movement unless explicitly documented.
jcwalker3 added the importantrefactorarchitecture labels 2026-07-02 05:43:53 -05:00
Sign in to join this conversation.