57 Commits

Author SHA1 Message Date
2230bceb51 test: add comprehensive test suite - Closes #7
Added comprehensive test coverage for all tool modules:

Test Files Created:
- tests/conftest.py: Shared fixtures for all tests
- tests/test_issues.py: Complete coverage for issue tools
- tests/test_labels.py: Complete coverage for label tools
- tests/test_milestones.py: Complete coverage for milestone tools

Test Coverage:
- Tool definition validation (schema structure)
- Handler function routing
- Successful API response formatting
- Error handling (GiteaClientError)
- Required parameter validation
- Optional parameter handling
- Mock Gitea API responses

Configuration Updates:
- Added pytest-cov>=4.0.0 to dev dependencies
- Created run_tests.sh script for easy test execution

All tests use pytest-asyncio for async functions and mock the
GiteaClient to avoid real API calls. Tests validate tool schemas,
handler routing, response formatting, and error handling.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 15:30:09 -05:00
ab8c9069da docs: create comprehensive README
Updated README.md with complete documentation including:
- Installation instructions from source and for development
- Configuration with environment variables and .env file setup
- MCP server setup for both Claude Desktop and Claude Code
- Detailed documentation of all 8 available tools with parameters and examples
- API reference for core components (GiteaClient, AuthConfig)
- Development setup and project structure
- Troubleshooting section for common issues

Closes #6

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 15:29:00 -05:00
7ffc0f9ce4 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>
2026-02-03 15:22:02 -05:00
38dd315dd5 feat(tools): implement milestone operations
Implemented MCP tools for Gitea milestone operations:

- Created src/gitea_mcp/tools/milestones.py with milestone tools
  - gitea_list_milestones: List milestones with state filter (open/closed/all)
  - gitea_create_milestone: Create milestone with title, description, due date
  - Error handling via GiteaClientError
  - Helper functions _list_milestones and _create_milestone

- Updated src/gitea_mcp/tools/__init__.py
  - Exported get_milestone_tools and handle_milestone_tool

- Updated src/gitea_mcp/server.py
  - Imported milestone tool functions
  - Added milestone tools to list_tools()
  - Added milestone handler to call_tool() dispatcher

API endpoints implemented:
- GET /repos/{owner}/{repo}/milestones (list with state filter)
- POST /repos/{owner}/{repo}/milestones (create)

All acceptance criteria met:
- tools/milestones.py created with MCP tool handlers
- gitea_list_milestones with state filter implemented
- gitea_create_milestone with title, description, due_on implemented
- Tools registered in server.py
- tools/__init__.py exports updated

Closes #5

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 15:19:24 -05:00
694406941c feat(tools): implement issue operations - Closes #3
Implement Gitea issue operations tools with the following features:
- gitea_list_issues: List issues with filters (state, labels, milestone)
- gitea_get_issue: Get single issue by number
- gitea_create_issue: Create new issue with title, body, labels, milestone
- gitea_update_issue: Update issue state, title, body, labels, assignees

Files added:
- src/gitea_mcp/tools/issues.py: Issue operation tool handlers

Files modified:
- src/gitea_mcp/server.py: Register issue tools in MCP server
- src/gitea_mcp/tools/__init__.py: Export issue tool functions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 15:17:40 -05:00
1e0d896d87 feat: implement MCP server core and authentication
Implemented MCP server core infrastructure with authentication and HTTP client:

- Created auth.py for API token management
  - Loads GITEA_API_URL and GITEA_API_TOKEN from environment
  - Uses python-dotenv for .env file support
  - Validates required configuration on initialization
  - Provides authentication headers for API requests

- Created client.py with base HTTP client
  - GiteaClient class using httpx AsyncClient
  - Async HTTP methods: get(), post(), patch(), delete()
  - Comprehensive error handling for HTTP status codes
  - Custom exception hierarchy for different error types
  - Configurable timeout (default 30s)

- Updated server.py with MCP server setup
  - Initialized MCP server with StdioServerTransport
  - Integrated AuthConfig and GiteaClient
  - Registered placeholder tool handlers (list_repositories, create_issue, create_pull_request)
  - Added CLI with --help and --version options
  - Proper error handling for configuration failures

- Updated pyproject.toml
  - Added console script entry point: gitea-mcp

- Created comprehensive unit tests
  - test_auth.py: Tests for AuthConfig validation and headers
  - test_client.py: Tests for GiteaClient initialization and error handling

All acceptance criteria met:
- MCP server initializes with StdioServerTransport
- Authentication loads from environment variables
- Base HTTP client with auth headers implemented
- Error handling for API connection failures
- Server reports available tools (placeholders for future issues)

Closes #2

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 15:05:25 -05:00
95ed3d81cf feat: initialize Python project structure
- Create pyproject.toml with project metadata
- Add dependencies: mcp, httpx, python-dotenv
- Set up src/gitea_mcp package structure with __init__.py files
- Create placeholder server.py for MCP server implementation
- Add tools subdirectory for future tool implementations
- Create tests directory structure
- Update .gitignore with comprehensive Python exclusions
- Add README.md with project overview

Uses modern src-layout with pyproject.toml (no setup.py).
Project is ready for MCP server implementation.

Closes #1

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 14:56:34 -05:00