diff --git a/README.md b/README.md index e651325..cc52d80 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,7 @@ $ sh scripts/image_push.sh docker_user_name - `GITLAB_API_URL`: Your GitLab API URL. (Default: `https://gitlab.com/api/v4`) - `GITLAB_PROJECT_ID`: Default project ID. If set, Overwrite this value when making an API request. - `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_DENIED_TOOLS_REGEX`: When set as a regular expression, it excludes the matching tools. - `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. diff --git a/index.ts b/index.ts index 172ded3..a956918 100644 --- a/index.ts +++ b/index.ts @@ -242,6 +242,7 @@ const GITLAB_PERSONAL_ACCESS_TOKEN = process.env.GITLAB_PERSONAL_ACCESS_TOKEN; const GITLAB_AUTH_COOKIE_PATH = process.env.GITLAB_AUTH_COOKIE_PATH; const IS_OLD = process.env.GITLAB_IS_OLD === "true"; const GITLAB_READ_ONLY_MODE = process.env.GITLAB_READ_ONLY_MODE === "true"; +const GITLAB_DENIED_TOOLS_REGEX = process.env.GITLAB_DENIED_TOOLS_REGEX ? new RegExp(process.env.GITLAB_DENIED_TOOLS_REGEX):undefined; 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"; @@ -3441,6 +3442,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => { : 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)); + tools = GITLAB_DENIED_TOOLS_REGEX ? tools.filter(tool => !GITLAB_DENIED_TOOLS_REGEX.test(tool.name)) : tools; // <<< START: Gemini 호환성을 위해 $schema 제거 >>> tools = tools.map(tool => {