redmine-mcp-server 0.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ # Redmine MCP Configuration
2
+ # Copy this file to .env and update the values
3
+
4
+ # Authentication Options:
5
+ # Option 1: Username and Password (traditional)
6
+ REDMINE_URL=https://your-redmine-server.com
7
+ REDMINE_USERNAME=your_username
8
+ REDMINE_PASSWORD=your_password
9
+
10
+
11
+ # Option 2: API Key (alternative to username/password)
12
+ # Uncomment and set this if you want to use API key authentication instead
13
+ # REDMINE_API_KEY=your_api_key
14
+
15
+ # Server configuration
16
+ SERVER_HOST=0.0.0.0
17
+ SERVER_PORT=8000
18
+
19
+ # Public URL configuration for file serving
20
+ # External hostname/IP for generated download URLs
21
+ PUBLIC_HOST=localhost
22
+ PUBLIC_PORT=8000
23
+
24
+ # File Management (Optional)
25
+ # Directory where downloaded attachments are stored
26
+ ATTACHMENTS_DIR=./attachments
27
+
28
+ # Automatic cleanup configuration
29
+ AUTO_CLEANUP_ENABLED=true
30
+ CLEANUP_INTERVAL_MINUTES=10
31
+
32
+ # Default expiry time for downloaded attachments (in minutes)
33
+ ATTACHMENT_EXPIRES_MINUTES=60
@@ -0,0 +1,39 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - develop
7
+
8
+ push:
9
+ branches:
10
+ - feature/*
11
+ - release/*
12
+ - hotfix/*
13
+
14
+ workflow_dispatch: # 👈 allows manual run from GitHub UI
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: '3.13'
24
+ - name: Install uv
25
+ run: pip install uv
26
+ - name: Set up environment
27
+ run: |
28
+ uv venv
29
+ source .venv/bin/activate
30
+ uv pip install -e .[test,dev]
31
+ - name: Run code quality checks
32
+ run: |
33
+ source .venv/bin/activate
34
+ flake8 src/ --max-line-length=88
35
+ black --check src/ --line-length=88
36
+ - name: Run tests
37
+ run: |
38
+ source .venv/bin/activate
39
+ python tests/run_tests.py --all --verbose
@@ -0,0 +1,35 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*' # Trigger on version tags like v0.4.1
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - name: Set up Python
16
+ uses: actions/setup-python@v5
17
+ with:
18
+ python-version: '3.13'
19
+
20
+ - name: Install build dependencies
21
+ run: |
22
+ python -m pip install --upgrade pip
23
+ pip install build twine
24
+
25
+ - name: Build package
26
+ run: python -m build
27
+
28
+ - name: Check package
29
+ run: twine check dist/*
30
+
31
+ - name: Publish to PyPI
32
+ env:
33
+ TWINE_USERNAME: __token__
34
+ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
35
+ run: twine upload dist/*
@@ -0,0 +1,23 @@
1
+ # VsCode and IDE specific files
2
+ .vscode/settings.json
3
+
4
+ # Python-generated files
5
+ __pycache__/
6
+ *.py[oc]
7
+ build/
8
+ dist/
9
+ wheels/
10
+ *.egg-info
11
+
12
+ # Test and coverage files
13
+ .coverage
14
+ htmlcov/
15
+
16
+ # Virtual environments
17
+ .venv
18
+ .env
19
+ .env.docker
20
+ CLAUDE.md
21
+ .claude
22
+ attachments
23
+ plans
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,73 @@
1
+ # Repository Guidelines for Codex Agents
2
+
3
+ This file provides instructions for any Codex agent interacting with this repository.
4
+
5
+ ## Setup
6
+ - Requires **Python 3.13+** and the [`uv`](https://docs.astral.sh/uv/) package manager.
7
+ - Create a virtual environment and install dependencies:
8
+ ```bash
9
+ uv venv
10
+ source .venv/bin/activate
11
+ uv pip install -e .
12
+ ```
13
+ - Install development/test requirements with:
14
+ ```bash
15
+ uv pip install pytest pytest-asyncio pytest-cov pytest-mock
16
+ ```
17
+
18
+ ## Running the Server
19
+ - Development mode:
20
+ ```bash
21
+ uv run fastapi dev src/redmine_mcp_server/main.py
22
+ ```
23
+ - Production mode:
24
+ ```bash
25
+ uv run python src/redmine_mcp_server/main.py
26
+ ```
27
+
28
+ ## Testing
29
+ Use the provided test runner located in `tests/run_tests.py`.
30
+
31
+ - Run **all** tests:
32
+ ```bash
33
+ python tests/run_tests.py --all
34
+ ```
35
+ - Run **unit** tests only:
36
+ ```bash
37
+ python tests/run_tests.py
38
+ ```
39
+ - Run **integration** tests only:
40
+ ```bash
41
+ python tests/run_tests.py --integration
42
+ ```
43
+ - Generate a coverage report:
44
+ ```bash
45
+ python tests/run_tests.py --coverage
46
+ ```
47
+
48
+ Integration tests require a reachable Redmine instance configured via environment variables.
49
+
50
+ ## Docker Usage
51
+ - Recommended workflow with `docker-compose`:
52
+ ```bash
53
+ cp .env.example .env.docker
54
+ # Edit .env.docker with your Redmine configuration
55
+ docker-compose up --build
56
+ ```
57
+ - Or build and run directly with Docker:
58
+ ```bash
59
+ docker build -t redmine-mcp-server .
60
+ docker run -p 8000:8000 --env-file .env.docker redmine-mcp-server
61
+ ```
62
+
63
+ ## Environment Configuration
64
+ Copy `.env.example` to `.env` and set:
65
+
66
+ - `REDMINE_URL` – base URL of your Redmine server
67
+ - `REDMINE_USERNAME` and `REDMINE_PASSWORD` **or** `REDMINE_API_KEY`
68
+ - `SERVER_HOST` and `SERVER_PORT` to control server binding
69
+
70
+ Do **not** commit `.env` or other secrets to version control.
71
+
72
+ ## Licensing
73
+ This project uses the MIT License. See `LICENSE` for details.
@@ -0,0 +1,249 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+
6
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
7
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
+
9
+ ## [0.4.2] - 2025-09-23
10
+
11
+ ### Added
12
+ - PyPI package publishing support as `redmine-mcp-server`
13
+ - Console script entry point: `redmine-mcp-server` command
14
+ - Comprehensive package metadata for PyPI distribution
15
+ - GitHub Actions workflow for automated PyPI publishing
16
+
17
+ ### Changed
18
+ - Updated package name from `mcp-redmine` to `redmine-mcp-server` for PyPI
19
+ - Enhanced pyproject.toml with full package metadata and classifiers
20
+ - Added main() function for console script execution
21
+
22
+ ### Improved
23
+ - Better package discoverability with keywords and classifications
24
+ - Professional package structure following PyPI best practices
25
+ - Automated release workflow for seamless publishing
26
+
27
+ ## [0.4.1] - 2025-09-23
28
+
29
+ ### Fixed
30
+ - GitHub Actions CI test failure in security validation tests
31
+ - Updated test assertions to handle Redmine client initialization state properly
32
+ - Security validation tests now pass consistently in CI environments
33
+
34
+ ### Improved
35
+ - Enhanced GitHub Actions workflow with manual dispatch trigger
36
+ - Added verbose test output for better CI debugging
37
+ - Improved test reliability across different environments
38
+
39
+ ## [0.4.0] - 2025-09-22
40
+
41
+ ### Added
42
+ - `get_redmine_attachment_download_url()` - Secure replacement for attachment downloads
43
+ - Comprehensive security validation test suite
44
+ - Server-controlled storage and expiry policies for enhanced security
45
+
46
+ ### Changed
47
+ - Updated MCP library to v1.14.1
48
+ - Integration tests now create their own test attachments for reliability
49
+ - Attachment files always use UUID-based directory structure
50
+
51
+ ### Deprecated
52
+ - `download_redmine_attachment()` - Use `get_redmine_attachment_download_url()` instead
53
+ - ⚠️ SECURITY: `save_dir` parameter vulnerable to path traversal (CWE-22, CVSS 7.5)
54
+ - `expires_hours` parameter exposes server policies to clients
55
+ - Will be removed in v0.5.0
56
+
57
+ ### Fixed
58
+ - Path traversal vulnerability in attachment downloads eliminated
59
+ - Integration test no longer skipped due to missing attachments
60
+
61
+ ### Security
62
+ - **CRITICAL**: Fixed path traversal vulnerability in attachment downloads (CVSS 7.5)
63
+ - Removed client control over server storage configuration
64
+ - Enhanced logging for security events and deprecated function usage
65
+
66
+ ## [0.3.1] - 2025-09-21
67
+
68
+ ### Fixed
69
+ - Integration test compatibility with new attachment download API format
70
+ - Test validation now properly checks HTTP download URLs instead of file paths
71
+ - Comprehensive validation of all attachment response fields (download_url, filename, content_type, size, expires_at, attachment_id)
72
+
73
+ ## [0.3.0] - 2025-09-21
74
+
75
+ ### Added
76
+ - **Automatic file cleanup system** with configurable intervals and expiry times
77
+ - `AUTO_CLEANUP_ENABLED` environment variable for enabling/disabling automatic cleanup (default: true)
78
+ - `CLEANUP_INTERVAL_MINUTES` environment variable for cleanup frequency (default: 10 minutes)
79
+ - `ATTACHMENT_EXPIRES_MINUTES` environment variable for default attachment expiry (default: 60 minutes)
80
+ - Background cleanup task with lazy initialization via MCP tool calls
81
+ - Cleanup status endpoint (`/cleanup/status`) for monitoring background task
82
+ - `CleanupTaskManager` class for managing cleanup task lifecycle
83
+ - Enhanced health check endpoint with cleanup task initialization
84
+ - Comprehensive file management configuration documentation in README
85
+
86
+ ### Changed
87
+ - **BREAKING**: `CLEANUP_INTERVAL_HOURS` replaced with `CLEANUP_INTERVAL_MINUTES` for finer control
88
+ - Default attachment expiry configurable via environment variable instead of hardcoded 24 hours
89
+ - Cleanup task now starts automatically when first MCP tool is called (lazy initialization)
90
+ - Updated `.env.example` with new minute-based configuration options
91
+
92
+ ### Improved
93
+ - More granular control over cleanup timing with minute-based intervals
94
+ - Better resource management with automatic cleanup task lifecycle
95
+ - Enhanced monitoring capabilities with cleanup status endpoint
96
+ - Clearer documentation with practical configuration examples for development and production
97
+
98
+ ## [0.2.1] - 2025-09-20
99
+
100
+ ### Added
101
+ - HTTP file serving endpoint (`/files/{file_id}`) for downloaded attachments
102
+ - Secure UUID-based file URLs with automatic expiry (24 hours default)
103
+ - New `file_manager.py` module for attachment storage and cleanup management
104
+ - `cleanup_attachment_files` MCP tool for expired file management
105
+ - PUBLIC_HOST/PUBLIC_PORT environment variables for external URL generation
106
+ - PEP 8 compliance standards and development tools (flake8, black)
107
+ - Storage statistics tracking for attachment management
108
+
109
+ ### Changed
110
+ - **BREAKING**: `download_redmine_attachment` now returns `download_url` instead of `file_path`
111
+ - Attachment downloads now provide HTTP URLs for external access
112
+ - Docker URL generation fixed (uses localhost instead of 0.0.0.0)
113
+ - Dependencies optimized (httpx moved to dev/test dependencies)
114
+
115
+ ### Fixed
116
+ - Docker container URL accessibility issues for downloaded attachments
117
+ - URL generation for external clients in containerized environments
118
+
119
+ ### Improved
120
+ - Code quality with full PEP 8 compliance across all Python modules
121
+ - Test coverage for new HTTP URL return format
122
+ - Documentation updated with file serving details
123
+
124
+ ## [0.2.0] - 2025-09-20
125
+
126
+ ### Changed
127
+ - **BREAKING**: Migrated from FastAPI/SSE to FastMCP streamable HTTP transport
128
+ - **BREAKING**: MCP endpoint changed from `/sse` to `/mcp`
129
+ - Updated server architecture to use FastMCP's native HTTP capabilities
130
+ - Simplified initialization and removed FastAPI dependency layer
131
+
132
+ ### Added
133
+ - Native FastMCP streamable HTTP transport support
134
+ - Claude Code CLI setup command documentation
135
+ - Stateless HTTP mode for better scalability
136
+ - Smart issue summarization tool with comprehensive project analytics
137
+
138
+ ### Improved
139
+ - Better MCP protocol compliance with native FastMCP implementation
140
+ - Reduced complexity by removing custom FastAPI/SSE layer
141
+ - Updated all documentation to reflect new transport method
142
+ - Enhanced health check endpoint with service identification
143
+
144
+ ### Migration Notes
145
+ - Existing MCP clients need to update endpoint from `/sse` to `/mcp`
146
+ - Claude Code users can now use: `claude mcp add --transport http redmine http://127.0.0.1:8000/mcp`
147
+ - Server initialization simplified with `mcp.run(transport="streamable-http")`
148
+
149
+ ## [0.1.6] - 2025-06-19
150
+ ### Added
151
+ - New MCP tool `search_redmine_issues` for querying issues by text.
152
+
153
+ ## [0.1.5] - 2025-06-18
154
+ ### Added
155
+ - `get_redmine_issue` can now return attachment metadata via a new
156
+ `include_attachments` parameter.
157
+ - New MCP tool `download_redmine_attachment` for downloading attachments.
158
+
159
+ ## [0.1.4] - 2025-05-28
160
+
161
+ ### Removed
162
+ - Deprecated `get_redmine_issue_comments` tool. Use `get_redmine_issue` with
163
+ `include_journals=True` to retrieve comments.
164
+
165
+ ### Changed
166
+ - `get_redmine_issue` now includes issue journals by default. A new
167
+ `include_journals` parameter allows opting out of comment retrieval.
168
+
169
+ ## [0.1.3] - 2025-05-27
170
+
171
+ ### Added
172
+ - New MCP tool `list_my_redmine_issues` for retrieving issues assigned to the current user
173
+ - New MCP tool `get_redmine_issue_comments` for retrieving issue comments
174
+ ## [0.1.2] - 2025-05-26
175
+
176
+ ### Changed
177
+ - Roadmap moved to its own document with updated plans
178
+ - Improved README badges and links
179
+
180
+ ### Added
181
+ - New MCP tools `create_redmine_issue` and `update_redmine_issue` for managing issues
182
+ - Documentation updates describing the new tools
183
+ - Integration tests for issue creation and update
184
+ - Integration test for Redmine issue management
185
+
186
+ ## [0.1.1] - 2025-05-25
187
+
188
+ ### Changed
189
+ - Updated project documentation with correct repository URLs
190
+ - Updated LICENSE with proper copyright (2025 Kevin Tan and contributors)
191
+ - Enhanced VS Code integration documentation
192
+ - Improved .gitignore to include test coverage files
193
+
194
+
195
+ ## [0.1.0] - 2025-05-25
196
+
197
+ ### Added
198
+ - Initial release of Redmine MCP Server
199
+ - MIT License for open source distribution
200
+ - Core MCP server implementation with FastAPI and SSE transport
201
+ - Two primary MCP tools:
202
+ - `get_redmine_issue(issue_id)` - Retrieve detailed issue information
203
+ - `list_redmine_projects()` - List all accessible Redmine projects
204
+ - Comprehensive authentication support (username/password and API key)
205
+ - Modern Python project structure with uv package manager
206
+ - Complete testing framework with 20 tests:
207
+ - 10 unit tests for core functionality
208
+ - 7 integration tests for end-to-end workflows
209
+ - 3 connection validation tests
210
+ - Docker containerization support:
211
+ - Multi-stage Dockerfile with security hardening
212
+ - Docker Compose configuration with health checks
213
+ - Automated deployment script with comprehensive management
214
+ - Production-ready container setup with non-root user
215
+ - Comprehensive documentation:
216
+ - Detailed README.md with installation and usage instructions
217
+ - Complete API documentation with examples
218
+ - Docker deployment guide
219
+ - Testing framework documentation
220
+ - Git Flow workflow implementation with standard branching strategy
221
+ - Environment configuration templates and examples
222
+ - Advanced test runner with coverage reporting and flexible execution
223
+
224
+ ### Technical Features
225
+ - **Architecture**: FastAPI application with Server-Sent Events (SSE) transport
226
+ - **Security**: Authentication with Redmine instances, non-root Docker containers
227
+ - **Testing**: pytest framework with mocks, fixtures, and comprehensive coverage
228
+ - **Deployment**: Docker support with automated scripts and health monitoring
229
+ - **Documentation**: Complete module docstrings and user guides
230
+ - **Development**: Modern Python toolchain with uv, Git Flow, and automated testing
231
+
232
+ ### Dependencies
233
+ - Python 3.13+
234
+ - FastAPI with standard extensions
235
+ - MCP CLI tools
236
+ - python-redmine for Redmine API integration
237
+ - Docker for containerization
238
+ - pytest ecosystem for testing
239
+
240
+ ### Compatibility
241
+ - Compatible with Redmine 3.x and 4.x instances
242
+ - Supports both username/password and API key authentication
243
+ - Works with Docker and docker-compose
244
+ - Tested on macOS and Linux environments
245
+
246
+ [0.1.1]: https://github.com/jztan/redmine-mcp-server/releases/tag/v0.1.1
247
+ [0.1.0]: https://github.com/jztan/redmine-mcp-server/releases/tag/v0.1.0
248
+ [0.1.2]: https://github.com/jztan/redmine-mcp-server/releases/tag/v0.1.2
249
+
@@ -0,0 +1,68 @@
1
+ # Multi-stage Docker build for the Redmine MCP Server
2
+ FROM python:3.13-slim AS builder
3
+
4
+ # Set environment variables
5
+ ENV PYTHONDONTWRITEBYTECODE=1 \
6
+ PYTHONUNBUFFERED=1 \
7
+ UV_CACHE_DIR=/opt/uv-cache
8
+
9
+ # Install uv package manager
10
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
11
+
12
+ # Create and set working directory
13
+ WORKDIR /app
14
+
15
+ # Copy dependency files and source code for installation
16
+ COPY pyproject.toml uv.lock ./
17
+ COPY src/ ./src/
18
+ COPY README.md ./
19
+
20
+ # Install dependencies and the project in a virtual environment
21
+ RUN uv venv /opt/venv && \
22
+ uv pip install . --python=/opt/venv/bin/python
23
+
24
+ # Production stage
25
+ FROM python:3.13-slim AS runtime
26
+
27
+ # Set environment variables
28
+ ENV PYTHONDONTWRITEBYTECODE=1 \
29
+ PYTHONUNBUFFERED=1 \
30
+ PATH="/opt/venv/bin:$PATH"
31
+
32
+ # Install system dependencies
33
+ RUN apt-get update && \
34
+ apt-get install -y --no-install-recommends \
35
+ ca-certificates \
36
+ curl && \
37
+ rm -rf /var/lib/apt/lists/*
38
+
39
+ # Create non-root user
40
+ RUN groupadd --gid 1000 appuser && \
41
+ useradd --uid 1000 --gid appuser --shell /bin/bash --create-home appuser
42
+
43
+ # Copy virtual environment from builder stage
44
+ COPY --from=builder --chown=appuser:appuser /opt/venv /opt/venv
45
+
46
+ # Set working directory
47
+ WORKDIR /app
48
+
49
+ # Copy application code
50
+ COPY --chown=appuser:appuser src/ ./src/
51
+ COPY --chown=appuser:appuser README.md ./
52
+
53
+ # Create directories for logs and data
54
+ RUN mkdir -p /app/logs /app/data && \
55
+ chown -R appuser:appuser /app
56
+
57
+ # Switch to non-root user
58
+ USER appuser
59
+
60
+ # Health check
61
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
62
+ CMD curl -f http://localhost:8000/health || exit 1
63
+
64
+ # Expose port
65
+ EXPOSE 8000
66
+
67
+ # Default command
68
+ CMD ["python", "-m", "uvicorn", "src.redmine_mcp_server.main:app", "--host", "0.0.0.0", "--port", "8000"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Kevin Tan and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.