@azure-devops/mcp 2.2.1-nightly.20251028 → 2.2.1-nightly.20251029
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.md +1 -0
- package/dist/auth.js +1 -1
- package/dist/index.js +3 -3
- package/dist/org-tenants.js +7 -7
- package/dist/tools/work.js +44 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,6 +55,7 @@ Interact with these Azure DevOps services:
|
|
|
55
55
|
- **work_list_team_iterations**: Retrieve a list of iterations for a specific team in a project.
|
|
56
56
|
- **work_create_iterations**: Create new iterations in a specified Azure DevOps project.
|
|
57
57
|
- **work_assign_iterations**: Assign existing iterations to a specific team in a project.
|
|
58
|
+
- **work_get_team_capacity**: Get the team capacity of a specific team and iteration in a project.
|
|
58
59
|
|
|
59
60
|
### 📅 Work Items
|
|
60
61
|
|
package/dist/auth.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Licensed under the MIT License.
|
|
4
4
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
5
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
|
-
import
|
|
6
|
+
import { getBearerHandler, WebApi } from "azure-devops-node-api";
|
|
7
7
|
import yargs from "yargs";
|
|
8
8
|
import { hideBin } from "yargs/helpers";
|
|
9
9
|
import { createAuthenticator } from "./auth.js";
|
|
@@ -57,8 +57,8 @@ export const enabledDomains = domainsManager.getEnabledDomains();
|
|
|
57
57
|
function getAzureDevOpsClient(getAzureDevOpsToken, userAgentComposer) {
|
|
58
58
|
return async () => {
|
|
59
59
|
const accessToken = await getAzureDevOpsToken();
|
|
60
|
-
const authHandler =
|
|
61
|
-
const connection = new
|
|
60
|
+
const authHandler = getBearerHandler(accessToken);
|
|
61
|
+
const connection = new WebApi(orgUrl, authHandler, undefined, {
|
|
62
62
|
productName: "AzureDevOps.MCP",
|
|
63
63
|
productVersion: packageVersion,
|
|
64
64
|
userAgent: userAgentComposer.userAgent,
|
package/dist/org-tenants.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const CACHE_FILE =
|
|
3
|
+
import { readFile, writeFile } from "fs/promises";
|
|
4
|
+
import { homedir } from "os";
|
|
5
|
+
import { join } from "path";
|
|
6
|
+
const CACHE_FILE = join(homedir(), ".ado_orgs.cache");
|
|
7
7
|
const CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000; // 1 week in milliseconds
|
|
8
8
|
async function loadCache() {
|
|
9
9
|
try {
|
|
10
|
-
const cacheData = await
|
|
10
|
+
const cacheData = await readFile(CACHE_FILE, "utf-8");
|
|
11
11
|
return JSON.parse(cacheData);
|
|
12
12
|
}
|
|
13
|
-
catch
|
|
13
|
+
catch {
|
|
14
14
|
// Cache file doesn't exist or is invalid, return empty cache
|
|
15
15
|
return {};
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
async function trySavingCache(cache) {
|
|
19
19
|
try {
|
|
20
|
-
await
|
|
20
|
+
await writeFile(CACHE_FILE, JSON.stringify(cache, null, 2), "utf-8");
|
|
21
21
|
}
|
|
22
22
|
catch (error) {
|
|
23
23
|
console.error("Failed to save org tenants cache:", error);
|
package/dist/tools/work.js
CHANGED
|
@@ -6,6 +6,7 @@ const WORK_TOOLS = {
|
|
|
6
6
|
list_team_iterations: "work_list_team_iterations",
|
|
7
7
|
create_iterations: "work_create_iterations",
|
|
8
8
|
assign_iterations: "work_assign_iterations",
|
|
9
|
+
get_team_capacity: "work_get_team_capacity",
|
|
9
10
|
};
|
|
10
11
|
function configureWorkTools(server, _, connectionProvider) {
|
|
11
12
|
server.tool(WORK_TOOLS.list_team_iterations, "Retrieve a list of iterations for a specific team in a project.", {
|
|
@@ -110,5 +111,48 @@ function configureWorkTools(server, _, connectionProvider) {
|
|
|
110
111
|
};
|
|
111
112
|
}
|
|
112
113
|
});
|
|
114
|
+
server.tool(WORK_TOOLS.get_team_capacity, "Get the team capacity of a specific team and iteration in a project.", {
|
|
115
|
+
project: z.string().describe("The name or Id of the Azure DevOps project."),
|
|
116
|
+
team: z.string().describe("The name or Id of the Azure DevOps team."),
|
|
117
|
+
iterationId: z.string().describe("The Iteration Id to get capacity for."),
|
|
118
|
+
}, async ({ project, team, iterationId }) => {
|
|
119
|
+
try {
|
|
120
|
+
const connection = await connectionProvider();
|
|
121
|
+
const workApi = await connection.getWorkApi();
|
|
122
|
+
const teamContext = { project, team };
|
|
123
|
+
const rawResults = await workApi.getCapacitiesWithIdentityRefAndTotals(teamContext, iterationId);
|
|
124
|
+
if (!rawResults || rawResults.teamMembers?.length === 0) {
|
|
125
|
+
return { content: [{ type: "text", text: "No team capacity assigned to the team" }], isError: true };
|
|
126
|
+
}
|
|
127
|
+
// Remove unwanted fields from teamMember and url
|
|
128
|
+
const simplifiedResults = {
|
|
129
|
+
...rawResults,
|
|
130
|
+
teamMembers: (rawResults.teamMembers || []).map((member) => {
|
|
131
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
132
|
+
const { url, ...rest } = member;
|
|
133
|
+
return {
|
|
134
|
+
...rest,
|
|
135
|
+
teamMember: member.teamMember
|
|
136
|
+
? {
|
|
137
|
+
displayName: member.teamMember.displayName,
|
|
138
|
+
id: member.teamMember.id,
|
|
139
|
+
uniqueName: member.teamMember.uniqueName,
|
|
140
|
+
}
|
|
141
|
+
: undefined,
|
|
142
|
+
};
|
|
143
|
+
}),
|
|
144
|
+
};
|
|
145
|
+
return {
|
|
146
|
+
content: [{ type: "text", text: JSON.stringify(simplifiedResults, null, 2) }],
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
151
|
+
return {
|
|
152
|
+
content: [{ type: "text", text: `Error getting team capacity: ${errorMessage}` }],
|
|
153
|
+
isError: true,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
});
|
|
113
157
|
}
|
|
114
158
|
export { WORK_TOOLS, configureWorkTools };
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageVersion = "2.2.1-nightly.
|
|
1
|
+
export const packageVersion = "2.2.1-nightly.20251029";
|