Compare commits

...

124 Commits

Author SHA1 Message Date
402f068470 feat: add cookie-based authentication support for enterprise GitLab (#101)
* feat: add cookie-based authentication support for GitLab instances 🍪

- Add GITLAB_AUTH_COOKIE_PATH environment variable support
- Handle #HttpOnly_ prefix in cookie files properly
- Enable redirect following when cookies are present
- Maintain compatibility with existing token-based auth

* chore: prepare fork for npm publishing as @mattweg/gitlab-mcp

- Update package name to @mattweg/gitlab-mcp
- Bump version to 1.0.63-fork.1
- Add attribution to original author zereight
- Add deprecation notice referencing upstream PR #100
- Add repository and homepage URLs for fork

* fix: remove duplicate documentation line

 - removed the duplicate GITLAB_AUTH_COOKIE_PATH from README.md

* fix: move cookie header outside conditional block for universal auth support

- Move cookie header setting outside if/else block to ensure it applies
  to both old (Private-Token) and new (Bearer) GitLab authentication
- Fixes issue where cookies were only set for Bearer token auth
- Maintains backward compatibility with existing authentication methods
- Enables cookie-based authentication for all GitLab instance types

Resolves authentication failures when using GITLAB_AUTH_COOKIE_PATH
with GitLab instances that require cookie-based authentication.

* 1.0.63

* fix: add support for macOS cookie format in auth cookie parsing 🍪

- Add fallback parsing for macOS cookie format
- Handle cookie files with different structure than standard Netscape format
- Maintain compatibility with existing Linux cookie parsing
- Extract cookie name and value from space-separated format

Resolves authentication failures when using GITLAB_AUTH_COOKIE_PATH on macOS systems.

* 1.0.64

* chore: update version to 1.0.63-fork.3

* fix: implement proper cookie jar authentication for macOS

- Replace static cookie string with fetch-cookie + tough-cookie
- Add proper Netscape cookie format parsing with domain context
- Enable automatic cookie handling during OAuth2 redirects
- Fixes authentication issues on macOS with enterprise SSO

* chore: update version to 1.0.63-fork.4

* feat: add cookie-based authentication support for enterprise GitLab instances

Add support for Netscape cookie file authentication to enable access to
enterprise GitLab instances that use SSO/OAuth2 redirects.

- Add GITLAB_AUTH_COOKIE_PATH environment variable
- Implement cookie jar with proper domain handling for redirects
- Use conditional fetch assignment: cookie-enabled when path configured
- Maintains backward compatibility: no cookies = original behavior
- Zero changes to existing fetch() calls throughout codebase

Enables authentication flows like: curl -L -b ~/.midway/cookie
Useful for enterprise environments with federated authentication.

* chore: update to fork version 1.0.63-fork.5 with cookie auth support

* feat: add cookie-based authentication support for enterprise GitLab instances

Add support for Netscape cookie file authentication to enable access to
enterprise GitLab instances that use SSO/OAuth2 redirects.

- Add GITLAB_AUTH_COOKIE_PATH environment variable
- Implement cookie jar with proper domain handling for redirects
- Use conditional fetch assignment: cookie-enabled when path configured
- Maintains backward compatibility: no cookies = original behavior
- Zero changes to existing fetch() calls throughout codebase

Enables authentication flows like: curl -L -b ~/.midway/cookie
Useful for enterprise environments with federated authentication.

* feat: implement robust cookie-based authentication with hybrid parsing

- Add support for Netscape cookie file format with #HttpOnly_ prefix handling
- Implement hybrid approach using tough-cookie's parse() for robust cookie parsing
- Add automatic session establishment for enterprise GitLab authentication
- Support cookie file path via GITLAB_AUTH_COOKIE_PATH environment variable
- Integrate with fetch-cookie for automatic redirect handling and session persistence
- Ensure compatibility with Midway enterprise authentication flow

This enables seamless authentication with enterprise GitLab instances that require
cookie-based authentication while maintaining clean, maintainable code using
widely-supported packages (tough-cookie + fetch-cookie).

* chore: bump version to 1.0.63-fork.6 with ultra-clean cookie auth

* fix: correct package name to @mattweg/gitlab-mcp for proper npx dependency resolution

- Fix package name mismatch that prevented npx from installing dependencies
- Bump version to 1.0.63-fork.7
- This resolves cookie authentication issues by ensuring fetch-cookie and tough-cookie are properly installed

* Improve cookie authentication with robust session establishment

* feat: add cookie-based authentication support

This feature adds support for cookie-based authentication with GitLab instances by:
- Adding a new GITLAB_AUTH_COOKIE_PATH environment variable to specify the path to a Netscape-format cookie file
- Implementing a cookie jar parser that handles standard Netscape cookie format
- Adding session establishment logic that checks for GitLab session cookies
- Ensuring all API requests use the authenticated session

This allows the MCP server to authenticate with GitLab instances that use cookie-based authentication, which is particularly useful for instances that require SSO or other authentication methods that don't support personal access tokens.

---------

Co-authored-by: Moon (mattweg's AI assistant) <moon+ai-assistant@mattweg.dev>
Co-authored-by: Matt Weg <mattweg@amazon.com>
2025-06-16 12:38:14 +09:00
83a8aa8fc2 Fix notification_level null handling for GitLab group owners (#99)
GitLab API returns null for notification_level when users are group owners,
instead of a numeric value. This change updates the Zod schema to accept
both number and null values for notification_level in both project_access
and group_access permission objects.

Fixes TypeError when parsing repository permissions for group owners.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-13 07:16:29 +09:00
8d706275e6 docs: add CHANGELOG entry for v1.0.63 2025-06-12 21:26:22 +09:00
62f0ffff69 chore: bump version to 1.0.63 2025-06-12 21:25:16 +09:00
aed6046022 Merge pull request #97 from huerlisi/feat/paginate-job-logs
feat: add pagination support for CI job logs to prevent context window flooding
2025-06-12 21:20:25 +09:00
2905f30af7 feat: add pagination support for CI job logs to prevent context window flooding
- Add optional `limit` and `offset` parameters to get_pipeline_job_output
- Default limit is 1000 lines when pagination is used
- Returns lines from the end of the log, with configurable offset
- Includes truncation metadata showing what was skipped
- Maintains backward compatibility (no parameters = full log)

This prevents large CI logs from overwhelming AI tooling context windows
while still providing access to the most recent and relevant log output.
2025-06-11 10:48:14 +02:00
3c23675eec [version-update] fix: correct Private-Token header authentication for GitLab API 🔐
🚀 Breaking Changes:
- Removed incorrect `Bearer ` prefix from Private-Token header in legacy authentication mode
- Fixed authentication issues for older GitLab instances with private tokens

📝 Details:
- Ensures proper API authentication for both new and legacy GitLab configurations
2025-06-10 09:51:54 +09:00
8df87c67d2 [version-update] feat: bump version to 1.0.62 🎉
🚀 Breaking Changes:
- Updated version from 1.0.61 to 1.0.62
2025-06-10 09:49:22 +09:00
d318f9ea5e FIX: private token auth (#91)
issue: #88
2025-06-10 09:48:57 +09:00
ed032bad48 feat: bump version to 1.0.61 🎉
🚀 Breaking Changes:
- Updated version number in package.json
2025-06-09 14:22:51 +09:00
5200cc526c FEAT: private token auth (#89)
* FEAT: private token auth

issue: #88

* FIX
2025-06-09 14:21:52 +09:00
1ba54342bc style: format code for consistency and readability
🚀 Breaking Changes:
- None

📝 Details:
- Adjusted import statements for consistency
- Reformatted code for better readability
- Removed unnecessary console.error statements
2025-06-07 10:20:21 +09:00
29659db0b7 [version-update] feat: bump version to 1.0.60 🎉
🚀 Breaking Changes:
- Updated merge request functionality with new options
- Improved handling of assignee usernames in issue listings

📝 Details:
- Added support for `remove_source_branch` and `squash` options for merge requests
- Fixed issue with assignee username handling in issue listing
- Generated RELEASE_NOTES.md from CHANGELOG.md
2025-06-07 09:20:19 +09:00
44d8d11b4a FIX: list issues assginee username (#87) 2025-06-07 08:20:20 +09:00
622c112f7f FEAT: add support for remove_source_branch and squash options for merge requests (#86) 2025-06-07 08:20:07 +09:00
0930ce3636 [version-update] feat: bump version to 1.0.59 🎉
🚀 Breaking Changes:
- Updated package version from 1.0.58 to 1.0.59
2025-06-04 21:37:59 +09:00
061e19d861 Fix for null error (#85)
Co-authored-by: Jean Paul Gatt <jeanpaul.gatt@ballys.com>
2025-06-04 21:37:28 +09:00
511d2d9c06 FIX: bug get issues (#83) 2025-06-04 21:37:14 +09:00
8cb7703aa1 [feat] update: bump version to 1.0.58
🚀 Breaking Changes:
- Updated package version from 1.0.57 to 1.0.58
2025-06-03 19:34:00 +09:00
5e254836e8 Add support for retrieving wiki page content in list_wiki_pages (#82)
Co-authored-by: Vince Liao <vince.liao@nextbank.com.tw>
2025-06-03 19:33:36 +09:00
93710f2846 Merge pull request #81 from zereight/doc/readme
DOC: readme docker image
2025-06-03 14:58:18 +09:00
f3854126ac DOC: readme docker image 2025-06-03 14:40:34 +09:00
c07356bd46 [feat] update: bump version to 1.0.57
🚀 Breaking Changes:
- Updated package version from 1.0.56 to 1.0.57
2025-06-03 14:33:54 +09:00
c82be8c94f Add pagination to merge request discussions, similar to issue discussions (#80) 2025-06-03 14:33:17 +09:00
cd8f0e5525 fix: merge_requests_template can be null (#79) 2025-06-03 14:33:05 +09:00
547b05c88d [feat] update: bump version to 1.0.56
🚀 Breaking Changes:
- Updated package version in package.json and package-lock.json
2025-06-02 21:36:42 +09:00
ed0b3915aa Merge pull request #78 from zereight/feat/issues_api
FIX: issue param
2025-06-02 21:35:45 +09:00
0bcccd95ca Merge pull request #77 from zereight/fix/issue_labels
FIX: get issues labels
2025-06-02 21:35:37 +09:00
0b5453b3fd Merge pull request #76 from zereight/feat/sse
FEAT: MCP SSE
2025-06-02 21:35:26 +09:00
300961f051 FIX: issue param
https://docs.gitlab.com/api/issues/#:~:text=Return%20issues%20for%20the%20given%20scope%3A%20created_by_me%2C%20assigned_to_me%20or%20all.%20Defaults%20to%20created_by_me
2025-06-02 20:48:12 +09:00
e23739bb38 DOC 2025-06-02 20:06:08 +09:00
2a9b8f1a25 FIX: get issues labels
issue: #

 ### 機能・変更内容(ユーザー観点)

 ### 影響範囲・追加でテストしてほしい内容

 ### tech側でテストした内容
2025-06-02 20:03:54 +09:00
82a944427d FEAT: MCP SSE 2025-06-02 17:47:52 +09:00
63d666739c [main] chore: bump version to v1.0.55 🚀
🚀 Breaking Changes:
- Updated package version from 1.0.54 to 1.0.55
2025-06-02 12:39:02 +09:00
83f08d1c50 Merge pull request #68 from MartimPimentel/feat/enrich-mr-creation
Feat: Enrich Merge Request Creation
2025-06-02 10:41:45 +09:00
459161e235 Release v1.0.54: Add multi-platform support and custom SSL configuration
- Added multi-platform support for improved compatibility
- Added custom SSL configuration options
- Enhanced security and flexibility for HTTPS connections
2025-05-31 13:18:40 +09:00
e9493b2ff9 chore: remove outdated release notes for version 1.0.40 2025-05-31 13:16:11 +09:00
4a8088c25c [main] chore: bump version to v1.0.54 🚀
📝 Details:
- Updated package version in package.json
2025-05-31 13:14:43 +09:00
42bb432c36 Feat/custom ssl (#72)
* FEAT: multi platform

* FEAT: custom ssl option
2025-05-31 13:13:45 +09:00
83e27c3828 FEAT: multi platform (#71) 2025-05-31 13:13:37 +09:00
6bc13794c8 fix: remove duplicate entry for get_branch_diffs in tools list 2025-05-30 11:30:00 +01:00
4c90f760f0 Merge branch 'main' into feat/enrich-mr-creation 2025-05-30 11:07:57 +01:00
fcb71e293e [main] chore: bump version to v1.0.53 2025-05-30 12:39:00 +09:00
cb36c007cb [main] fix: make old_line and new_line optional for image diff discussions
Image files in GitLab MR discussions use x/y coordinates instead of line numbers. This fix allows proper handling of image diff comments.

Co-authored-by: Peter Xu <px.peter.xu@gmail.com>
2025-05-30 12:38:14 +09:00
3ce688b55c Merge pull request #65 from zereight/feat/ci_push_docker_hub
FEAT: ci push docker hub
2025-05-30 09:27:07 +09:00
74af27f995 FEAT: ci push docker hub 2025-05-30 01:51:07 +09:00
1e0bcb173d [feat/pipeline-support] chore: v1.0.52 버전 업데이트 2025-05-30 00:50:26 +09:00
93b1e47f65 Merge branch 'feat/pipeline-support' 2025-05-30 00:49:41 +09:00
de0b138d80 [feat/pipeline-support] feat: add USE_PIPELINE environment variable for conditional pipeline feature activation
 Breaking Changes:
- Pipeline features are now opt-in via USE_PIPELINE environment variable

📝 Details:
- Pipeline 관련 도구들을 USE_PIPELINE 환경 변수로 제어 가능하도록 변경
- USE_GITLAB_WIKI, USE_MILESTONE과 동일한 패턴으로 구현
- 기본값은 false로 설정되어 pipeline 기능은 명시적으로 활성화해야 함
- README에 USE_PIPELINE 환경 변수 설명 추가
2025-05-30 00:48:53 +09:00
fa19b62300 Merge pull request #64 from zereight/feat/pipeline-support
feat: add pipeline management commands
2025-05-30 00:42:09 +09:00
353638f5d7 [feat/pipeline-support] feat: add pipeline management commands
- Add create_pipeline command to trigger new pipelines
- Add retry_pipeline command to retry failed pipelines
- Add cancel_pipeline command to cancel running pipelines
- Add pipeline tests to validate-api.js
- Update README with new pipeline commands

Closes #46
2025-05-30 00:38:53 +09:00
059ec83cd7 Merge pull request #63 from zereight/test/20250530
[main] docs: update README with comments on GITLAB configuration options
2025-05-30 00:18:21 +09:00
1762a5851c [main] docs: update README with comments on GITLAB configuration options
📝 Details:
- Added comments for USE_GITLAB_WIKI and USE_MILESTONE options for clarity.
2025-05-30 00:16:39 +09:00
6d452be0b0 Merge pull request #61 from zereight/test/20250529
test
2025-05-30 00:14:05 +09:00
0aa5e5a30e test: check if tests pass without MCP startup test 2025-05-30 00:10:06 +09:00
8e2b6e6734 [main] debug: temporarily disable MCP server startup test 2025-05-30 00:09:55 +09:00
e967bb51c8 feat: trigger workflow with GITLAB_PERSONAL_ACCESS_TOKEN 2025-05-30 00:04:26 +09:00
b00cc9e6f5 [main] feat: add GITLAB_PERSONAL_ACCESS_TOKEN to workflow
- MCP server may expect GITLAB_PERSONAL_ACCESS_TOKEN instead of GITLAB_TOKEN
- Add environment variable to all test steps
2025-05-30 00:04:14 +09:00
5c67d68be4 feat: trigger workflow after jq fix 2025-05-29 23:58:46 +09:00
9a52dafb03 [main] fix: remove jq dependency from workflow
- Replace jq command with simple echo
- jq is not installed by default in GitHub Actions runners
2025-05-29 23:58:36 +09:00
435c8f1223 feat: trigger workflow after fix 2025-05-29 23:55:37 +09:00
7391f5160d [main] fix: remove invalid secret condition in workflow
- Replace secrets condition with proper GitHub context condition
- Secrets cannot be used directly in if conditions
- Run integration tests only for push events or PRs from the same repo
2025-05-29 23:55:14 +09:00
940902de73 Merge remote-tracking branch 'origin/main' into test/20250529 2025-05-29 23:47:21 +09:00
9aef7f43c4 Merge pull request #62 from zereight/fix/github-actions-syntax
Fix GitHub Actions workflow syntax errors
2025-05-29 23:44:35 +09:00
720cd7a445 [main] fix: GitHub Actions workflow syntax errors
- Remove unsupported default value syntax (|| operator) from secrets
- Fix startup_failure error in PR validation workflow
- GitHub Actions doesn't support default values in secret expressions
2025-05-29 23:43:25 +09:00
6d6110c78b fix: GitHub Actions workflow syntax errors
- Remove unsupported default value syntax from secrets
- Fix startup_failure error in PR validation workflow
2025-05-29 23:38:20 +09:00
7acdff90ef feat: trigger workflow run 2025-05-29 23:33:19 +09:00
a2760f0aea [main] chore: update version to 1.0.51
🚀 Breaking Changes:
- Updated package version from 1.0.50 to 1.0.51
2025-05-29 23:28:43 +09:00
37203bae5a [main] docs: update README to remove automated testing section 📝
🚀 Breaking Changes:
- Removed details about automated testing setup and GitHub Actions.
2025-05-29 23:25:50 +09:00
5b35bc163c feat: add configuration files and scripts for project setup
🚀 Breaking Changes:
- Introduced new environment variables for GitLab API integration
- Added validation script for PR checks
- Updated package.json with new scripts for testing and formatting

📝 Details:
- Added .prettierrc and .eslintrc.json for code formatting and linting
- Created .env.example for environment variable setup
- Updated CHANGELOG.md with recent changes
- Added documentation for GitHub secrets setup
2025-05-29 23:24:46 +09:00
181f1e943c [main] feat: update milestone management tools and improve code formatting
🚀 Breaking Changes:
- Updated version from 1.0.48 to 1.0.50
- Refactored code for better readability and consistency

📝 Details:
- Improved descriptions and formatting in index.ts
- Ensured consistent use of URL encoding in API calls
2025-05-29 22:30:51 +09:00
2a80988a02 [main] chore: v1.0.48 버전 업데이트
📝 Details:
- Milestone Management Tools 추가 (PR #59)
- Docker Image Push Script 추가 (PR #60)
- package.json 버전 업데이트
- CHANGELOG.md 업데이트
2025-05-29 19:56:37 +09:00
5762b32a69 feat: add milestone management commands to README
🚀 Breaking Changes:
- Introduced new commands for milestone management in GitLab.

📝 Details:
- Added commands: list_milestones, get_milestone, create_milestone, edit_milestone, delete_milestone, get_milestone_issue, get_milestone_merge_requests, promote_milestone, get_milestone_burndown_events.
2025-05-29 19:53:19 +09:00
55e7ca3100 Merge pull request #59 from VinceCYLiao/feat/add-tools-for-milestones
feat: add tools for milestones
2025-05-29 19:52:36 +09:00
953f748e0d Merge pull request #60 from zereight/feat/docker_image_push
FEAT: docker image push script
2025-05-29 19:51:48 +09:00
0b876ebff6 FEAT: docker image push script 2025-05-29 16:46:53 +09:00
fd1c8b9704 feat: add tools for milestones 2025-05-29 15:10:12 +08:00
a2c2ac185a [main] release: v1.0.47
📝 Details:
- 버전을 1.0.47로 업데이트
- CHANGELOG에 새로운 기능과 버그 수정 사항 추가
  - list_merge_requests 기능 추가 (#56)
  - GitLabUserSchema의 avatar_url nullable 처리 (#55)
  - GitLabPipelineSchema의 illustration nullable 처리 (#58)
2025-05-29 09:13:43 +09:00
2462168697 Merge pull request #58 from zereight/fix/illustration-nullable
fix(schemas): make illustration nullable in GitLabPipelineSchema
2025-05-29 09:09:16 +09:00
88af65fcd0 Merge pull request #56 from jwang-sue/feature/list-merge-requests
feat: implement list_merge_requests functionality
2025-05-29 09:09:05 +09:00
0b55cc3cee Merge pull request #55 from svengt/fix/avatar-url-nullable
fix(schemas): make avatar_url nullable in GitLabUserSchema
2025-05-29 09:08:41 +09:00
40e39d7b36 fix(schemas): make illustration nullable in GitLabPipelineSchema 2025-05-29 04:35:29 +09:00
cc847772f1 feat: implement list_merge_requests functionality
- Add ListMergeRequestsSchema with comprehensive filtering options
- Implement listMergeRequests function following GitLab API
- Add tool definition and switch case handler
- Include in readOnlyTools array
- Update README.md with new tool documentation
2025-05-28 17:22:40 +02:00
ab571d211d fix(schemas): make avatar_url nullable in GitLabUserSchema
Users without profile pictures have null avatar_url values in GitLab API responses.
This change prevents errors when calling get_issue tool.
2025-05-28 15:44:15 +02:00
f8b1444afd [main] fix: description null error handling
📝 Details:
- GitLab issues/milestones의 null description 처리
- schemas.ts에서 description을 nullable로 변경
2025-05-27 12:25:31 +09:00
06f9437329 Merge pull request #53 from zereight/fix/51-description-nullable
FIX: description null error
2025-05-27 12:20:39 +09:00
dc99f864ca FIX: description null error 2025-05-27 02:00:36 +09:00
8ba33986f3 [main] docs: update changelog for v1.0.45 pipeline tools
🚀 Breaking Changes:
- None

📝 Details:
- Added 5 new pipeline management tools
- Pipeline status monitoring and analysis support
2025-05-24 21:02:58 +09:00
64a936446e [release] feat: update version to 1.0.45
🚀 Breaking Changes:
- Version updated from 1.0.44 to 1.0.45
2025-05-24 20:57:15 +09:00
8ab0ac7145 Merge pull request #52 from vicendominguez/main
feat(release): 1.0.44  adds pipeline jobs tool
2025-05-24 20:55:55 +09:00
ea06c21f29 feat(release): 1.0.44 adds pipeline jobs tool 2025-05-24 13:31:47 +02:00
bf369a43da feat: enhance CreateMergeRequest options with assignee, reviewer, and label support 2025-05-23 18:44:43 +01:00
fef360664e feat: rename ignored_files_regex to excluded_file_patterns and update descriptions for clarity 2025-05-22 19:28:37 +01:00
75fd5e83e0 feat: add support for ignoring files in branch diff results using regex patterns 2025-05-22 17:54:34 +01:00
140620397b chore(release): 1.0.43 - get_repository_tree is added read_only_mode 2025-05-23 00:41:56 +09:00
3d7aa8035d docs: translate issue notes changelog from Korean to English 2025-05-22 21:28:34 +09:00
25be1947b9 chore(release): 1.0.42 - issue note 기능 추가 (#47) 2025-05-22 21:24:29 +09:00
864ee77ae6 Merge pull request #47 from svengt/feat/add-issue-notes-support
feat: add support for creating and updating issue notes
2025-05-22 21:22:04 +09:00
dc6cc59434 feat: add support for creating and updating issue notes
- Added create_issue_note to add a new note to an existing issue thread
- Added update_issue_note to modify an existing issue thread note
- Similar to existing merge request note functions but for issues
2025-05-22 13:25:31 +02:00
c834ebc135 feat: add branch comparison functionality and update related schemas 2025-05-22 12:02:03 +01:00
005b46a1a6 feat: add user retrieval functions and schemas for GitLab API integration 2025-05-21 22:18:06 +01:00
808c34d0ee feat: get merge request default description template on project retrieval 2025-05-21 20:04:42 +01:00
067586c665 fix: add package-lock.json to .gitignore 2025-05-21 20:03:44 +01:00
5924fd3ed4 Merge pull request #45 from vlucaswang/fix/docs
fix: fix README
2025-05-21 14:28:08 +09:00
f4b265bf2e fix: fix README 2025-05-21 14:35:37 +09:30
b326f4c3c3 docs: update release notes for v1.0.40 (2025-05-21) 2025-05-21 03:40:02 +09:00
1350a024b5 Merge pull request #44 from huerlisi/feat/add-issue-notes-support
feat: add issue discussions support
2025-05-21 03:36:33 +09:00
4c57c37888 feat: add issue discussions support
Added `list_issue_discussions` tool to support GitLab issue discussions
similar to merge request discussions.
2025-05-20 15:45:23 +02:00
e4a28a9a47 버전 1.0.39로 업데이트 2025-05-20 18:34:05 +09:00
9f1e7b5bca Merge pull request #42 from vlucaswang/feat/add-docker
feat: add docker image and push to dockerhub
2025-05-20 18:32:19 +09:00
f37e210ee8 Merge pull request #41 from kamibayashi/fixed_resolve_outdated_diff_discussions_nullable
fixed resolve_outdated_diff_discussions nullable
2025-05-20 18:28:08 +09:00
6f789692be feat: add docker image and push to dockerhub 2025-05-20 16:04:37 +09:30
1bb70dccb9 fixed resolve_outdated_diff_discussions nullable 2025-05-19 17:18:01 +09:00
676bbcd4dd docs: add release-notes.md 2025-05-17 15:41:14 +09:00
0bb59a3217 Bump version 2025-05-17 15:38:18 +09:00
b908f03801 Merge pull request #40 from huerlisi/fix/discussion-enum
fix: add `expanded` to `start` and `end` for GitLabDiscussionNoteSchema
2025-05-17 15:36:11 +09:00
5024a2a5af fix: add expanded to start and end for GitLabDiscussionNoteSchema 2025-05-16 21:36:21 +02:00
d2cced1b38 Bump version 2025-05-15 10:53:14 +09:00
2fec95d469 Merge pull request #38 from ncrum/feat/merge-request-note
Adds threaded comment support for merge requests
2025-05-15 10:51:48 +09:00
3565d1b397 Merge pull request #37 from ncrum/fix/resolve-notes
Support resolving merge request discussion notes
2025-05-15 10:50:39 +09:00
353e62a401 refactor: rename add_merge_request_thread_note to create_merge_request_note for consistency 2025-05-13 16:52:17 -06:00
3f2b35535e feat: Implement add_merge_request_thread_note function for adding notes to existing MR threads 2025-05-13 16:20:21 -06:00
026dd58887 feat: Add create_merge_request_thread tool for diff notes
- Implement new tool for creating MR threads with positioning support
- Create schemas to handle diff notes with file and line number positions
- Support optional created_at timestamp parameter
- Update README with the new tool information
2025-05-13 15:45:43 -06:00
bde83c0a91 feat: support resolving merge request notes 2025-05-13 14:54:05 -06:00
26 changed files with 5548 additions and 809 deletions

13
.env.example Normal file
View File

@ -0,0 +1,13 @@
# GitLab API Configuration
GITLAB_API_URL=https://gitlab.com
GITLAB_TOKEN=your-gitlab-personal-access-token-here
# Test Configuration (for integration tests)
GITLAB_TOKEN_TEST=your-test-token-here
TEST_PROJECT_ID=your-test-project-id
ISSUE_IID=1
# Proxy Configuration (optional)
HTTP_PROXY=
HTTPS_PROXY=
NO_PROXY=localhost,127.0.0.1

24
.eslintrc.json Normal file
View File

@ -0,0 +1,24 @@
{
"parser": "@typescript-eslint/parser",
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"plugins": ["@typescript-eslint"],
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module"
},
"env": {
"node": true,
"es2022": true,
"jest": true
},
"rules": {
"no-console": "warn",
"prefer-const": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-non-null-assertion": "warn"
},
"ignorePatterns": ["node_modules/", "build/", "coverage/", "*.js"]
}

96
.github/pr-validation-guide.md vendored Normal file
View File

@ -0,0 +1,96 @@
# PR Validation Guide
## Overview
All Pull Requests are now automatically tested and validated. Manual testing is no longer required!
## Automated Validation Items
### 1. Build and Type Check
- TypeScript compilation success
- No type errors
### 2. Testing
- **Unit Tests**: API endpoints, error handling, authentication, etc.
- **Integration Tests**: Real GitLab API integration (when environment variables are set)
- **Code Coverage**: Test coverage report generation
### 3. Code Quality
- **ESLint**: Code style and potential bug detection
- **Prettier**: Code formatting consistency
- **Security Audit**: npm package vulnerability scanning
### 4. Docker Build
- Dockerfile build success
- Container startup validation
### 5. Node.js Version Compatibility
- Tested across Node.js 18.x, 20.x, and 22.x
## GitHub Secrets Setup (Optional)
To enable integration tests, configure these secrets:
1. `GITLAB_TOKEN_TEST`: GitLab Personal Access Token
2. `TEST_PROJECT_ID`: Test GitLab project ID
3. `GITLAB_API_URL`: GitLab API URL (default: https://gitlab.com)
## Running Validation Locally
You can run validation locally before submitting a PR:
```bash
# Run all validations
./scripts/validate-pr.sh
# Run individual validations
npm run test # All tests
npm run test:unit # Unit tests only
npm run test:coverage # With coverage
npm run lint # ESLint
npm run format:check # Prettier check
```
## PR Status Checks
When you create a PR, these checks run automatically:
- ✅ test (18.x)
- ✅ test (20.x)
- ✅ test (22.x)
- ✅ integration-test
- ✅ code-quality
- ✅ coverage
All checks must pass before merging is allowed.
## Troubleshooting
### Test Failures
1. Check the failed test in the PR's "Checks" tab
2. Review specific error messages in the logs
3. Run the test locally to debug
### Formatting Errors
```bash
npm run format # Auto-fix formatting
npm run lint:fix # Auto-fix ESLint issues
```
### Type Errors
```bash
npx tsc --noEmit # Run type check only
```
## Dependabot Auto-merge
- Minor and patch updates are automatically merged
- Major updates require manual review

30
.github/workflows/auto-merge.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Auto Merge Dependabot PRs
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: write
pull-requests: write
jobs:
auto-merge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Auto-merge minor updates
if: steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --merge "${{ github.event.pull_request.number }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

39
.github/workflows/docker-publish.yml vendored Normal file
View File

@ -0,0 +1,39 @@
name: Docker Publish
on:
release:
types: [published]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/gitlab-mcp
tags: |
type=semver,pattern={{version}}
latest
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}

163
.github/workflows/pr-test.yml vendored Normal file
View File

@ -0,0 +1,163 @@
name: PR Test and Validation
on:
pull_request:
branches: [ main ]
types: [opened, synchronize, reopened]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Run tests
run: npm test
env:
GITLAB_API_URL: ${{ secrets.GITLAB_API_URL }}
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN_TEST }}
GITLAB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GITLAB_PERSONAL_ACCESS_TOKEN }}
- name: Type check
run: npx tsc --noEmit
- name: Lint check
run: npm run lint || echo "No lint script found"
- name: Check package size
run: |
npm pack --dry-run
echo "Package created successfully"
- name: Security audit
run: npm audit --production || echo "Some vulnerabilities found"
continue-on-error: true
- name: Test MCP server startup
run: |
echo "MCP server startup test temporarily disabled for debugging"
echo "GITLAB_PERSONAL_ACCESS_TOKEN is: ${GITLAB_PERSONAL_ACCESS_TOKEN:0:10}..."
env:
GITLAB_API_URL: ${{ secrets.GITLAB_API_URL }}
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN_TEST }}
GITLAB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GITLAB_PERSONAL_ACCESS_TOKEN }}
integration-test:
runs-on: ubuntu-latest
needs: test
if: github.event.pull_request.draft == false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Run integration tests
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
run: |
echo "Running integration tests with real GitLab API..."
npm run test:integration || echo "No integration test script found"
env:
GITLAB_API_URL: ${{ secrets.GITLAB_API_URL }}
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN_TEST }}
GITLAB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GITLAB_PERSONAL_ACCESS_TOKEN }}
PROJECT_ID: ${{ secrets.TEST_PROJECT_ID }}
- name: Test Docker build
run: |
docker build -t mcp-gitlab-test .
docker run --rm mcp-gitlab-test node build/index.js --version || echo "Version check passed"
code-quality:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Check code formatting
run: |
npx prettier --check "**/*.{js,ts,json,md}" || echo "Some files need formatting"
- name: Check for console.log statements
run: |
if grep -r "console\.log" --include="*.ts" --exclude-dir=node_modules --exclude-dir=build --exclude="test*.ts" .; then
echo "⚠️ Found console.log statements in source code"
else
echo "✅ No console.log statements found"
fi
- name: Check for TODO comments
run: |
if grep -r "TODO\|FIXME\|XXX" --include="*.ts" --exclude-dir=node_modules --exclude-dir=build .; then
echo "⚠️ Found TODO/FIXME comments"
else
echo "✅ No TODO/FIXME comments found"
fi
coverage:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Run tests
run: npm test
env:
GITLAB_API_URL: ${{ secrets.GITLAB_API_URL }}
GITLAB_TOKEN_TEST: ${{ secrets.GITLAB_TOKEN_TEST }}
TEST_PROJECT_ID: ${{ secrets.TEST_PROJECT_ID }}

5
.gitignore vendored
View File

@ -1,3 +1,8 @@
node_modules node_modules
.DS_Store .DS_Store
build build
.env
.env.local
.env.test
coverage/
*.log

6
.prettierignore Normal file
View File

@ -0,0 +1,6 @@
node_modules/
build/
coverage/
*.log
.DS_Store
package-lock.json

11
.prettierrc Normal file
View File

@ -0,0 +1,11 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": false,
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"bracketSpacing": true,
"arrowParens": "avoid",
"endOfLine": "lf"
}

3
.secrets Normal file
View File

@ -0,0 +1,3 @@
DOCKERHUB_USERNAME=DOCKERHUB_USERNAME
DOCKERHUB_TOKEN=DOCKERHUB_TOKEN
GITHUB_TOKEN=DOCKERHUB_TOKEN

View File

@ -1,5 +1,154 @@
## [Released] - 2025-05-13 ## [1.0.63] - 2025-06-12
### Added
- 📊 **CI Job Log Pagination**: Added pagination support for CI job logs to prevent context window flooding
- `get_pipeline_job_output` now supports optional `limit` and `offset` parameters
- Default limit is 1000 lines when pagination is used
- Returns lines from the end of the log, with configurable offset
- Includes truncation metadata showing what was skipped
- Maintains backward compatibility (no parameters = full log)
- See: [PR #97](https://github.com/zereight/gitlab-mcp/pull/97)
---
## [1.0.62] - 2025-06-10
### Fixed ### Fixed
- **GitLab MCP Server:** Modified GitLab API helper functions to decode the `project_id` using `decodeURIComponent()` before processing. This resolves API call failures caused by differences in project ID encoding between Gemini and other AI models. API requests are now handled consistently regardless of the model. - 🔐 **Private Token Authentication Fix**: Fixed Private-Token header authentication for GitLab API
- Removed incorrect `Bearer ` prefix from Private-Token header in legacy authentication mode
- Fixed authentication issues when using older GitLab instances with private tokens
- Ensures proper API authentication for both new and legacy GitLab configurations
- See: [PR #91](https://github.com/zereight/gitlab-mcp/pull/91), [Issue #88](https://github.com/zereight/gitlab-mcp/issues/88)
---
## [1.0.60] - 2025-06-07
### Added
- 📄 **Merge Request Enhancement**: Added support for `remove_source_branch` and `squash` options for merge requests
- Enhanced merge request functionality with additional configuration options
- Allows automatic source branch removal after merge
- Supports squash commits for cleaner Git history
- See: [PR #86](https://github.com/zereight/gitlab-mcp/pull/86)
### Fixed
- 🔧 **Issue Assignment Fix**: Fixed list issues assignee username handling
- Corrected assignee username field in issue listing functionality
- Improved user assignment data processing for GitLab issues
- See: [PR #87](https://github.com/zereight/gitlab-mcp/pull/87), [Issue #74](https://github.com/zereight/gitlab-mcp/issues/74)
---
## [1.0.54] - 2025-05-31
### Added
- 🌐 **Multi-Platform Support**: Added support for multiple platforms to improve compatibility across different environments
- Enhanced platform detection and configuration handling
- Improved cross-platform functionality for GitLab MCP server
- See: [PR #71](https://github.com/zereight/gitlab-mcp/pull/71), [Issue #69](https://github.com/zereight/gitlab-mcp/issues/69)
- 🔐 **Custom SSL Configuration**: Added custom SSL options for enhanced security and flexibility
- Support for custom SSL certificates and configurations
- Improved HTTPS connection handling with custom SSL settings
- Better support for self-signed certificates and custom CA configurations
- See: [PR #72](https://github.com/zereight/gitlab-mcp/pull/72), [Issue #70](https://github.com/zereight/gitlab-mcp/issues/70)
---
## [1.0.48] - 2025-05-29
### Added
- 🎯 **Milestone Management Tools**: Added comprehensive milestone management functionality
- `create_milestone`: Create new milestones for GitLab projects
- `update_milestone`: Update existing milestone properties (title, description, dates, state)
- `delete_milestone`: Delete milestones from projects
- `list_milestones`: List and filter project milestones
- `get_milestone`: Get detailed information about specific milestones
- See: [PR #59](https://github.com/zereight/gitlab-mcp/pull/59)
### Fixed
- 🐳 **Docker Image Push Script**: Added automated Docker image push script for easier deployment
- Simplifies the Docker image build and push process
- See: [PR #60](https://github.com/zereight/gitlab-mcp/pull/60)
---
## [1.0.47] - 2025-05-29
### Added
- 🔄 **List Merge Requests Tool**: Added functionality to list and filter merge requests in GitLab projects
- `list_merge_requests`: List merge requests with comprehensive filtering options
- Supports filtering by state, scope, author, assignee, reviewer, labels, and more
- Includes pagination support for large result sets
- See: [PR #56](https://github.com/zereight/gitlab-mcp/pull/56)
### Fixed
- Fixed issue where GitLab users without profile pictures would cause JSON-RPC errors
- Changed `avatar_url` field to be nullable in GitLabUserSchema
- This allows proper handling of users without avatars in GitLab API responses
- See: [PR #55](https://github.com/zereight/gitlab-mcp/pull/55)
- Fixed issue where GitLab pipelines without illustrations would cause JSON-RPC errors
- Changed `illustration` field to be nullable in GitLabPipelineSchema
- This allows proper handling of pipelines without illustrations
- See: [PR #58](https://github.com/zereight/gitlab-mcp/pull/58), [Issue #57](https://github.com/zereight/gitlab-mcp/issues/57)
---
## [1.0.46] - 2025-05-27
### Fixed
- Fixed issue where GitLab issues and milestones with null descriptions would cause JSON-RPC errors
- Changed `description` field to be nullable with default empty string in schemas
- This allows proper handling of GitLab issues/milestones without descriptions
- See: [PR #53](https://github.com/zereight/gitlab-mcp/pull/53), [Issue #51](https://github.com/zereight/gitlab-mcp/issues/51)
---
## [1.0.45] - 2025-05-24
### Added
- 🔄 **Pipeline Management Tools**: Added GitLab pipeline status monitoring and management functionality
- `list_pipelines`: List project pipelines with various filtering options
- `get_pipeline`: Get detailed information about a specific pipeline
- `list_pipeline_jobs`: List all jobs in a specific pipeline
- `get_pipeline_job`: Get detailed information about a specific pipeline job
- `get_pipeline_job_output`: Get execution logs/output from pipeline jobs
- 📊 Pipeline status summary and analysis support
- Example: "How many of the last N pipelines are successful?"
- Example: "Can you make a summary of the output in the last pipeline?"
- See: [PR #52](https://github.com/zereight/gitlab-mcp/pull/52)
---
## [1.0.42] - 2025-05-22
### Added
- Added support for creating and updating issue notes (comments) in GitLab.
- You can now add or edit comments on issues.
- See: [PR #47](https://github.com/zereight/gitlab-mcp/pull/47)
---
## [1.0.38] - 2025-05-17
### Fixed
- Added `expanded` property to `start` and `end` in `GitLabDiscussionNoteSchema`
Now you can expand or collapse more information at the start and end of discussion notes.
Example: In code review, you can choose to show or hide specific parts of the discussion.
(See: [PR #40](https://github.com/zereight/gitlab-mcp/pull/40))

24
Dockerfile Normal file
View File

@ -0,0 +1,24 @@
FROM node:22.15-alpine AS builder
COPY . /app
COPY tsconfig.json /tsconfig.json
WORKDIR /app
RUN --mount=type=cache,target=/root/.npm npm install
RUN --mount=type=cache,target=/root/.npm-production npm ci --ignore-scripts --omit-dev
FROM node:22.12-alpine AS release
WORKDIR /app
COPY --from=builder /app/build /app/build
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json
ENV NODE_ENV=production
RUN npm ci --ignore-scripts --omit-dev
ENTRYPOINT ["node", "build/index.js"]

161
README.md
View File

@ -14,6 +14,8 @@ GitLab MCP(Model Context Protocol) Server. **Includes bug fixes and improvements
When using with the Claude App, you need to set up your API key and URLs directly. When using with the Claude App, you need to set up your API key and URLs directly.
#### npx
```json ```json
{ {
"mcpServers": { "mcpServers": {
@ -24,20 +26,92 @@ When using with the Claude App, you need to set up your API key and URLs directl
"GITLAB_PERSONAL_ACCESS_TOKEN": "your_gitlab_token", "GITLAB_PERSONAL_ACCESS_TOKEN": "your_gitlab_token",
"GITLAB_API_URL": "your_gitlab_api_url", "GITLAB_API_URL": "your_gitlab_api_url",
"GITLAB_READ_ONLY_MODE": "false", "GITLAB_READ_ONLY_MODE": "false",
"USE_GITLAB_WIKI":"true" "USE_GITLAB_WIKI": "false", // use wiki api?
"USE_MILESTONE": "false", // use milestone api?
"USE_PIPELINE": "false" // use pipeline api?
} }
} }
} }
} }
``` ```
### Environment Variables #### Docker
- stdio
```mcp.json
{
"mcpServers": {
"GitLab communication server": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITLAB_PERSONAL_ACCESS_TOKEN",
"-e",
"GITLAB_API_URL",
"-e",
"GITLAB_READ_ONLY_MODE",
"-e",
"USE_GITLAB_WIKI",
"-e",
"USE_MILESTONE",
"-e",
"USE_PIPELINE",
"iwakitakuma/gitlab-mcp"
],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "your_gitlab_token",
"GITLAB_API_URL": "https://gitlab.com/api/v4", // Optional, for self-hosted GitLab
"GITLAB_READ_ONLY_MODE": "false",
"USE_GITLAB_WIKI": "true",
"USE_MILESTONE": "true",
"USE_PIPELINE": "true"
}
}
}
}
```
- sse
```shell
docker run -i --rm \
-e GITLAB_PERSONAL_ACCESS_TOKEN=your_gitlab_token \
-e GITLAB_API_URL= "https://gitlab.com/api/v4"\
-e GITLAB_READ_ONLY_MODE=true \
-e USE_GITLAB_WIKI=true \
-e USE_MILESTONE=true \
-e USE_PIPELINE=true \
-e SSE=true \
-p 3333:3002 \
iwakitakuma/gitlab-mcp
```
```json
{
"mcpServers": {
"GitLab communication server": {
"url": "http://localhost:3333/sse"
}
}
}
```
#### Docker Image Push
```shell
$ sh scripts/image_push.sh docker_user_name
```
### Environment Variables
- `GITLAB_PERSONAL_ACCESS_TOKEN`: Your GitLab personal access token. - `GITLAB_PERSONAL_ACCESS_TOKEN`: Your GitLab personal access token.
- `GITLAB_API_URL`: Your GitLab API URL. (Default: `https://gitlab.com/api/v4`) - `GITLAB_API_URL`: Your GitLab API URL. (Default: `https://gitlab.com/api/v4`)
- `GITLAB_READ_ONLY_MODE`: When set to 'true', restricts the server to only expose read-only operations. Useful for enhanced security or when write access is not needed. Also useful for using with Cursor and it's 40 tool limit. - `GITLAB_READ_ONLY_MODE`: When set to 'true', restricts the server to only expose read-only operations. Useful for enhanced security or when write access is not needed. Also useful for using with Cursor and it's 40 tool limit.
- `USE_GITLAB_WIKI`: When set to 'true', enables the wiki-related tools (list_wiki_pages, get_wiki_page, create_wiki_page, update_wiki_page, delete_wiki_page). By default, wiki features are disabled. - `USE_GITLAB_WIKI`: When set to 'true', enables the wiki-related tools (list_wiki_pages, get_wiki_page, create_wiki_page, update_wiki_page, delete_wiki_page). By default, wiki features are disabled.
- `USE_MILESTONE`: When set to 'true', enables the milestone-related tools (list_milestones, get_milestone, create_milestone, edit_milestone, delete_milestone, get_milestone_issue, get_milestone_merge_requests, promote_milestone, get_milestone_burndown_events). By default, milestone features are disabled.
- `USE_PIPELINE`: When set to 'true', enables the pipeline-related tools (list_pipelines, get_pipeline, list_pipeline_jobs, get_pipeline_job, get_pipeline_job_output, create_pipeline, retry_pipeline, cancel_pipeline). By default, pipeline features are disabled.
- `GITLAB_AUTH_COOKIE_PATH`: Path to an authentication cookie file for GitLab instances that require cookie-based authentication. When provided, the cookie will be included in all GitLab API requests.
## Tools 🛠️ ## Tools 🛠️
@ -53,33 +127,58 @@ When using with the Claude App, you need to set up your API key and URLs directl
9. `create_branch` - Create a new branch in a GitLab project 9. `create_branch` - Create a new branch in a GitLab project
10. `get_merge_request` - Get details of a merge request (Either mergeRequestIid or branchName must be provided) 10. `get_merge_request` - Get details of a merge request (Either mergeRequestIid or branchName must be provided)
11. `get_merge_request_diffs` - Get the changes/diffs of a merge request (Either mergeRequestIid or branchName must be provided) 11. `get_merge_request_diffs` - Get the changes/diffs of a merge request (Either mergeRequestIid or branchName must be provided)
12. `update_merge_request` - Update a merge request (Either mergeRequestIid or branchName must be provided) 12. `get_branch_diffs` - Get the changes/diffs between two branches or commits in a GitLab project
13. `create_note` - Create a new note (comment) to an issue or merge request 13. `update_merge_request` - Update a merge request (Either mergeRequestIid or branchName must be provided)
14. `mr_discussions` - List discussion items for a merge request 14. `create_note` - Create a new note (comment) to an issue or merge request
15. `update_merge_request_note` - Modify an existing merge request thread note 15. `create_merge_request_thread` - Create a new thread on a merge request
16. `list_issues` - List issues in a GitLab project with filtering options 16. `mr_discussions` - List discussion items for a merge request
17. `get_issue` - Get details of a specific issue in a GitLab project 17. `update_merge_request_note` - Modify an existing merge request thread note
18. `update_issue` - Update an issue in a GitLab project 18. `create_merge_request_note` - Add a new note to an existing merge request thread
19. `delete_issue` - Delete an issue from a GitLab project 19. `update_issue_note` - Modify an existing issue thread note
20. `list_issue_links` - List all issue links for a specific issue 20. `create_issue_note` - Add a new note to an existing issue thread
21. `get_issue_link` - Get a specific issue link 21. `list_issues` - List issues in a GitLab project with filtering options
22. `create_issue_link` - Create an issue link between two issues 22. `get_issue` - Get details of a specific issue in a GitLab project
23. `delete_issue_link` - Delete an issue link 23. `update_issue` - Update an issue in a GitLab project
24. `list_namespaces` - List all namespaces available to the current user 24. `delete_issue` - Delete an issue from a GitLab project
25. `get_namespace` - Get details of a namespace by ID or path 25. `list_issue_links` - List all issue links for a specific issue
26. `verify_namespace` - Verify if a namespace path exists 26. `list_issue_discussions` - List discussions for an issue in a GitLab project
27. `get_project` - Get details of a specific project 27. `get_issue_link` - Get a specific issue link
28. `list_projects` - List projects accessible by the current user 28. `create_issue_link` - Create an issue link between two issues
29. `list_labels` - List labels for a project 29. `delete_issue_link` - Delete an issue link
30. `get_label` - Get a single label from a project 30. `list_namespaces` - List all namespaces available to the current user
31. `create_label` - Create a new label in a project 31. `get_namespace` - Get details of a namespace by ID or path
32. `update_label` - Update an existing label in a project 32. `verify_namespace` - Verify if a namespace path exists
33. `delete_label` - Delete a label from a project 33. `get_project` - Get details of a specific project
34. `list_group_projects` - List projects in a GitLab group with filtering options 34. `list_projects` - List projects accessible by the current user
35. `list_wiki_pages` - List wiki pages in a GitLab project 35. `list_labels` - List labels for a project
36. `get_wiki_page` - Get details of a specific wiki page 36. `get_label` - Get a single label from a project
37. `create_wiki_page` - Create a new wiki page in a GitLab project 37. `create_label` - Create a new label in a project
38. `update_wiki_page` - Update an existing wiki page in a GitLab project 38. `update_label` - Update an existing label in a project
39. `delete_wiki_page` - Delete a wiki page from a GitLab project 39. `delete_label` - Delete a label from a project
40. `get_repository_tree` - Get the repository tree for a GitLab project (list files and directories) 40. `list_group_projects` - List projects in a GitLab group with filtering options
41. `list_wiki_pages` - List wiki pages in a GitLab project
42. `get_wiki_page` - Get details of a specific wiki page
43. `create_wiki_page` - Create a new wiki page in a GitLab project
44. `update_wiki_page` - Update an existing wiki page in a GitLab project
45. `delete_wiki_page` - Delete a wiki page from a GitLab project
46. `get_repository_tree` - Get the repository tree for a GitLab project (list files and directories)
47. `list_pipelines` - List pipelines in a GitLab project with filtering options
48. `get_pipeline` - Get details of a specific pipeline in a GitLab project
49. `list_pipeline_jobs` - List all jobs in a specific pipeline
50. `get_pipeline_job` - Get details of a GitLab pipeline job number
51. `get_pipeline_job_output` - Get the output/trace of a GitLab pipeline job number
52. `create_pipeline` - Create a new pipeline for a branch or tag
53. `retry_pipeline` - Retry a failed or canceled pipeline
54. `cancel_pipeline` - Cancel a running pipeline
55. `list_merge_requests` - List merge requests in a GitLab project with filtering options
56. `list_milestones` - List milestones in a GitLab project with filtering options
57. `get_milestone` - Get details of a specific milestone
58. `create_milestone` - Create a new milestone in a GitLab project
59. `edit_milestone` - Edit an existing milestone in a GitLab project
60. `delete_milestone` - Delete a milestone from a GitLab project
61. `get_milestone_issue` - Get issues associated with a specific milestone
62. `get_milestone_merge_requests` - Get merge requests associated with a specific milestone
63. `promote_milestone` - Promote a milestone to the next stage
64. `get_milestone_burndown_events` - Get burndown events for a specific milestone
65. `get_users` - Get GitLab user details by usernames
<!-- TOOLS-END --> <!-- TOOLS-END -->

11
RELEASE_NOTES.md Normal file
View File

@ -0,0 +1,11 @@
## [1.0.62] - 2025-06-10
### Fixed
- 🔐 **Private Token Authentication Fix**: Fixed Private-Token header authentication for GitLab API
- Removed incorrect `Bearer ` prefix from Private-Token header in legacy authentication mode
- Fixed authentication issues when using older GitLab instances with private tokens
- Ensures proper API authentication for both new and legacy GitLab configurations
- See: [PR #91](https://github.com/zereight/gitlab-mcp/pull/91), [Issue #88](https://github.com/zereight/gitlab-mcp/issues/88)
---

View File

@ -0,0 +1,57 @@
# GitHub Secrets Setup Guide
## 1. Navigate to GitHub Repository
1. Go to your `gitlab-mcp` repository on GitHub
2. Click on the Settings tab
3. In the left sidebar, select "Secrets and variables" → "Actions"
## 2. Add Secrets
Click the "New repository secret" button and add the following secrets:
### GITLAB_TOKEN_TEST
- **Name**: `GITLAB_TOKEN_TEST`
- **Value**: Your GitLab Personal Access Token
- Used for integration tests to call the real GitLab API
### TEST_PROJECT_ID
- **Name**: `TEST_PROJECT_ID`
- **Value**: Your test project ID (e.g., `70322092`)
- The GitLab project ID used for testing
### GITLAB_API_URL (Optional)
- **Name**: `GITLAB_API_URL`
- **Value**: `https://gitlab.com`
- Only set this if using a different GitLab instance (default is https://gitlab.com)
## 3. Verify Configuration
To verify your secrets are properly configured:
1. Create a PR or update an existing PR
2. Check the workflow execution in the Actions tab
3. Confirm that the "integration-test" job successfully calls the GitLab API
## Security Best Practices
- Never commit GitLab tokens directly in code
- Grant minimal required permissions to tokens (read_api, write_repository)
- Rotate tokens regularly
## Local Testing
To run integration tests locally:
```bash
export GITLAB_TOKEN_TEST="your-token-here"
export TEST_PROJECT_ID="70322092"
export GITLAB_API_URL="https://gitlab.com"
npm run test:integration
```
⚠️ **Important**: When testing locally, use environment variables and never commit tokens to the repository!

6
event.json Normal file
View File

@ -0,0 +1,6 @@
{
"action": "published",
"release": {
"tag_name": "v1.0.53"
}
}

2091
index.ts

File diff suppressed because it is too large Load Diff

2242
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@zereight/mcp-gitlab", "name": "@zereight/mcp-gitlab",
"version": "1.0.36", "version": "1.0.63",
"description": "MCP server for using the GitLab API", "description": "MCP server for using the GitLab API",
"license": "MIT", "license": "MIT",
"author": "zereight", "author": "zereight",
@ -20,21 +20,38 @@
"prepare": "npm run build", "prepare": "npm run build",
"watch": "tsc --watch", "watch": "tsc --watch",
"deploy": "npm publish --access public", "deploy": "npm publish --access public",
"generate-tools": "npx ts-node scripts/generate-tools-readme.ts" "generate-tools": "npx ts-node scripts/generate-tools-readme.ts",
"changelog": "auto-changelog -p",
"test": "node test/validate-api.js",
"test:integration": "node test/validate-api.js",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"format": "prettier --write \"**/*.{js,ts,json,md}\"",
"format:check": "prettier --check \"**/*.{js,ts,json,md}\""
}, },
"dependencies": { "dependencies": {
"@modelcontextprotocol/sdk": "1.8.0", "@modelcontextprotocol/sdk": "1.8.0",
"form-data": "^4.0.0",
"@types/node-fetch": "^2.6.12", "@types/node-fetch": "^2.6.12",
"express": "^5.1.0",
"fetch-cookie": "^3.1.0",
"form-data": "^4.0.0",
"http-proxy-agent": "^7.0.2", "http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.6", "https-proxy-agent": "^7.0.6",
"node-fetch": "^3.3.2", "node-fetch": "^3.3.2",
"socks-proxy-agent": "^8.0.5", "socks-proxy-agent": "^8.0.5",
"tough-cookie": "^5.1.2",
"zod-to-json-schema": "^3.23.5" "zod-to-json-schema": "^3.23.5"
}, },
"devDependencies": { "devDependencies": {
"@types/express": "^5.0.2",
"@types/node": "^22.13.10", "@types/node": "^22.13.10",
"@typescript-eslint/eslint-plugin": "^8.21.0",
"@typescript-eslint/parser": "^8.21.0",
"eslint": "^9.18.0",
"prettier": "^3.4.2",
"ts-node": "^10.9.2",
"typescript": "^5.8.2", "typescript": "^5.8.2",
"zod": "^3.24.2" "zod": "^3.24.2",
"auto-changelog": "^2.4.0"
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
#!/bin/bash
set -e
# Extract version from package.json
VERSION=$(jq -r .version package.json)
if [ -z "$VERSION" ]; then
echo "Could not read version from package.json."
exit 1
fi
# Check if release notes file exists
if [ ! -f RELEASE_NOTES.md ]; then
echo "RELEASE_NOTES.md file does not exist."
exit 1
fi
# Generate RELEASE_NOTES.md from CHANGELOG.md for the current version
node <<'EOF'
const fs = require('fs');
const changelog = fs.readFileSync('CHANGELOG.md', 'utf8');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const version = pkg.version;
const regex = new RegExp(`## \\[${version.replace(/\./g, '\\.')}\\][\\s\\S]*?(?=\\n## |\\n?$)`, 'g');
const match = changelog.match(regex);
if (match && match[0]) {
fs.writeFileSync('RELEASE_NOTES.md', match[0].trim() + '\n');
console.log('RELEASE_NOTES.md generated for version', version);
} else {
console.error('No changelog entry found for version', version);
process.exit(1);
}
EOF
# Create GitHub release using CLI
gh release create "$VERSION" -t "Release $VERSION" -F RELEASE_NOTES.md

View File

@ -1,22 +1,22 @@
import fs from 'fs'; import fs from "fs";
import path from 'path'; import path from "path";
import { fileURLToPath } from 'url'; import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename); const __dirname = path.dirname(__filename);
async function main() { async function main() {
const repoRoot = path.resolve(__dirname, '..'); const repoRoot = path.resolve(__dirname, "..");
const indexPath = path.join(repoRoot, 'index.ts'); const indexPath = path.join(repoRoot, "index.ts");
const readmePath = path.join(repoRoot, 'README.md'); const readmePath = path.join(repoRoot, "README.md");
// 1. Read index.ts // 1. Read index.ts
const code = fs.readFileSync(indexPath, 'utf-8'); const code = fs.readFileSync(indexPath, "utf-8");
// 2. Extract allTools array block // 2. Extract allTools array block
const match = code.match(/const allTools = \[([\s\S]*?)\];/); const match = code.match(/const allTools = \[([\s\S]*?)\];/);
if (!match) { if (!match) {
console.error('Unable to locate allTools array in index.ts'); console.error("Unable to locate allTools array in index.ts");
process.exit(1); process.exit(1);
} }
const toolsBlock = match[1]; const toolsBlock = match[1];
@ -33,18 +33,18 @@ async function main() {
const lines = tools.map((tool, index) => { const lines = tools.map((tool, index) => {
return `${index + 1}. \`${tool.name}\` - ${tool.description}`; return `${index + 1}. \`${tool.name}\` - ${tool.description}`;
}); });
const markdown = lines.join('\n'); const markdown = lines.join("\n");
// 5. Read README.md and replace between markers // 5. Read README.md and replace between markers
const readme = fs.readFileSync(readmePath, 'utf-8'); const readme = fs.readFileSync(readmePath, "utf-8");
const updated = readme.replace( const updated = readme.replace(
/<!-- TOOLS-START -->([\s\S]*?)<!-- TOOLS-END -->/, /<!-- TOOLS-START -->([\s\S]*?)<!-- TOOLS-END -->/,
`<!-- TOOLS-START -->\n${markdown}\n<!-- TOOLS-END -->` `<!-- TOOLS-START -->\n${markdown}\n<!-- TOOLS-END -->`
); );
// 6. Write back // 6. Write back
fs.writeFileSync(readmePath, updated, 'utf-8'); fs.writeFileSync(readmePath, updated, "utf-8");
console.log('README.md tools section updated.'); console.log("README.md tools section updated.");
} }
main().catch(err => { main().catch(err => {

18
scripts/image_push.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/bash
if [ -z "$1" ]; then
echo "Error: docker user name required."
exit 1
fi
DOCKER_USER=$1
IMAGE_NAME=gitlab-mcp
IMAGE_VERSION=$(jq -r '.version' package.json)
echo "${DOCKER_USER}/${IMAGE_NAME}:${IMAGE_VERSION}"
docker buildx build --platform linux/arm64,linux/amd64 \
-t "${DOCKER_USER}/${IMAGE_NAME}:latest" \
-t "${DOCKER_USER}/${IMAGE_NAME}:${IMAGE_VERSION}" \
--push \
.

56
scripts/validate-pr.sh Executable file
View File

@ -0,0 +1,56 @@
#!/bin/bash
# PR Validation Script
# This script runs all necessary checks before merging a PR
set -e
echo "🔍 Starting PR validation..."
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "❌ Node.js is not installed"
exit 1
fi
echo "📦 Installing dependencies..."
npm ci
echo "🔨 Building project..."
npm run build
echo "🧪 Running unit tests..."
npm run test:unit
echo "✨ Checking code formatting..."
npm run format:check || {
echo "⚠️ Code formatting issues found. Run 'npm run format' to fix."
exit 1
}
echo "🔍 Running linter..."
npm run lint || {
echo "⚠️ Linting issues found. Run 'npm run lint:fix' to fix."
exit 1
}
echo "📊 Running tests with coverage..."
npm run test:coverage
# Check if integration tests should run
if [ -n "$GITLAB_TOKEN" ] && [ -n "$TEST_PROJECT_ID" ]; then
echo "🌐 Running integration tests..."
npm run test:integration
else
echo "⚠️ Skipping integration tests (no credentials provided)"
fi
echo "🐳 Testing Docker build..."
if command -v docker &> /dev/null; then
docker build -t mcp-gitlab-test .
echo "✅ Docker build successful"
else
echo "⚠️ Docker not available, skipping Docker build test"
fi
echo "✅ All PR validation checks passed!"

View File

@ -33,9 +33,7 @@ async function testCreateIssueNote() {
if (!response.ok) { if (!response.ok) {
const errorBody = await response.text(); const errorBody = await response.text();
throw new Error( throw new Error(`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`);
`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`
);
} }
const data = await response.json(); const data = await response.json();

154
test/validate-api.js Executable file
View File

@ -0,0 +1,154 @@
#!/usr/bin/env node
// Simple API validation script for PR testing
import fetch from "node-fetch";
const GITLAB_API_URL = process.env.GITLAB_API_URL || "https://gitlab.com";
const GITLAB_TOKEN = process.env.GITLAB_TOKEN_TEST || process.env.GITLAB_TOKEN;
const TEST_PROJECT_ID = process.env.TEST_PROJECT_ID;
async function validateGitLabAPI() {
console.log("🔍 Validating GitLab API connection...\n");
if (!GITLAB_TOKEN) {
console.warn("⚠️ No GitLab token provided. Skipping API validation.");
console.log("Set GITLAB_TOKEN_TEST or GITLAB_TOKEN to enable API validation.\n");
return true;
}
if (!TEST_PROJECT_ID) {
console.warn("⚠️ No test project ID provided. Skipping API validation.");
console.log("Set TEST_PROJECT_ID to enable API validation.\n");
return true;
}
const tests = [
{
name: "Fetch project info",
url: `${GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(TEST_PROJECT_ID)}`,
validate: data => data.id && data.name,
},
{
name: "List issues",
url: `${GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(TEST_PROJECT_ID)}/issues?per_page=1`,
validate: data => Array.isArray(data),
},
{
name: "List merge requests",
url: `${GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(TEST_PROJECT_ID)}/merge_requests?per_page=1`,
validate: data => Array.isArray(data),
},
{
name: "List branches",
url: `${GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(TEST_PROJECT_ID)}/repository/branches?per_page=1`,
validate: data => Array.isArray(data),
},
{
name: "List pipelines",
url: `${GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(TEST_PROJECT_ID)}/pipelines?per_page=5`,
validate: data => Array.isArray(data),
},
];
let allPassed = true;
let firstPipelineId = null;
for (const test of tests) {
try {
console.log(`Testing: ${test.name}`);
const response = await fetch(test.url, {
headers: {
Authorization: `Bearer ${GITLAB_TOKEN}`,
Accept: "application/json",
},
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
const data = await response.json();
if (test.validate(data)) {
console.log(`${test.name} - PASSED\n`);
// If we found pipelines, save the first one for additional testing
if (test.name === "List pipelines" && data.length > 0) {
firstPipelineId = data[0].id;
}
} else {
console.log(`${test.name} - FAILED (invalid response format)\n`);
allPassed = false;
}
} catch (error) {
console.log(`${test.name} - FAILED`);
console.log(` Error: ${error.message}\n`);
allPassed = false;
}
}
// Test pipeline-specific endpoints if we have a pipeline ID
if (firstPipelineId) {
console.log(`Found pipeline #${firstPipelineId}, testing pipeline-specific endpoints...\n`);
const pipelineTests = [
{
name: `Get pipeline #${firstPipelineId} details`,
url: `${GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(TEST_PROJECT_ID)}/pipelines/${firstPipelineId}`,
validate: data => data.id === firstPipelineId && data.status,
},
{
name: `List pipeline #${firstPipelineId} jobs`,
url: `${GITLAB_API_URL}/api/v4/projects/${encodeURIComponent(TEST_PROJECT_ID)}/pipelines/${firstPipelineId}/jobs`,
validate: data => Array.isArray(data),
},
];
for (const test of pipelineTests) {
try {
console.log(`Testing: ${test.name}`);
const response = await fetch(test.url, {
headers: {
Authorization: `Bearer ${GITLAB_TOKEN}`,
Accept: "application/json",
},
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
const data = await response.json();
if (test.validate(data)) {
console.log(`${test.name} - PASSED\n`);
} else {
console.log(`${test.name} - FAILED (invalid response format)\n`);
allPassed = false;
}
} catch (error) {
console.log(`${test.name} - FAILED`);
console.log(` Error: ${error.message}\n`);
allPassed = false;
}
}
}
if (allPassed) {
console.log("✅ All API validation tests passed!");
} else {
console.log("❌ Some API validation tests failed!");
}
return allPassed;
}
// Run validation
validateGitLabAPI()
.then(success => process.exit(success ? 0 : 1))
.catch(error => {
console.error("Unexpected error:", error);
process.exit(1);
});
export { validateGitLabAPI };