feat(tools): add label and milestone operations

- Create labels.py with gitea_list_labels and gitea_create_label tools
- Integrate milestone tools from milestones.py into server
- Update tools/__init__.py with all tool exports
- Update server.py to handle label and milestone tool calls

Closes #4, Closes #5

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-03 15:22:02 -05:00
parent 38dd315dd5
commit 7ffc0f9ce4
3 changed files with 190 additions and 3 deletions

View File

@@ -9,7 +9,14 @@ from mcp.types import Tool, TextContent
from . import __version__
from .auth import AuthConfig
from .client import GiteaClient, GiteaClientError
from .tools import get_issue_tools, handle_issue_tool, get_label_tools, handle_label_tool
from .tools import (
get_issue_tools,
handle_issue_tool,
get_label_tools,
handle_label_tool,
get_milestone_tools,
handle_milestone_tool,
)
# Global client instance
@@ -36,11 +43,12 @@ async def serve() -> None:
"""List available MCP tools.
Returns:
list: Available tools including issue and label operations.
list: Available tools including issue, label, and milestone operations.
"""
# Get issue and label tools
# Get issue, label, and milestone tools
tools = get_issue_tools()
tools.extend(get_label_tools())
tools.extend(get_milestone_tools())
# Placeholder for future tools (PR tools, etc.)
tools.extend([
@@ -115,6 +123,12 @@ async def serve() -> None:
):
return await handle_label_tool(gitea_client, name, arguments)
# Handle milestone tools
if name.startswith("gitea_") and any(
name.endswith(suffix) for suffix in ["_milestones", "_milestone"]
):
return await handle_milestone_tool(name, arguments, gitea_client)
# Placeholder for other tools
return [
TextContent(