@azure-devops/mcp 2.11.0 → 2.11.1-nightly.20261124

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/dist/auth.js CHANGED
File without changes
package/dist/index.js CHANGED
File without changes
package/dist/logger.js CHANGED
File without changes
package/dist/oauth.js CHANGED
File without changes
File without changes
package/dist/prompts.js CHANGED
File without changes
@@ -15,7 +15,6 @@ export var Domain;
15
15
  Domain["WIKI"] = "wiki";
16
16
  Domain["WORK"] = "work";
17
17
  Domain["WORK_ITEMS"] = "work-items";
18
- Domain["MCP_APPS"] = "mcp-apps";
19
18
  })(Domain || (Domain = {}));
20
19
  export const ALL_DOMAINS = "all";
21
20
  /**
@@ -70,9 +69,7 @@ export class DomainsManager {
70
69
  this.enableAllDomains();
71
70
  }
72
71
  else {
73
- logger.error(`Error: Specified invalid domain '${domain}'. Please specify exactly as available domains: ${Object.values(Domain)
74
- .filter((d) => d !== Domain.MCP_APPS)
75
- .join(", ")}`);
72
+ logger.error(`Error: Specified invalid domain '${domain}'. Please specify exactly as available domains: ${Object.values(Domain).join(", ")}`);
76
73
  }
77
74
  });
78
75
  if (this.enabledDomains.size === 0) {
@@ -80,9 +77,7 @@ export class DomainsManager {
80
77
  }
81
78
  }
82
79
  enableAllDomains() {
83
- Object.values(Domain)
84
- .filter((domain) => domain !== Domain.MCP_APPS)
85
- .forEach((domain) => this.enabledDomains.add(domain));
80
+ Object.values(Domain).forEach((domain) => this.enabledDomains.add(domain));
86
81
  }
87
82
  /**
88
83
  * Check if a specific domain is enabled
@@ -22,7 +22,6 @@ const TOOL_ANNOTATIONS = {
22
22
  core_get_identity_ids: READ_ONLY_ANNOTATIONS,
23
23
  core_list_projects: READ_ONLY_ANNOTATIONS,
24
24
  core_list_project_teams: READ_ONLY_ANNOTATIONS,
25
- mcp_apps_ping: { ...READ_ONLY_ANNOTATIONS, openWorldHint: false },
26
25
  pipelines_artifact: MUTATING_ANNOTATIONS,
27
26
  pipelines_build: READ_ONLY_ANNOTATIONS,
28
27
  pipelines_build_log: READ_ONLY_ANNOTATIONS,
@@ -0,0 +1,5 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { z } from "zod";
4
+ // Preserve date coercion while exposing the existing string/date-time wire schema.
5
+ export const dateInputSchema = z.unknown().meta({ type: "string", format: "date-time" }).pipe(z.coerce.date());
@@ -9,6 +9,7 @@ import { StageUpdateType } from "azure-devops-node-api/interfaces/BuildInterface
9
9
  import { ConfigurationType, RepositoryType } from "azure-devops-node-api/interfaces/PipelinesInterfaces.js";
10
10
  import { mkdirSync, createWriteStream } from "fs";
11
11
  import { createExternalContentResponse } from "../shared/content-safety.js";
12
+ import { dateInputSchema } from "../shared/tool-schemas.js";
12
13
  import { join, posix, resolve, win32 } from "path";
13
14
  import { Readable, Transform } from "stream";
14
15
  import { pipeline } from "stream/promises";
@@ -16,6 +17,12 @@ import { pipelinesWriteShape } from "./pipelines.dto.js";
16
17
  const errorResult = (text) => ({ content: [{ type: "text", text }], isError: true });
17
18
  const MAX_ARTIFACT_FILE_BYTES = 1024 * 1024 * 1024;
18
19
  const MAX_ARTIFACT_BASE64_BYTES = 10 * 1024 * 1024;
20
+ const TRUSTED_ARTIFACT_HOSTS = ["dev.azure.com"];
21
+ const TRUSTED_ARTIFACT_HOST_SUFFIXES = [".dev.azure.com", ".visualstudio.com"];
22
+ function isTrustedArtifactUrl(url) {
23
+ const hostname = url.hostname.toLowerCase();
24
+ return url.protocol === "https:" && (TRUSTED_ARTIFACT_HOSTS.includes(hostname) || TRUSTED_ARTIFACT_HOST_SUFFIXES.some((suffix) => hostname.endsWith(suffix)));
25
+ }
19
26
  function getArtifactResponseStream(response) {
20
27
  if (!response.body)
21
28
  throw new Error("Artifact download returned an empty response body.");
@@ -143,8 +150,8 @@ function configurePipelineTools(server, tokenProvider, connectionProvider, userA
143
150
  definitions: z.array(z.coerce.number().min(1)).optional().describe("Array of build definition IDs to filter builds. Used for: list."),
144
151
  queues: z.array(z.coerce.number().min(1)).optional().describe("Array of queue IDs to filter builds. Used for: list."),
145
152
  buildNumber: z.string().optional().describe("Build number to filter builds. Used for: list."),
146
- minTime: z.coerce.date().optional().describe("Minimum finish time to filter builds. Used for: list."),
147
- maxTime: z.coerce.date().optional().describe("Maximum finish time to filter builds. Used for: list."),
153
+ minTime: dateInputSchema.optional().describe("Minimum finish time to filter builds. Used for: list."),
154
+ maxTime: dateInputSchema.optional().describe("Maximum finish time to filter builds. Used for: list."),
148
155
  requestedFor: z.string().optional().describe("User ID or name who requested the build. Used for: list."),
149
156
  reasonFilter: z.number().optional().describe("Reason filter (see BuildReason enum). Used for: list."),
150
157
  statusFilter: z.number().optional().describe("Status filter (see BuildStatus enum). Used for: list."),
@@ -242,10 +249,10 @@ function configurePipelineTools(server, tokenProvider, connectionProvider, userA
242
249
  queryOrder: z.enum(definitionQueryOrderKeys).optional().describe("Order in which definitions are returned. Used for: list."),
243
250
  top: z.number().optional().describe("Maximum number of definitions to return. Used for: list."),
244
251
  continuationToken: z.string().optional().describe("Token for continuing paged results. Used for: list."),
245
- minMetricsTime: z.coerce.date().optional().describe("Minimum metrics time to filter definitions. Used for: list."),
252
+ minMetricsTime: dateInputSchema.optional().describe("Minimum metrics time to filter definitions. Used for: list."),
246
253
  definitionIds: z.array(z.coerce.number().min(1)).optional().describe("Array of definition IDs to filter. Used for: list."),
247
- builtAfter: z.coerce.date().optional().describe("Return definitions that have builds after this date. Used for: list."),
248
- notBuiltAfter: z.coerce.date().optional().describe("Return definitions without builds after this date. Used for: list."),
254
+ builtAfter: dateInputSchema.optional().describe("Return definitions that have builds after this date. Used for: list."),
255
+ notBuiltAfter: dateInputSchema.optional().describe("Return definitions without builds after this date. Used for: list."),
249
256
  includeAllProperties: z.boolean().optional().describe("Whether to include all properties in results. Used for: list."),
250
257
  includeLatestBuilds: z.boolean().optional().describe("Whether to include the latest builds for each definition. Used for: list."),
251
258
  taskIdFilter: z.string().optional().describe("Task ID to filter build definitions. Used for: list."),
@@ -358,6 +365,10 @@ function configurePipelineTools(server, tokenProvider, connectionProvider, userA
358
365
  if (!artifact.resource?.downloadUrl) {
359
366
  throw new Error(`Artifact ${resolvedArtifactName} does not have a download URL.`);
360
367
  }
368
+ const downloadUrl = new URL(artifact.resource.downloadUrl);
369
+ if (!isTrustedArtifactUrl(downloadUrl)) {
370
+ throw new Error(`Untrusted artifact download URL '${downloadUrl.origin}'.`);
371
+ }
361
372
  const accessToken = await tokenProvider();
362
373
  const response = await fetch(artifact.resource.downloadUrl, {
363
374
  headers: { "Authorization": `Bearer ${accessToken}`, "User-Agent": userAgentProvider() },
@@ -205,7 +205,7 @@ function configureRepoTools(server, tokenProvider, connectionProvider, userAgent
205
205
  .boolean()
206
206
  .optional()
207
207
  .default(false)
208
- .describe("Whether to include the list of changed files. When changedFilesSummary returns a nextSkip greater than 0, pass nextSkip and nextTop back as skip and top for the next page. Used for get."),
208
+ .describe("Whether to include the list of changed files, compared against the common commit (iteration 0). When changedFilesSummary returns a nextSkip greater than 0, pass nextSkip and nextTop back as skip and top for the next page. Used for get."),
209
209
  top: z.coerce.number().default(100).describe("The maximum number of pull requests to return (list), or of changed files to return (get with includeChangedFiles). Defaults to 100."),
210
210
  skip: z.coerce.number().default(0).describe("The number of pull requests to skip (list), or of changed files to skip (get with includeChangedFiles). Defaults to 0."),
211
211
  created_by_me: z.boolean().default(false).describe("Filter pull requests created by the current user. Used for list."),
@@ -267,7 +267,7 @@ function configureRepoTools(server, tokenProvider, connectionProvider, userAgent
267
267
  changedFilesSummary: {
268
268
  changeEntries: changes?.changeEntries ?? [],
269
269
  fileCount: changes?.changeEntries?.length ?? 0,
270
- firstComparingIteration: Math.max(0, latestIteration.id - 1),
270
+ firstComparingIteration: 0,
271
271
  secondComparingIteration: latestIteration.id,
272
272
  nextSkip: changes?.nextSkip,
273
273
  nextTop: changes?.nextTop,
@@ -9,6 +9,7 @@ import { z } from "zod";
9
9
  import { batchApiVersion, markdownCommentsApiVersion, getEnumKeys, safeEnumConvert, encodeFormattedValue } from "../utils.js";
10
10
  import { elicitProject, elicitTeam } from "../shared/elicitations.js";
11
11
  import { createExternalContentResponse } from "../shared/content-safety.js";
12
+ import { dateInputSchema } from "../shared/tool-schemas.js";
12
13
  import { getUserIdentityFromEmail } from "./auth.js";
13
14
  const WORKITEM_TOOLS = {
14
15
  wit_work_item: "wit_work_item",
@@ -21,7 +22,7 @@ const WORKITEM_TOOLS = {
21
22
  wit_work_item_comment_write: "wit_work_item_comment_write",
22
23
  wit_work_item_link_write: "wit_work_item_link_write",
23
24
  };
24
- const jsonPatchValueSchema = z.lazy(() => z.union([z.string(), z.number().finite(), z.boolean(), z.null(), z.array(jsonPatchValueSchema), z.record(jsonPatchValueSchema)]));
25
+ const jsonPatchValueSchema = z.lazy(() => z.union([z.string(), z.number().finite(), z.boolean(), z.null(), z.array(jsonPatchValueSchema), z.record(z.string(), jsonPatchValueSchema)]));
25
26
  const readConsistencyHandler = {
26
27
  prepareRequest(options) {
27
28
  options.headers = { ...options.headers, "X-VSS-ReadConsistencyLevel": "Eventual" };
@@ -123,7 +124,7 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
123
124
  ids: z.array(z.coerce.number().min(1)).optional().describe("Work item IDs. Required for: get_batch."),
124
125
  workItemId: z.coerce.number().min(1).optional().describe("Work item ID. Required for: list_comments, list_revisions."),
125
126
  fields: z.array(z.string()).optional().describe("Field names to include in the response. Used for: get, get_batch. For get, cannot be combined with expand."),
126
- asOf: z.coerce.date().optional().describe("Retrieve the work item as of a specific date. Used for: get."),
127
+ asOf: dateInputSchema.optional().describe("Retrieve the work item as of a specific date. Used for: get."),
127
128
  expand: z
128
129
  .enum(getEnumKeys(WorkItemExpand))
129
130
  .optional()
@@ -623,7 +624,7 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
623
624
  .string()
624
625
  .transform((val) => val.toLowerCase())
625
626
  .pipe(z.enum(["add", "replace", "remove", "test"]))
626
- .default("add")
627
+ .prefault("add")
627
628
  .describe("The operation to perform. Use 'test' with path '/rev' to enforce optimistic concurrency."),
628
629
  path: z.string().describe("The path to operate on, e.g. '/fields/System.Title' or '/rev' for a revision test."),
629
630
  value: jsonPatchValueSchema
@@ -878,7 +879,10 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
878
879
  if (!response.ok) {
879
880
  throw new Error(`Failed to add a work item comment: ${response.statusText}`);
880
881
  }
881
- return { content: [{ type: "text", text: await response.text() }] };
882
+ const added = JSON.parse(await response.text());
883
+ return {
884
+ content: [{ type: "text", text: JSON.stringify({ workItemId: added.workItemId, commentId: added.id, version: added.version, createdDate: added.createdDate, url: added.url }, null, 2) }],
885
+ };
882
886
  }
883
887
  if (action === "update") {
884
888
  if (!commentId)
@@ -895,7 +899,12 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
895
899
  if (!response.ok) {
896
900
  throw new Error(`Failed to update work item comment: ${response.statusText}`);
897
901
  }
898
- return { content: [{ type: "text", text: await response.text() }] };
902
+ const updated = JSON.parse(await response.text());
903
+ return {
904
+ content: [
905
+ { type: "text", text: JSON.stringify({ workItemId: updated.workItemId, commentId: updated.id, version: updated.version, createdDate: updated.createdDate, url: updated.url }, null, 2) },
906
+ ],
907
+ };
899
908
  }
900
909
  return { content: [{ type: "text", text: `Unknown action: ${action}` }], isError: true };
901
910
  }
@@ -1022,7 +1031,13 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
1022
1031
  throw new Error(`Failed to update work items in batch: ${response.statusText}`);
1023
1032
  }
1024
1033
  const result = await response.json();
1025
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
1034
+ const linked = result.value.map(({ code, body: entryBody }, index) => {
1035
+ if (code < 200 || code >= 300)
1036
+ return { id: uniqueIds[index], error: entryBody };
1037
+ const workItem = JSON.parse(entryBody);
1038
+ return { id: workItem.id, rev: workItem.rev, url: workItem.url, added: body[index].body.map(({ value }) => ({ rel: value.rel, target: value.url })) };
1039
+ });
1040
+ return { content: [{ type: "text", text: JSON.stringify(linked, null, 2) }] };
1026
1041
  }
1027
1042
  if (action === "unlink") {
1028
1043
  if (!id)
@@ -1060,10 +1075,7 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
1060
1075
  content: [
1061
1076
  {
1062
1077
  type: "text",
1063
- text: `Removed ${removedRelations.length} link(s) of type '${type}':\n` +
1064
- JSON.stringify(removedRelations, null, 2) +
1065
- `\n\nUpdated work item result:\n` +
1066
- JSON.stringify(updatedWorkItem, null, 2),
1078
+ text: JSON.stringify({ id: updatedWorkItem.id, rev: updatedWorkItem.rev, url: updatedWorkItem.url, removed: removedRelations.map((relation) => ({ rel: relation.rel, target: relation.url })) }, null, 2),
1067
1079
  },
1068
1080
  ],
1069
1081
  isError: false,
@@ -1098,7 +1110,7 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
1098
1110
  return { content: [{ type: "text", text: "Work item update failed" }], isError: true };
1099
1111
  }
1100
1112
  return {
1101
- content: [{ type: "text", text: JSON.stringify({ workItemId, pullRequestId, success: true }, null, 2) }],
1113
+ content: [{ type: "text", text: JSON.stringify({ id: workItem.id, rev: workItem.rev, url: workItem.url, added: [{ rel: "ArtifactLink", target: vstfsUrl }] }, null, 2) }],
1102
1114
  };
1103
1115
  }
1104
1116
  if (action === "add_artifact_link") {
@@ -1201,7 +1213,7 @@ function configureWorkItemTools(server, tokenProvider, connectionProvider, userA
1201
1213
  content: [
1202
1214
  {
1203
1215
  type: "text",
1204
- text: JSON.stringify({ workItemId, artifactUri: finalArtifactUri, linkType: effectiveLinkType, comment: comment || null, success: true }, null, 2),
1216
+ text: JSON.stringify({ id: workItem.id, rev: workItem.rev, url: workItem.url, added: [{ rel: "ArtifactLink", target: finalArtifactUri }] }, null, 2),
1205
1217
  },
1206
1218
  ],
1207
1219
  };
@@ -298,7 +298,7 @@ function configureWorkTools(server, _, connectionProvider) {
298
298
  end: z.string().describe("End date of the day off in ISO format."),
299
299
  }))
300
300
  .optional()
301
- .describe("Array of days off for the team member, each with a start and end date in ISO format."),
301
+ .describe("Days off for the team member (ISO start/end dates). Replaces existing days off; omitted updates preserve them."),
302
302
  }, async ({ project, team, teamMemberId, iterationId, activities, daysOff }) => {
303
303
  try {
304
304
  const connection = await connectionProvider();
@@ -309,11 +309,13 @@ function configureWorkTools(server, _, connectionProvider) {
309
309
  name: a.name,
310
310
  capacityPerDay: a.capacityPerDay,
311
311
  })),
312
- daysOff: (daysOff || []).map((d) => ({
312
+ };
313
+ if (daysOff !== undefined) {
314
+ capacityPatch.daysOff = daysOff.map((d) => ({
313
315
  start: new Date(d.start),
314
316
  end: new Date(d.end),
315
- })),
316
- };
317
+ }));
318
+ }
317
319
  const updatedCapacity = await workApi.updateCapacityWithIdentityRef(capacityPatch, teamContext, iterationId, teamMemberId);
318
320
  if (!updatedCapacity) {
319
321
  return { content: [{ type: "text", text: "Failed to update team member capacity" }], isError: true };
package/dist/tools.js CHANGED
@@ -4,7 +4,6 @@ import { wrapExternalToolResponse } from "./shared/content-safety.js";
4
4
  import { Domain } from "./shared/domains.js";
5
5
  import { configureToolsWithAnnotations } from "./shared/tool-annotations.js";
6
6
  import { configureAdvSecTools } from "./tools/advanced-security.js";
7
- import { configureMcpAppsTools } from "./tools/mcp-apps.js";
8
7
  import { configurePipelineTools } from "./tools/pipelines.js";
9
8
  import { configureCoreTools } from "./tools/core.js";
10
9
  import { configureRepoTools } from "./tools/repositories.js";
@@ -21,9 +20,6 @@ function configureAllTools(server, tokenProvider, connectionProvider, userAgentP
21
20
  }
22
21
  };
23
22
  configureIfDomainEnabled(Domain.CORE, () => configureCoreTools(server, tokenProvider, connectionProvider, userAgentProvider));
24
- // This is a local health-check response and contains no Azure DevOps content.
25
- if (enabledDomains.has(Domain.MCP_APPS))
26
- configureMcpAppsTools(server);
27
23
  configureIfDomainEnabled(Domain.WORK, () => configureWorkTools(server, tokenProvider, connectionProvider));
28
24
  configureIfDomainEnabled(Domain.PIPELINES, () => configurePipelineTools(server, tokenProvider, connectionProvider, userAgentProvider));
29
25
  configureIfDomainEnabled(Domain.REPOSITORIES, () => configureRepoTools(server, tokenProvider, connectionProvider, userAgentProvider));
package/dist/useragent.js CHANGED
File without changes
package/dist/utils.js CHANGED
File without changes
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const packageVersion = "2.11.0";
1
+ export const packageVersion = "2.11.1-nightly.20261124";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-devops/mcp",
3
- "version": "2.11.0",
3
+ "version": "2.11.1-nightly.20261124",
4
4
  "mcpName": "microsoft.com/azure-devops",
5
5
  "description": "MCP server for interacting with Azure DevOps",
6
6
  "license": "MIT",
@@ -40,15 +40,14 @@
40
40
  "@azure/identity": "^4.13.0",
41
41
  "@azure/logger": "^1.3.0",
42
42
  "@azure/msal-node": "^5.5.0",
43
- "@modelcontextprotocol/sdk": "1.31.0",
43
+ "@modelcontextprotocol/sdk": "1.32.0",
44
44
  "azure-devops-extension-api": "^5.272.3",
45
45
  "azure-devops-extension-sdk": "^4.0.2",
46
46
  "azure-devops-node-api": "^15.1.2",
47
47
  "open": "^10.2.0",
48
48
  "winston": "^3.18.3",
49
49
  "yargs": "^18.0.0",
50
- "zod": "^3.25.63",
51
- "zod-to-json-schema": "^3.24.5"
50
+ "zod": "^4.6.6"
52
51
  },
53
52
  "optionalDependencies": {
54
53
  "@azure/msal-node-extensions": "^5.3.5"
@@ -58,7 +57,7 @@
58
57
  "@types/node": "^22.19.1",
59
58
  "eslint-config-prettier": "10.1.8",
60
59
  "eslint-plugin-header": "^3.1.1",
61
- "glob": "^13.0.0",
60
+ "glob": "^14.0.3",
62
61
  "husky": "^9.1.7",
63
62
  "jest": "^30.0.2",
64
63
  "jest-extended": "^7.0.0",
@@ -1,34 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- /** Builds an error `CallToolResult`. */
4
- export const errorResult = (text) => ({ content: [{ type: "text", text }], isError: true });
5
- /**
6
- * Routes a validated, action-carrying args object to the matching command.
7
- *
8
- * This is what removes long positional parameter lists from grouped ("action")
9
- * tools: instead of destructuring every possible field, the whole typed args
10
- * object is forwarded to the single command keyed by `args.action`, coupling
11
- * each action to exactly one command.
12
- *
13
- * - Unknown actions short-circuit with an "Unknown action" error and never
14
- * touch the context (so no connection is opened).
15
- * - Errors thrown by a command are caught and formatted using the optional
16
- * per-action `errorPrefixes` map (falling back to a generic message).
17
- * - Errors returned by a command (e.g. validation `errorResult`s) pass through
18
- * unchanged.
19
- */
20
- export async function dispatchAction(commands, context, args, errorPrefixes) {
21
- const command = commands[args.action];
22
- if (!command) {
23
- const supportedActions = Object.keys(commands).sort().join(", ");
24
- return errorResult(`Unknown action: ${args.action}. Supported actions: ${supportedActions}`);
25
- }
26
- try {
27
- return await command.execute(context, args);
28
- }
29
- catch (error) {
30
- const message = error instanceof Error ? error.message : "Unknown error occurred";
31
- const prefix = errorPrefixes?.[args.action];
32
- return errorResult(prefix ? `${prefix}${message}` : `Error: ${message}`);
33
- }
34
- }
@@ -1,22 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- const MCP_APPS_TOOLS = {
4
- ping: "mcp_apps_ping",
5
- };
6
- function configureMcpAppsTools(server) {
7
- server.tool(MCP_APPS_TOOLS.ping, "A simple ping tool to verify that the mcp-apps domain is enabled.", {}, async () => {
8
- try {
9
- return {
10
- content: [{ type: "text", text: "pong — mcp-apps domain is active" }],
11
- };
12
- }
13
- catch (error) {
14
- const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
15
- return {
16
- content: [{ type: "text", text: `Error: ${errorMessage}` }],
17
- isError: true,
18
- };
19
- }
20
- });
21
- }
22
- export { configureMcpAppsTools, MCP_APPS_TOOLS };