From de0b138d8002daf15d845c6360957c50d95a6288 Mon Sep 17 00:00:00 2001 From: simple Date: Fri, 30 May 2025 00:48:53 +0900 Subject: [PATCH] [feat/pipeline-support] feat: add USE_PIPELINE environment variable for conditional pipeline feature activation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit โœจ 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 ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์„ค๋ช… ์ถ”๊ฐ€ --- README.md | 9 +++++++-- index.ts | 19 ++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 17bba0a..43f3f32 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,8 @@ When using with the Claude App, you need to set up your API key and URLs directl "GITLAB_API_URL": "your_gitlab_api_url", "GITLAB_READ_ONLY_MODE": "false", "USE_GITLAB_WIKI": "false", // use wiki api? - "USE_MILESTONE": "false" // use milestone api? + "USE_MILESTONE": "false", // use milestone api? + "USE_PIPELINE": "false" // use pipeline api? } } } @@ -55,6 +56,8 @@ When using with the Claude App, you need to set up your API key and URLs directl "USE_GITLAB_WIKI", "-e", "USE_MILESTONE", + "-e", + "USE_PIPELINE", "iwakitakuma/gitlab-mcp" ], "env": { @@ -62,7 +65,8 @@ When using with the Claude App, you need to set up your API key and URLs directl "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_MILESTONE": "true", + "USE_PIPELINE": "true" } } } @@ -82,6 +86,7 @@ $ sh scripts/image_push.sh docker_user_name - `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_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. ## Tools ๐Ÿ› ๏ธ diff --git a/index.ts b/index.ts index 0e51645..5535dde 100644 --- a/index.ts +++ b/index.ts @@ -192,6 +192,7 @@ const GITLAB_PERSONAL_ACCESS_TOKEN = process.env.GITLAB_PERSONAL_ACCESS_TOKEN; const GITLAB_READ_ONLY_MODE = process.env.GITLAB_READ_ONLY_MODE === "true"; const USE_GITLAB_WIKI = process.env.USE_GITLAB_WIKI === "true"; const USE_MILESTONE = process.env.USE_MILESTONE === "true"; +const USE_PIPELINE = process.env.USE_PIPELINE === "true"; // Add proxy configuration const HTTP_PROXY = process.env.HTTP_PROXY; @@ -614,6 +615,18 @@ const milestoneToolNames = [ "get_milestone_burndown_events", ]; +// Define which tools are related to pipelines and can be toggled by USE_PIPELINE +const pipelineToolNames = [ + "list_pipelines", + "get_pipeline", + "list_pipeline_jobs", + "get_pipeline_job", + "get_pipeline_job_output", + "create_pipeline", + "retry_pipeline", + "cancel_pipeline", +]; + /** * Smart URL handling for GitLab API * @@ -2852,9 +2865,13 @@ server.setRequestHandler(ListToolsRequestSchema, async () => { ? tools0 : tools0.filter(tool => !wikiToolNames.includes(tool.name)); // Toggle milestone tools by USE_MILESTONE flag - let tools = USE_MILESTONE + const tools2 = USE_MILESTONE ? tools1 : tools1.filter(tool => !milestoneToolNames.includes(tool.name)); + // Toggle pipeline tools by USE_PIPELINE flag + let tools = USE_PIPELINE + ? tools2 + : tools2.filter(tool => !pipelineToolNames.includes(tool.name)); // <<< START: Gemini ํ˜ธํ™˜์„ฑ์„ ์œ„ํ•ด $schema ์ œ๊ฑฐ >>> tools = tools.map(tool => {