Skip to content

Commit 8950b4b

Browse files
authored
FEAT: add GITLAB_DENIED_TOOLS_REGEX env to disable some tools (#206)
1 parent 2d42638 commit 8950b4b

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ docker run -i --rm \
168168
- Single value `123`: MCP server can only access project 123 and uses it as default
169169
- Multiple values `123,456,789`: MCP server can access projects 123, 456, and 789 but requires explicit project ID in requests
170170
- `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.
171+
- `GITLAB_DENIED_TOOLS_REGEX`: When set as a regular expression, it excludes the matching tools.
171172
- `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.
172173
- `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.
173174
- `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.

index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ const GITLAB_PERSONAL_ACCESS_TOKEN = process.env.GITLAB_PERSONAL_ACCESS_TOKEN;
247247
const GITLAB_AUTH_COOKIE_PATH = process.env.GITLAB_AUTH_COOKIE_PATH;
248248
const IS_OLD = process.env.GITLAB_IS_OLD === "true";
249249
const GITLAB_READ_ONLY_MODE = process.env.GITLAB_READ_ONLY_MODE === "true";
250+
const GITLAB_DENIED_TOOLS_REGEX = process.env.GITLAB_DENIED_TOOLS_REGEX ? new RegExp(process.env.GITLAB_DENIED_TOOLS_REGEX):undefined;
250251
const USE_GITLAB_WIKI = process.env.USE_GITLAB_WIKI === "true";
251252
const USE_MILESTONE = process.env.USE_MILESTONE === "true";
252253
const USE_PIPELINE = process.env.USE_PIPELINE === "true";
@@ -4104,6 +4105,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
41044105
: tools1.filter(tool => !milestoneToolNames.includes(tool.name));
41054106
// Toggle pipeline tools by USE_PIPELINE flag
41064107
let tools = USE_PIPELINE ? tools2 : tools2.filter(tool => !pipelineToolNames.includes(tool.name));
4108+
tools = GITLAB_DENIED_TOOLS_REGEX ? tools.filter(tool => !GITLAB_DENIED_TOOLS_REGEX.test(tool.name)) : tools;
41074109

41084110
// <<< START: Gemini 호환성을 위해 $schema 제거 >>>
41094111
tools = tools.map(tool => {

0 commit comments

Comments
 (0)