[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 환경 변수 설명 추가
This commit is contained in:
simple
2025-05-30 00:48:53 +09:00
parent 353638f5d7
commit de0b138d80
2 changed files with 25 additions and 3 deletions

View File

@ -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_API_URL": "your_gitlab_api_url",
"GITLAB_READ_ONLY_MODE": "false", "GITLAB_READ_ONLY_MODE": "false",
"USE_GITLAB_WIKI": "false", // use wiki api? "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", "USE_GITLAB_WIKI",
"-e", "-e",
"USE_MILESTONE", "USE_MILESTONE",
"-e",
"USE_PIPELINE",
"iwakitakuma/gitlab-mcp" "iwakitakuma/gitlab-mcp"
], ],
"env": { "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_API_URL": "https://gitlab.com/api/v4", // Optional, for self-hosted GitLab
"GITLAB_READ_ONLY_MODE": "false", "GITLAB_READ_ONLY_MODE": "false",
"USE_GITLAB_WIKI": "true", "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. - `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_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 🛠️ ## Tools 🛠️

View File

@ -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 GITLAB_READ_ONLY_MODE = process.env.GITLAB_READ_ONLY_MODE === "true";
const USE_GITLAB_WIKI = process.env.USE_GITLAB_WIKI === "true"; const USE_GITLAB_WIKI = process.env.USE_GITLAB_WIKI === "true";
const USE_MILESTONE = process.env.USE_MILESTONE === "true"; const USE_MILESTONE = process.env.USE_MILESTONE === "true";
const USE_PIPELINE = process.env.USE_PIPELINE === "true";
// Add proxy configuration // Add proxy configuration
const HTTP_PROXY = process.env.HTTP_PROXY; const HTTP_PROXY = process.env.HTTP_PROXY;
@ -614,6 +615,18 @@ const milestoneToolNames = [
"get_milestone_burndown_events", "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 * Smart URL handling for GitLab API
* *
@ -2852,9 +2865,13 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
? tools0 ? tools0
: tools0.filter(tool => !wikiToolNames.includes(tool.name)); : tools0.filter(tool => !wikiToolNames.includes(tool.name));
// Toggle milestone tools by USE_MILESTONE flag // Toggle milestone tools by USE_MILESTONE flag
let tools = USE_MILESTONE const tools2 = USE_MILESTONE
? tools1 ? tools1
: tools1.filter(tool => !milestoneToolNames.includes(tool.name)); : 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 제거 >>> // <<< START: Gemini 호환성을 위해 $schema 제거 >>>
tools = tools.map(tool => { tools = tools.map(tool => {