@zereight/mcp-gitlab 2.3.12 → 2.3.13-next.167

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.ko.md CHANGED
@@ -296,6 +296,7 @@ v2.3.1 이후의 GitHub 릴리스마다 `gitlab-mcp.mcpb` [MCP Bundle](https://g
296
296
  - `--compact-results=true` - 큰 MCP 도구 응답을 미리보기와 CLI 명령으로 바꿈 (`GITLAB_MCP_COMPACT_RESULTS` 대체, 기본 꺼짐)
297
297
  - `--compact-result-chars` - compact 임계값 문자 수 (`GITLAB_MCP_COMPACT_RESULT_CHARS` 대체, 기본 `4000`)
298
298
  - `--compact-tools` - 전역 compact를 켜지 않고, 응답이 클 때 compact할 도구 이름을 쉼표로 지정 (`GITLAB_MCP_COMPACT_TOOLS` 대체)
299
+ - `--list-summary-default=true` - `list_*` 도구에서 `summary` 인자를 생략하면 `true`로 처리. `summary: false`를 넘기면 전체 JSON을 반환 (`GITLAB_MCP_LIST_SUMMARY_DEFAULT` 대체, 기본 꺼짐)
299
300
  - `--tool-profile` - `full`(기본값) 또는 `slim`. `slim`은 draft note, 이모지 반응, 라벨, CI 카탈로그 도구와 `create_group`을 초기 목록에서 뺌. `GITLAB_TOOLSETS`에 공백이 아닌 값이 설정된 경우에만 무시됨 (`GITLAB_TOOL_PROFILE` 대체)
300
301
 
301
302
  이미 `GITLAB_TOOLSETS` 또는 `--toolsets`를 설정했다면 목록을 바꾸지 말고 `wiki`, `milestones`, `pipelines`를 기존 목록에 추가하세요. 이미 `GITLAB_TOOLS` 또는 `--tools`를 설정했다면 `validate_ci_lint`와 `validate_project_ci_lint`를 그 목록에 추가하세요. 명시적 목록은 기본 `core` toolset을 대체하며, 합쳐지지 않습니다.
package/README.md CHANGED
@@ -302,6 +302,7 @@ Some MCP clients (like GitHub Copilot CLI) have issues with environment variable
302
302
  - `--compact-results=true` - Truncate oversized MCP tool replies and attach a CLI command for the full payload (replaces `GITLAB_MCP_COMPACT_RESULTS`; default off)
303
303
  - `--compact-result-chars` - Character threshold for compacting (replaces `GITLAB_MCP_COMPACT_RESULT_CHARS`; default `4000`)
304
304
  - `--compact-tools` - Comma-separated tool names to compact when oversized, without turning global compact on (replaces `GITLAB_MCP_COMPACT_TOOLS`)
305
+ - `--list-summary-default=true` - `list_*` tools and `mr_discussions` treat an omitted `summary` argument as `true`; `summary: false` still returns the full JSON (replaces `GITLAB_MCP_LIST_SUMMARY_DEFAULT`; default off)
305
306
  - `--tool-profile` - `full` (default) or `slim`. `slim` drops draft notes, emoji reactions, labels, CI catalog tools, and `create_group` from the initial list. Ignored when `GITLAB_TOOLSETS` is set (replaces `GITLAB_TOOL_PROFILE`)
306
307
 
307
308
  If you already set `GITLAB_TOOLSETS` or `--toolsets`, append `wiki`, `milestones`, or `pipelines` to that list instead of replacing it. If you already set `GITLAB_TOOLS` or `--tools`, append `validate_ci_lint` and `validate_project_ci_lint` to that list instead of replacing it. An explicit list replaces the default `core` toolset; it does not merge.
package/README.pt-BR.md CHANGED
@@ -296,6 +296,7 @@ Alguns clientes MCP, como o GitHub Copilot CLI, têm problemas com variáveis de
296
296
  - `--compact-results=true` - trunca respostas muito grandes de ferramentas MCP e anexa um comando CLI para a carga completa (substitui `GITLAB_MCP_COMPACT_RESULTS`; desativado por padrão)
297
297
  - `--compact-result-chars` - limite de caracteres para compactação (substitui `GITLAB_MCP_COMPACT_RESULT_CHARS`; padrão `4000`)
298
298
  - `--compact-tools` - nomes de ferramentas separados por vírgula para compactar quando a resposta for grande, sem ativar o compact global (substitui `GITLAB_MCP_COMPACT_TOOLS`)
299
+ - `--list-summary-default=true` - ferramentas `list_*` tratam o argumento `summary` omitido como `true`; `summary: false` ainda retorna o JSON completo (substitui `GITLAB_MCP_LIST_SUMMARY_DEFAULT`; desativado por padrão)
299
300
  - `--tool-profile` - `full` (padrão) ou `slim`. `slim` remove draft notes, reações com emoji, labels, ferramentas do catálogo de CI e `create_group` da lista inicial. Ignorado apenas quando `GITLAB_TOOLSETS` tem um valor não em branco (substitui `GITLAB_TOOL_PROFILE`)
300
301
 
301
302
  Se você já definiu `GITLAB_TOOLSETS` ou `--toolsets`, acrescente `wiki`, `milestones` ou `pipelines` a essa lista em vez de substituí-la. Se você já definiu `GITLAB_TOOLS` ou `--tools`, acrescente `validate_ci_lint` e `validate_project_ci_lint` a essa lista em vez de substituí-la. Uma lista explícita substitui o toolset padrão `core`; ela não é mesclada.
package/README.zh-CN.md CHANGED
@@ -296,6 +296,7 @@ v2.3.1 之后的每个 GitHub Release 都附带 `gitlab-mcp.mcpb` [MCP Bundle](h
296
296
  - `--compact-results=true` - 将过大的 MCP 工具回复截断为预览并附带 CLI 命令(替代 `GITLAB_MCP_COMPACT_RESULTS`,默认关闭)
297
297
  - `--compact-result-chars` - compact 字符阈值(替代 `GITLAB_MCP_COMPACT_RESULT_CHARS`,默认 `4000`)
298
298
  - `--compact-tools` - 以逗号分隔的工具名,仅在回复过大时对这些工具进行 compact,而不开启全局 compact(替代 `GITLAB_MCP_COMPACT_TOOLS`)
299
+ - `--list-summary-default=true` - `list_*` 工具省略 `summary` 参数时按 `true` 处理;传 `summary: false` 仍返回完整 JSON(替代 `GITLAB_MCP_LIST_SUMMARY_DEFAULT`,默认关闭)
299
300
  - `--tool-profile` - `full`(默认)或 `slim`。`slim` 会从初始列表中移除 draft note、表情回应、标签、CI 目录工具以及 `create_group`。仅当 `GITLAB_TOOLSETS` 设置为非空白值时忽略(替代 `GITLAB_TOOL_PROFILE`)
300
301
 
301
302
  如果已经设置了 `GITLAB_TOOLSETS` 或 `--toolsets`,请把 `wiki`、`milestones` 或 `pipelines` 追加到该列表,不要整段替换。如果已经设置了 `GITLAB_TOOLS` 或 `--tools`,请把 `validate_ci_lint` 和 `validate_project_ci_lint` 追加到该列表,不要整段替换。显式列表会替换默认的 `core` toolset,不会合并。
package/build/cli/args.js CHANGED
@@ -80,6 +80,7 @@ const GLOBAL_FLAG_NAMES = new Set([
80
80
  "denied-tools-regex",
81
81
  "compact-results",
82
82
  "compact-result-chars",
83
+ "list-summary-default",
83
84
  ]);
84
85
  export function kebabToSnake(value) {
85
86
  return value.replace(/-/g, "_");
@@ -23,6 +23,7 @@ export const BOOLEAN_CLI_FLAG_NAMES = new Set([
23
23
  "enable-strict-project-scope",
24
24
  "oauth-stateless-mode",
25
25
  "compact-results",
26
+ "list-summary-default",
26
27
  ]);
27
28
  const BOOLEAN_FLAG_LITERALS = new Set(["true", "false", "1", "0"]);
28
29
  export function isBooleanFlagLiteral(value) {
package/build/config.js CHANGED
@@ -195,6 +195,8 @@ export const PORT = _intEnv("PORT", "port", _PORT_DEFAULT);
195
195
  export const GITLAB_MCP_COMPACT_RESULTS = getConfig("compact-results", "GITLAB_MCP_COMPACT_RESULTS") === "true";
196
196
  export const GITLAB_MCP_COMPACT_TOOL_NAMES = parseCompactToolAllowlist(getConfig("compact-tools", "GITLAB_MCP_COMPACT_TOOLS"));
197
197
  export const GITLAB_MCP_COMPACT_RESULT_CHARS = _intEnv("GITLAB_MCP_COMPACT_RESULT_CHARS", "compact-result-chars", 4000);
198
+ /** When true, list_* tools and mr_discussions treat an omitted `summary` argument as true. Explicit `summary: false` still wins. */
199
+ export const GITLAB_MCP_LIST_SUMMARY_DEFAULT = getConfig("list-summary-default", "GITLAB_MCP_LIST_SUMMARY_DEFAULT") === "true";
198
200
  // ---------------------------------------------------------------------------
199
201
  // Proxy configuration
200
202
  // ---------------------------------------------------------------------------
package/build/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { cliArgs, getConfig, ENABLE_DYNAMIC_API_URL, ENABLE_DYNAMIC_PROJECT_SCOPE, ENABLE_STRICT_PROJECT_SCOPE, GITLAB_AUTH_COOKIE_PATH, GITLAB_ALLOW_UNAUTHENTICATED_TOOL_DISCOVERY, GITLAB_CA_CERT_PATH, GITLAB_JOB_TOKEN, GITLAB_MCP_OAUTH, GITLAB_MCP_REQUEST_BODY_LIMIT, GITLAB_OAUTH_APP_ID, GITLAB_OAUTH_SCOPES, GITLAB_OAUTH_CALLBACK_PROXY, GITLAB_OAUTH_ALLOWED_REDIRECT_URIS_RAW, GITLAB_PERSONAL_ACCESS_TOKEN, GITLAB_POOL_MAX_SIZE, GITLAB_DISABLE_VERSION_CHECK, GITLAB_VERSION_CHECK_REGISTRY, GITLAB_MASKING_ENABLED, GITLAB_MASKING_CONFIG, GITLAB_MASKING_POLICY_FILE, GITLAB_MASKING_WORKSPACE_DIR, GITLAB_PERMISSION_MODE, GITLAB_TOOLSETS_RAW, GITLAB_TOOLS_RAW, HOST, HTTP_PROXY, HTTPS_PROXY, IS_OLD, MCP_SERVER_URL, NODE_TLS_REJECT_UNAUTHORIZED, NO_PROXY, OAUTH_DISABLE_REFRESH_TOKEN, OAUTH_STATELESS_CLIENT_TTL_SECONDS, OAUTH_STATELESS_MODE, OAUTH_STATELESS_PENDING_TTL_SECONDS, OAUTH_STATELESS_SESSION_TTL_SECONDS, OAUTH_STATELESS_STORED_TTL_SECONDS, PORT, REMOTE_AUTHORIZATION, SESSION_TIMEOUT_SECONDS, SSE, STREAMABLE_HTTP, MCP_TRUST_PROXY, USE_GITLAB_WIKI, USE_MILESTONE, USE_OAUTH, USE_PIPELINE, GITLAB_TOOL_POLICY_APPROVE_RAW, GITLAB_TOOL_POLICY_HIDDEN_RAW, GITLAB_OAUTH_ALLOWED_GROUPS, GITLAB_MCP_COMPACT_RESULTS, GITLAB_MCP_COMPACT_RESULT_CHARS, GITLAB_MCP_COMPACT_TOOL_NAMES, GITLAB_TOOL_PROFILE, GITLAB_DOWNLOAD_DIR, buildDeprecatedEnvInput, } from "./config.js";
2
+ import { cliArgs, getConfig, ENABLE_DYNAMIC_API_URL, ENABLE_DYNAMIC_PROJECT_SCOPE, ENABLE_STRICT_PROJECT_SCOPE, GITLAB_AUTH_COOKIE_PATH, GITLAB_ALLOW_UNAUTHENTICATED_TOOL_DISCOVERY, GITLAB_CA_CERT_PATH, GITLAB_JOB_TOKEN, GITLAB_MCP_OAUTH, GITLAB_MCP_REQUEST_BODY_LIMIT, GITLAB_OAUTH_APP_ID, GITLAB_OAUTH_SCOPES, GITLAB_OAUTH_CALLBACK_PROXY, GITLAB_OAUTH_ALLOWED_REDIRECT_URIS_RAW, GITLAB_PERSONAL_ACCESS_TOKEN, GITLAB_POOL_MAX_SIZE, GITLAB_DISABLE_VERSION_CHECK, GITLAB_VERSION_CHECK_REGISTRY, GITLAB_MASKING_ENABLED, GITLAB_MASKING_CONFIG, GITLAB_MASKING_POLICY_FILE, GITLAB_MASKING_WORKSPACE_DIR, GITLAB_PERMISSION_MODE, GITLAB_TOOLSETS_RAW, GITLAB_TOOLS_RAW, HOST, HTTP_PROXY, HTTPS_PROXY, IS_OLD, MCP_SERVER_URL, NODE_TLS_REJECT_UNAUTHORIZED, NO_PROXY, OAUTH_DISABLE_REFRESH_TOKEN, OAUTH_STATELESS_CLIENT_TTL_SECONDS, OAUTH_STATELESS_MODE, OAUTH_STATELESS_PENDING_TTL_SECONDS, OAUTH_STATELESS_SESSION_TTL_SECONDS, OAUTH_STATELESS_STORED_TTL_SECONDS, PORT, REMOTE_AUTHORIZATION, SESSION_TIMEOUT_SECONDS, SSE, STREAMABLE_HTTP, MCP_TRUST_PROXY, USE_GITLAB_WIKI, USE_MILESTONE, USE_OAUTH, USE_PIPELINE, GITLAB_TOOL_POLICY_APPROVE_RAW, GITLAB_TOOL_POLICY_HIDDEN_RAW, GITLAB_OAUTH_ALLOWED_GROUPS, GITLAB_MCP_COMPACT_RESULTS, GITLAB_MCP_COMPACT_RESULT_CHARS, GITLAB_MCP_COMPACT_TOOL_NAMES, GITLAB_MCP_LIST_SUMMARY_DEFAULT, GITLAB_TOOL_PROFILE, GITLAB_DOWNLOAD_DIR, buildDeprecatedEnvInput, } from "./config.js";
3
3
  import { getDeprecatedEnvWarnings } from "./deprecated-env.js";
4
4
  /** True when the server is running in remote/network mode (SSE or StreamableHTTP transport). */
5
5
  const IS_REMOTE = SSE || STREAMABLE_HTTP;
@@ -125,7 +125,7 @@ import { buildBulkPublishDraftNotesBody, needsGitLab19_2BulkPublish, } from "./u
125
125
  import { appendFilterParam, appendFilterParams, cleanMutuallyExclusiveIdUsernameOptions, dropBlankArrayEntries, isBlankFilterValue, LIST_MERGE_REQUESTS_ID_USERNAME_PAIRS, sanitizeToolArguments, } from "./utils/tool-args.js";
126
126
  import { applyJmespathToToolResult, getJmespathSyntaxError, JMESPATH_TOOL_ARGUMENT, JMESPATH_TOOL_ARGUMENT_DESCRIPTION, omitJmespathArgument, readJmespathExpression, } from "./utils/jmespath-tool-result.js";
127
127
  import { appendRecoveryHint } from "./utils/error-hints.js";
128
- import { applyListSummaryToToolResult, omitListSummaryArgument, readListSummaryRequested, toolAcceptsDecoratedSummary, } from "./utils/list-summary.js";
128
+ import { applyListSummaryToToolResult, omitListSummaryArgument, readListSummaryRequested, toolAcceptsDecoratedSummary, toolUsesListSummaryDefault, } from "./utils/list-summary.js";
129
129
  import { parseSearchReplaceBlocks, applySearchReplace, applyUnifiedDiff, } from "./utils/patch-helper.js";
130
130
  import { zodSchemaFor } from "./utils/schema.js";
131
131
  import { GitLabClientPool } from "./gitlab-client-pool.js";
@@ -206,6 +206,7 @@ function createServer() {
206
206
  approveToolNames: approveToolSet,
207
207
  jmespathArgument: JMESPATH_TOOL_ARGUMENT,
208
208
  jmespathArgumentDescription: JMESPATH_TOOL_ARGUMENT_DESCRIPTION,
209
+ listSummaryDefault: GITLAB_MCP_LIST_SUMMARY_DEFAULT,
209
210
  };
210
211
  const listedToolsCache = { revision: 0 };
211
212
  const decorateListedTools = (tools) => decorateToolsForList(tools, listedToolDecoration);
@@ -245,7 +246,7 @@ function createServer() {
245
246
  const requestArguments = readOwnRecord(request.params.arguments);
246
247
  const jmespathExpression = readJmespathExpression(requestArguments === undefined ? undefined : { ...requestArguments });
247
248
  const listSummaryRequested = toolAcceptsDecoratedSummary(toolName) &&
248
- readListSummaryRequested(requestArguments === undefined ? undefined : { ...requestArguments });
249
+ readListSummaryRequested(requestArguments === undefined ? undefined : { ...requestArguments }, GITLAB_MCP_LIST_SUMMARY_DEFAULT && toolUsesListSummaryDefault(toolName, requestArguments));
249
250
  const logCompletion = (result, completionOptions) => {
250
251
  const durationMs = Date.now() - start;
251
252
  logger.info({ tool: toolName, event: "tool_call_done", durationMs }, `tool_call_done: ${toolName} (${durationMs}ms)`);
@@ -73,6 +73,25 @@ const GROUP_MEMBERSHIP_CACHE_MAX_SIZE = 1000;
73
73
  const GROUP_MEMBERSHIP_CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes
74
74
  const GROUP_ACCESS_DENIED_MESSAGE = "Access denied: user is not a member of an allowed group";
75
75
  const REFRESH_TOKEN_DISABLED_MESSAGE = "Refresh tokens are disabled on this server (OAUTH_DISABLE_REFRESH_TOKEN); start a new authorization";
76
+ /**
77
+ * Maps a non-OK GitLab /oauth/token response. A rotated, revoked or expired
78
+ * refresh token or authorization code is a 400 invalid_grant, which clients
79
+ * must see as invalid_grant to restart authorization; anything else stays a
80
+ * ServerError.
81
+ */
82
+ function tokenEndpointError(operation, status, body) {
83
+ let gitlabError;
84
+ try {
85
+ gitlabError = JSON.parse(body)?.error;
86
+ }
87
+ catch {
88
+ gitlabError = undefined;
89
+ }
90
+ if (status === 400 && gitlabError === "invalid_grant") {
91
+ return new InvalidGrantError(`${operation} rejected by GitLab; start a new authorization`);
92
+ }
93
+ return new ServerError(`${operation} failed: ${status}`);
94
+ }
76
95
  function singleQueryParam(value) {
77
96
  return typeof value === "string" ? value : undefined;
78
97
  }
@@ -515,7 +534,7 @@ class GitLabOAuthServerProvider {
515
534
  if (!response.ok) {
516
535
  const body = await response.text();
517
536
  logger.error(`Token exchange failed (${response.status}): ${body}`);
518
- throw new ServerError(`Token exchange failed: ${response.status}`);
537
+ throw tokenEndpointError("Token exchange", response.status, body);
519
538
  }
520
539
  const data = await response.json();
521
540
  tokens = OAuthTokensSchema.parse(data);
@@ -629,7 +648,7 @@ class GitLabOAuthServerProvider {
629
648
  if (!response.ok) {
630
649
  const body = await response.text();
631
650
  logger.error(`Token refresh failed (${response.status}): ${body}`);
632
- throw new ServerError(`Token refresh failed: ${response.status}`);
651
+ throw tokenEndpointError("Token refresh", response.status, body);
633
652
  }
634
653
  const data = await response.json();
635
654
  const tokens = OAuthTokensSchema.parse(data);
@@ -1,4 +1,4 @@
1
- import { LIST_SUMMARY_ARGUMENT, LIST_SUMMARY_ARGUMENT_DESCRIPTION, toolAcceptsDecoratedSummary, } from "../utils/list-summary.js";
1
+ import { LIST_SUMMARY_ARGUMENT, LIST_SUMMARY_ARGUMENT_DEFAULT_TRUE_DESCRIPTION, LIST_SUMMARY_ARGUMENT_DESCRIPTION, toolAcceptsDecoratedSummary, toolUsesListSummaryDefault, } from "../utils/list-summary.js";
2
2
  const CONFIRMED_ARGUMENT = "_confirmed";
3
3
  const CONFIRMED_ARGUMENT_DESCRIPTION = "Set to true to confirm execution of this approval-required tool.";
4
4
  function isRecord(value) {
@@ -37,7 +37,7 @@ function withJmespathArgument(schema, context) {
37
37
  };
38
38
  return { ...schema, properties };
39
39
  }
40
- function withSummaryArgument(schema, toolName) {
40
+ function withSummaryArgument(schema, toolName, context) {
41
41
  if (!toolAcceptsDecoratedSummary(toolName) || !isRecord(schema.properties)) {
42
42
  return schema;
43
43
  }
@@ -50,7 +50,9 @@ function withSummaryArgument(schema, toolName) {
50
50
  ...schema.properties,
51
51
  [LIST_SUMMARY_ARGUMENT]: {
52
52
  type: "boolean",
53
- description: LIST_SUMMARY_ARGUMENT_DESCRIPTION,
53
+ description: context.listSummaryDefault === true && toolUsesListSummaryDefault(toolName)
54
+ ? LIST_SUMMARY_ARGUMENT_DEFAULT_TRUE_DESCRIPTION
55
+ : LIST_SUMMARY_ARGUMENT_DESCRIPTION,
54
56
  },
55
57
  },
56
58
  };
@@ -59,7 +61,7 @@ function decorateInputSchema(schema, toolName, context) {
59
61
  if (!isRecord(schema)) {
60
62
  return undefined;
61
63
  }
62
- return withSummaryArgument(withJmespathArgument(withConfirmedArgument(cloneSchema(schema), toolName, context), context), toolName);
64
+ return withSummaryArgument(withJmespathArgument(withConfirmedArgument(cloneSchema(schema), toolName, context), context), toolName, context);
63
65
  }
64
66
  export function decorateToolForList(tool, context) {
65
67
  const inputSchema = decorateInputSchema(tool.inputSchema, tool.name, context);
@@ -1,6 +1,8 @@
1
1
  /** MCP-only argument; stripped before GitLab handlers run. */
2
2
  export const LIST_SUMMARY_ARGUMENT = "summary";
3
3
  export const LIST_SUMMARY_ARGUMENT_DESCRIPTION = "If true, return only high-signal fields (id, iid, title, state, web_url, …). Default false keeps the full GitLab JSON.";
4
+ /** Description used when GITLAB_MCP_LIST_SUMMARY_DEFAULT is on. */
5
+ export const LIST_SUMMARY_ARGUMENT_DEFAULT_TRUE_DESCRIPTION = "If true, return only high-signal fields (id, iid, title, state, labels, author.username, updated_at, web_url, …). This server defaults to true; pass false for the full GitLab JSON.";
4
6
  const SUMMARY_FIELDS = [
5
7
  "id",
6
8
  "iid",
@@ -18,19 +20,89 @@ const SUMMARY_FIELDS = [
18
20
  "slug",
19
21
  "filename",
20
22
  "new_path",
23
+ "labels",
24
+ "source_branch",
25
+ "target_branch",
26
+ "draft",
27
+ "updated_at",
21
28
  ];
29
+ /** Fields kept per note when a summarized item carries discussion `notes`. */
30
+ const NOTE_SUMMARY_FIELDS = ["id", "body", "created_at", "resolved"];
22
31
  const NATIVE_SUMMARY_TOOLS = new Set(["list_webhook_events"]);
32
+ /**
33
+ * List tools that keep the full reply when GITLAB_MCP_LIST_SUMMARY_DEFAULT is on.
34
+ * An explicit `summary: true` still applies to them.
35
+ */
36
+ const LIST_SUMMARY_DEFAULT_EXCLUDED_TOOLS = new Set([
37
+ // The summary drops the content the tool exists to return.
38
+ "list_merge_request_diffs", // diff
39
+ "list_draft_notes", // body, position
40
+ "list_merge_request_versions", // base/head/start commit SHAs
41
+ "list_events", // action_name, target_*
42
+ "list_todos", // action_name, target, body
43
+ "list_webhooks", // url, event flags
44
+ "list_pipeline_triggers", // description
45
+ "list_job_artifacts", // path, type, size
46
+ // The reply is an envelope summarizeListPayload does not read.
47
+ "list_project_vulnerabilities", // { vulnerabilities, pageInfo }
48
+ "list_dependency_proxy_blobs", // { blobs, pageInfo }
49
+ "list_ci_catalog_resources", // raw GraphQL { data }
50
+ "list_work_item_notes", // { discussions, pageInfo }
51
+ "list_custom_field_definitions", // { work_item_type, custom_fields }
52
+ "list_work_item_statuses", // single object
53
+ // The summary drops an id or type that callers pass to other tools.
54
+ "list_issue_links", // issue_link_id, link_type
55
+ "list_pipeline_trigger_jobs", // downstream_pipeline.id
56
+ "list_project_variables", // environment_scope, variable_type
57
+ "list_group_variables", // environment_scope, variable_type
58
+ "list_merge_request_changed_files", // old_path, new_file/deleted_file/renamed_file
59
+ "list_work_items", // type, webUrl; assignees are strings, not users
60
+ ]);
61
+ /**
62
+ * List tools that keep the full reply under GITLAB_MCP_LIST_SUMMARY_DEFAULT only
63
+ * when the call asks for page content (`with_content` or `render_html`), which
64
+ * the summary would drop.
65
+ */
66
+ const CONTENT_ON_REQUEST_LIST_TOOLS = new Set(["list_wiki_pages", "list_group_wiki_pages"]);
67
+ const CONTENT_REQUEST_ARGUMENTS = ["with_content", "render_html"];
68
+ /** Mirrors the boolean coercion of the tool schemas: true, 1, "true", "1". */
69
+ function isTruthyFlag(value) {
70
+ if (value === true || value === 1) {
71
+ return true;
72
+ }
73
+ if (typeof value === "string") {
74
+ const normalized = value.trim().toLowerCase();
75
+ return normalized === "true" || normalized === "1";
76
+ }
77
+ return false;
78
+ }
79
+ function requestsListContent(toolName, args) {
80
+ if (!CONTENT_ON_REQUEST_LIST_TOOLS.has(toolName) || args === undefined) {
81
+ return false;
82
+ }
83
+ return CONTENT_REQUEST_ARGUMENTS.some(argument => isTruthyFlag(args[argument]));
84
+ }
23
85
  export function toolAcceptsDecoratedSummary(toolName) {
24
86
  if (NATIVE_SUMMARY_TOOLS.has(toolName)) {
25
87
  return false;
26
88
  }
27
89
  return toolName.startsWith("list_") || toolName === "mr_discussions";
28
90
  }
29
- export function readListSummaryRequested(args) {
30
- if (!args) {
31
- return false;
91
+ /**
92
+ * Tools whose omitted `summary` follows GITLAB_MCP_LIST_SUMMARY_DEFAULT
93
+ * (list_* and mr_discussions, minus LIST_SUMMARY_DEFAULT_EXCLUDED_TOOLS).
94
+ * With `args`, a wiki list call that asks for page content keeps the full reply.
95
+ */
96
+ export function toolUsesListSummaryDefault(toolName, args) {
97
+ return (toolAcceptsDecoratedSummary(toolName) &&
98
+ !LIST_SUMMARY_DEFAULT_EXCLUDED_TOOLS.has(toolName) &&
99
+ !requestsListContent(toolName, args));
100
+ }
101
+ export function readListSummaryRequested(args, defaultRequested = false) {
102
+ const raw = args?.[LIST_SUMMARY_ARGUMENT];
103
+ if (raw === undefined || raw === null) {
104
+ return defaultRequested;
32
105
  }
33
- const raw = args[LIST_SUMMARY_ARGUMENT];
34
106
  return raw === true || raw === "true";
35
107
  }
36
108
  export function omitListSummaryArgument(args) {
@@ -43,6 +115,29 @@ export function omitListSummaryArgument(args) {
43
115
  function isRecord(value) {
44
116
  return typeof value === "object" && value !== null && !Array.isArray(value);
45
117
  }
118
+ /** Reduce a GitLab user object to `{ username }`; anything else is dropped. */
119
+ function summarizeUser(user) {
120
+ if (!isRecord(user) || typeof user.username !== "string") {
121
+ return undefined;
122
+ }
123
+ return { username: user.username };
124
+ }
125
+ function summarizeNote(note) {
126
+ if (!isRecord(note)) {
127
+ return note;
128
+ }
129
+ const summarized = {};
130
+ const author = summarizeUser(note.author);
131
+ if (author) {
132
+ summarized.author = author;
133
+ }
134
+ for (const field of NOTE_SUMMARY_FIELDS) {
135
+ if (field in note) {
136
+ summarized[field] = note[field];
137
+ }
138
+ }
139
+ return summarized;
140
+ }
46
141
  function summarizeItem(item) {
47
142
  if (!isRecord(item)) {
48
143
  return item;
@@ -53,6 +148,16 @@ function summarizeItem(item) {
53
148
  summarized[field] = item[field];
54
149
  }
55
150
  }
151
+ const author = summarizeUser(item.author);
152
+ if (author) {
153
+ summarized.author = author;
154
+ }
155
+ if (Array.isArray(item.assignees)) {
156
+ summarized.assignees = item.assignees.map(summarizeUser).filter(user => user !== undefined);
157
+ }
158
+ if (Array.isArray(item.notes)) {
159
+ summarized.notes = item.notes.map(summarizeNote);
160
+ }
56
161
  return Object.keys(summarized).length > 0 ? summarized : item;
57
162
  }
58
163
  export function summarizeListPayload(data) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zereight/mcp-gitlab",
3
- "version": "2.3.12",
3
+ "version": "2.3.13-next.167",
4
4
  "mcpName": "io.github.zereight/gitlab-mcp",
5
5
  "description": "GitLab MCP server for projects, merge requests, issues, pipelines, wiki, releases, and more",
6
6
  "keywords": [