feat: Add Gitea MCP client for autonomous PR workflow #34

Closed
Rockachopa wants to merge 0 commits from feat/gitea-mcp-integration into main
Owner

Adds GiteaMCPClient class to enable Timmy to autonomously manage repositories, create PRs, and manage issues via the Gitea API.

This enables the daily scheduled workflow for autonomous improvements.

Adds GiteaMCPClient class to enable Timmy to autonomously manage repositories, create PRs, and manage issues via the Gitea API. This enables the daily scheduled workflow for autonomous improvements.
Rockachopa added 1 commit 2026-03-14 14:18:10 +00:00
feat: Add Gitea MCP client for autonomous PR workflow
Some checks failed
Tests / lint (pull_request) Failing after 4s
Tests / test (pull_request) Has been skipped
e2e4cbfe1d
hermes requested changes 2026-03-14 14:38:16 +00:00
hermes left a comment
Collaborator

Code Review: PR #34 — Gitea MCP Client for Autonomous PR Workflow

Verdict: REQUEST CHANGES — this duplicates existing functionality and has implementation issues.


Core Problem: This Already Exists

The project already has a working Gitea MCP integration at src/timmy/mcp_tools.py (279 lines). It:

  • Uses Agno's MCPTools with StdioServerParameters
  • Connects to the actual gitea-mcp binary at ~/go/bin/gitea-mcp
  • Reads config from settings.gitea_token / settings.gitea_url
  • Handles issue creation, repo ops, PR tools
  • Is already wired into the agent via create_gitea_mcp_tools()

This PR adds a second, completely independent Gitea client (gitea_mcp_client.py) that reimplements the same functionality with a hand-rolled JSON-RPC subprocess approach. Nothing in the codebase imports or references it.


Implementation Issues

1. Hand-rolled MCP protocol is fragile

The call_tool() method (lines 87-126) implements bare JSON-RPC over stdin/stdout:

  • Hardcodes "id": 1 for every request — concurrent calls would collide.
  • Uses readline() which will deadlock if the server sends multi-line responses or doesn't terminate with newline.
  • No MCP protocol initialization (the spec requires a handshake before tool calls).
  • No handling of MCP notifications or server-initiated messages.

The existing code uses Agno's MCPTools which handles all of this correctly.

2. No __del__ or context manager — process leak

If the GiteaMCPClient object is garbage collected without calling stop(), the subprocess is orphaned. Should be a context manager (__enter__/__exit__) or use atexit.

3. get_repo() is O(n) — lists all repos to find one

Lines 133-139 call list_my_repos then linear-scans for a match. The Gitea MCP server has direct repo lookup tools.

4. Bare except Exception in start()

Line 72-73 catches all exceptions. This is one of the issues already filed against the codebase (#25).

5. Assumes tool response shape without verification

Methods like list_repos() assume result.get("repositories", []) and list_pull_requests() assumes result.get("pull_requests", []) — but these response shapes aren't documented in the MCP spec. The actual gitea-mcp tool returns content blocks, not structured dicts.

6. No tests

227 lines of new code, zero tests.


Recommendation

Close this PR. The functionality already exists in mcp_tools.py and is properly integrated with the Agno framework the project uses. If Manus needs to interact with Gitea for his daily PRs, he should use the Gitea REST API directly (which he's already doing to push branches and create PRs via the token), not add a second MCP client.

— Hermes

## Code Review: PR #34 — Gitea MCP Client for Autonomous PR Workflow **Verdict: REQUEST CHANGES — this duplicates existing functionality and has implementation issues.** --- ### Core Problem: This Already Exists The project already has a working Gitea MCP integration at `src/timmy/mcp_tools.py` (279 lines). It: - Uses Agno's MCPTools with StdioServerParameters - Connects to the actual `gitea-mcp` binary at `~/go/bin/gitea-mcp` - Reads config from `settings.gitea_token` / `settings.gitea_url` - Handles issue creation, repo ops, PR tools - Is already wired into the agent via `create_gitea_mcp_tools()` This PR adds a second, completely independent Gitea client (`gitea_mcp_client.py`) that reimplements the same functionality with a hand-rolled JSON-RPC subprocess approach. Nothing in the codebase imports or references it. --- ### Implementation Issues **1. Hand-rolled MCP protocol is fragile** The `call_tool()` method (lines 87-126) implements bare JSON-RPC over stdin/stdout: - Hardcodes `"id": 1` for every request — concurrent calls would collide. - Uses `readline()` which will deadlock if the server sends multi-line responses or doesn't terminate with newline. - No MCP protocol initialization (the spec requires a handshake before tool calls). - No handling of MCP notifications or server-initiated messages. The existing code uses Agno's MCPTools which handles all of this correctly. **2. No `__del__` or context manager — process leak** If the GiteaMCPClient object is garbage collected without calling `stop()`, the subprocess is orphaned. Should be a context manager (`__enter__`/`__exit__`) or use `atexit`. **3. `get_repo()` is O(n) — lists all repos to find one** Lines 133-139 call `list_my_repos` then linear-scans for a match. The Gitea MCP server has direct repo lookup tools. **4. Bare `except Exception` in `start()`** Line 72-73 catches all exceptions. This is one of the issues already filed against the codebase (#25). **5. Assumes tool response shape without verification** Methods like `list_repos()` assume `result.get("repositories", [])` and `list_pull_requests()` assumes `result.get("pull_requests", [])` — but these response shapes aren't documented in the MCP spec. The actual gitea-mcp tool returns content blocks, not structured dicts. **6. No tests** 227 lines of new code, zero tests. --- ### Recommendation Close this PR. The functionality already exists in `mcp_tools.py` and is properly integrated with the Agno framework the project uses. If Manus needs to interact with Gitea for his daily PRs, he should use the Gitea REST API directly (which he's already doing to push branches and create PRs via the token), not add a second MCP client. — Hermes
Collaborator

Closing — this duplicates the existing Gitea MCP integration in mcp_tools.py. Manus was credit-limited and didn't have time to ingest the repo before writing this. The functionality is already there.

Closing — this duplicates the existing Gitea MCP integration in mcp_tools.py. Manus was credit-limited and didn't have time to ingest the repo before writing this. The functionality is already there.
hermes closed this pull request 2026-03-14 14:39:09 +00:00

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#34