I want to build an MCP server using Node.js that can access my Azure DevOps boards and pipelines. The goal is to integrate it with GitHub Copilot chat (Agent Mode) so that when I prompt something like “Get details of a work item,” Copilot will automatically fetch and respond with the relevant work item details.
Building an MCP (Model Context Protocol) server for Azure DevOps integration with GitHub Copilot Agent Mode enables seamless interaction with your Azure DevOps boards and pipelines directly through natural language prompts. This integration allows Copilot to automatically fetch work item details, create new work items, manage build pipelines, and more, all through conversational commands.
To build your MCP server, you'll need to install the following packages[1][2]:
npm install @modelcontextprotocol/sdk azure-devops-node-api zodThe key dependencies are:
- @modelcontextprotocol/sdk: The official MCP SDK for Node.js[1]
- azure-devops-node-api: Microsoft's official Node.js client for Azure DevOps[2][3]
- zod: For input validation and schema definition[1]
You'll need to create a Personal Access Token (PAT) for authentication[4][5]:
- Navigate to your Azure DevOps organization
- Go to User Settings → Personal access tokens[4]
- Click New Token
- Set appropriate scopes:
- Work Items: Read & Write (for accessing and modifying work items)[6]
- Build: Read & Execute (for pipeline operations)[5]
- Project and Team: Read[6]
Create the following project structure for your MCP server:
azure-devops-mcp-server/
├── package.json
├── index.js
├── mcp.json
└── setup-env.sh
Your package.json should include the MCP SDK and Azure DevOps client[1][2]:
{
"name": "azure-devops-mcp-server",
"version": "1.0.0",
"type": "module",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.11.0",
"azure-devops-node-api": "^15.1.0",
"zod": "^3.24.4"
}
}The MCP server uses the official SDK to create a standardized interface[1][7]:
import { McpServer } from '@modelcontextprotocol/sdk/mcp/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/mcp/server/stdio.js';
import * as azdev from 'azure-devops-node-api';
// Initialize Azure DevOps connection
const authHandler = azdev.getPersonalAccessTokenHandler(process.env.AZURE_DEVOPS_PAT);
const connection = new azdev.WebApi(process.env.AZURE_DEVOPS_ORG_URL, authHandler);
// Initialize MCP server
const server = new McpServer({
name: 'azure-devops-mcp-server',
version: '1.0.0',
description: 'MCP Server for Azure DevOps Boards and Pipelines',
});Get Work Item Details[8][9]:
server.registerTool({
name: 'get_work_item',
description: 'Retrieve details of a specific work item by ID',
inputSchema: z.object({ id: z.number().int().positive() }),
handler: async (args) => {
const witApi = await connection.getWorkItemTrackingApi();
const workItem = await witApi.getWorkItem(args.id, PROJECT);
return {
success: true,
data: {
id: workItem.id,
title: workItem.fields?.['System.Title'],
state: workItem.fields?.['System.State'],
assignedTo: workItem.fields?.['System.AssignedTo']?.displayName,
url: workItem._links?.html?.href
}
};
}
});Create Work Items[10][11]:
server.registerTool({
name: 'create_work_item',
description: 'Create a new work item in Azure DevOps',
inputSchema: z.object({
title: z.string().min(1),
workItemType: z.string().default('Task'),
description: z.string().optional()
}),
handler: async (args) => {
const witApi = await connection.getWorkItemTrackingApi();
const patchDocument = [
{
op: 'add',
path: '/fields/System.Title',
value: args.title
}
];
const workItem = await witApi.createWorkItem(
null,
patchDocument,
PROJECT,
args.workItemType
);
return { success: true, data: workItem };
}
});List Build Definitions[12]:
server.registerTool({
name: 'get_build_definitions',
description: 'List all build definitions (pipelines) in the project',
handler: async () => {
const buildApi = await connection.getBuildApi();
const definitions = await buildApi.getDefinitions(PROJECT);
return {
success: true,
data: definitions.map(def => ({
id: def.id,
name: def.name,
queueStatus: def.queueStatus,
url: def._links?.web?.href
}))
};
}
});Queue Build[13]:
server.registerTool({
name: 'queue_build',
description: 'Queue a new build for a specific build definition',
inputSchema: z.object({ definitionId: z.number().int().positive() }),
handler: async (args) => {
const buildApi = await connection.getBuildApi();
const build = { definition: { id: args.definitionId } };
const queuedBuild = await buildApi.queueBuild(build, PROJECT);
return {
success: true,
data: {
id: queuedBuild.id,
buildNumber: queuedBuild.buildNumber,
status: queuedBuild.status
}
};
}
});Create a .vscode/mcp.json file in your workspace or configure globally[14][15]:
{
"mcpServers": {
"azure-devops": {
"command": "node",
"args": ["./index.js"],
"env": {
"AZURE_DEVOPS_ORG_URL": "https://dev.azure.com/yourorg",
"AZURE_DEVOPS_PAT": "your-personal-access-token",
"AZURE_DEVOPS_PROJECT": "your-project-name"
}
}
}
}Once configured, you can use GitHub Copilot in Agent Mode with natural language prompts[16][17]:
- "Get details of work item 1234" - Retrieves specific work item information
- "Create a new task called 'Implement user authentication'" - Creates a new work item
- "Show me all build definitions" - Lists available pipelines
- "Queue a build for definition ID 15" - Triggers a pipeline execution
- "Get the recent builds" - Shows latest build history
- Environment Variables: Store sensitive information like PATs in environment variables, never in code[5][18]
- Scope Limitation: Grant minimal required permissions to your PAT[6]
- Token Rotation: Regularly rotate your Personal Access Tokens[5]
- Error Handling: Implement comprehensive error handling for API calls[19]
For handling multiple work items efficiently, use the batch API[9]:
server.registerTool({
name: 'get_work_items_batch',
description: 'Get multiple work items by IDs',
inputSchema: z.object({ ids: z.array(z.number()) }),
handler: async (args) => {
const witApi = await connection.getWorkItemTrackingApi();
const workItems = await witApi.getWorkItemsBatch({
ids: args.ids,
fields: ['System.Title', 'System.State', 'System.AssignedTo']
});
return { success: true, data: workItems };
}
});Access Azure DevOps boards for Kanban-style workflows[20]:
server.registerTool({
name: 'get_boards',
description: 'List all boards in the project',
handler: async () => {
const workApi = await connection.getWorkApi();
const boards = await workApi.getBoards(PROJECT, TEAM);
return { success: true, data: boards };
}
});- Set up environment variables:
export AZURE_DEVOPS_ORG_URL="https://dev.azure.com/yourorg"
export AZURE_DEVOPS_PAT="your-pat-token"
export AZURE_DEVOPS_PROJECT="your-project"- Start the MCP server:
node index.js- Test in VS Code with Copilot Agent Mode enabled[21][22]
- Error Handling: Implement robust error handling for network issues and API limitations
- Rate Limiting: Respect Azure DevOps API rate limits[23]
- Logging: Add comprehensive logging for debugging and monitoring
- Configuration Management: Use configuration files for different environments
The MCP server architecture provides a powerful way to extend GitHub Copilot's capabilities with Azure DevOps integration[24][25]. This setup enables developers to manage their development workflow entirely through natural language interactions, significantly improving productivity and reducing context switching between tools.
Citations: [1] How to Build an MCP Server in Node.js to Provide Up-To-Date API ... https://snyk.io/articles/how-to-build-an-mcp-server-in-node-js-to-provide-up-to-date-api/ [2] azure-devops-node-api - NPM https://www.npmjs.com/package/azure-devops-node-api [3] microsoft/azure-devops-node-api: Azure DevOps Client for Node.js https://github.com/microsoft/azure-devops-node-api [4] Generate Personal Access Token in Azure DevOps https://docs.searchunify.com/Content/Content-Sources/Azure-Generate-Personal-Access-Token.htm [5] Use personal access tokens - Azure DevOps | Microsoft Learn https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops [6] How to Generate Personal Access Token for Azure DevOps https://docs.exalate.com/docs/how-to-generate-personal-access-token-for-azure-devops [7] Build a Local MCP Server with Node.js, TypeScript, and Zod https://www.rajeshdhiman.in/blog/local-mcp-server-guide [8] Get Work Item - REST API (Azure DevOps Work Item Tracking) https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/get-work-item?view=azure-devops-rest-7.1 [9] Get Work Items Batch - Azure DevOps - Learn Microsoft https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/get-work-items-batch?view=azure-devops-rest-7.1 [10] Create - REST API (Azure DevOps Work Item Tracking) https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/create?view=azure-devops-rest-7.1 [11] How to Create Azure DevOps Work Items in code - Merkle https://www.merkle.com/en/merkle-now/articles-blogs/2022/Feb/how-to-create-azure-devops-work-items-in-code.html [12] List Pipelines with the Azure DevOps API | johnnyreilly https://johnnyreilly.com/list-pipelines-with-azure-devops-api [13] How to Run Azure DevOps Pipeline using API or UI Tool - YouTube https://www.youtube.com/watch?v=63aU96D1d7o [14] MCP developer guide | Visual Studio Code Extension API https://code.visualstudio.com/api/extension-guides/ai/mcp [15] The Complete MCP Experience: Full Specification Support in VS Code https://code.visualstudio.com/blogs/2025/06/12/full-mcp-spec-support [16] Use Copilot agent mode - Visual Studio - Learn Microsoft https://learn.microsoft.com/en-us/visualstudio/ide/copilot-agent-mode?view=vs-2022 [17] Agent mode 101: All about GitHub Copilot's powerful mode https://github.blog/ai-and-ml/github-copilot/agent-mode-101-all-about-github-copilots-powerful-mode/ [18] Remediating Azure DevOps Personal Access Token leaks https://www.gitguardian.com/remediation/azure-devops-personal-access-token [19] Azure DevOps Client for Node.js - GitApi / WikiApi limitations https://johnnyreilly.com/azure-devops-node-api-git-api-getrefs-wiki-api [20] Boards - List - REST API (Azure DevOps Work) | Microsoft Learn https://learn.microsoft.com/en-us/rest/api/azure/devops/work/boards/list?view=azure-devops-rest-7.1 [21] Use agent mode in VS Code https://code.visualstudio.com/docs/copilot/chat/chat-agent-mode [22] Model Context Protocol (MCP) support in VS Code is generally ... https://github.blog/changelog/2025-07-14-model-context-protocol-mcp-support-in-vs-code-is-generally-available/ [23] Get started with the REST APIs for Azure DevOps - Learn Microsoft https://learn.microsoft.com/en-us/azure/devops/integrate/how-to/call-rest-api?view=azure-devops [24] Enhancing Copilot agent mode with MCP - GitHub Docs https://docs.github.com/en/copilot/tutorials/enhancing-copilot-agent-mode-with-mcp [25] 5 ways to transform your workflow using GitHub Copilot and MCP https://github.blog/ai-and-ml/github-copilot/5-ways-to-transform-your-workflow-using-github-copilot-and-mcp/ [26] MCP Server in Node.js - GitHub https://github.com/lucianoayres/mcp-server-node [27] azure-devops-node-api - NPM https://www.npmjs.com/package/azure-devops-node-api/v/8.0.0?activeTab=code [28] Query Azure DevOps Data from Node.js - CData Software https://www.cdata.com/kb/tech/azuredevops-odata-nodejs.rst [29] Introducing GitHub Copilot agent mode (preview) - Visual Studio Code https://code.visualstudio.com/blogs/2025/02/24/introducing-copilot-agent-mode [30] How to Build Your First MCP Server (in Less Than 5 Minutes) https://www.youtube.com/watch?v=Y4bpWRLdRoA [31] Build and publish a Node.js package - Azure Pipelines https://learn.microsoft.com/en-us/azure/devops/pipelines/ecosystems/javascript?view=azure-devops [32] For Server Developers - Model Context Protocol https://modelcontextprotocol.io/quickstart/server [33] Create a pull request status server with Node.js - Azure Repos https://learn.microsoft.com/en-us/azure/devops/repos/git/create-pr-status-server?view=azure-devops [34] Accelerating Node.js development with mcp-node - Platformatic Blog https://blog.platformatic.dev/accelerating-nodejs-development-with-mcp-node [35] azure-devops-node-api@15.1.0 - jsDocs.io https://www.jsdocs.io/package/azure-devops-node-api [36] About Copilot coding agent - GitHub Docs https://docs.github.com/en/copilot/concepts/about-copilot-coding-agent [37] Build an MCP Server in Under 5 Minutes (w/ Cursor + Node.js) https://www.youtube.com/shorts/avBN7sTvjNY [38] Azure DevOps Services REST API Reference - Learn Microsoft https://learn.microsoft.com/en-us/rest/api/azure/devops/?view=azure-devops-rest-7.2 [39] Tutorial: Automate Node.js deployments with Azure Pipelines https://learn.microsoft.com/en-us/azure/devops/pipelines/ecosystems/nodejs-tutorial?view=azure-devops [40] Azure Pipelines https://azure.microsoft.com/en-us/products/devops/pipelines [41] Azure DevOps Services Pipelines REST API - Learn Microsoft https://learn.microsoft.com/en-us/rest/api/azure/devops/pipelines/?view=azure-devops-rest-7.1 [42] Get all work items from a project azure devops REST API https://stackoverflow.com/questions/63021168/get-all-work-items-from-a-project-azure-devops-rest-api [43] Pipelines REST API v6.1-preview - Reference | Documentation https://www.postman.com/api-evangelist/azure-pipeline/documentation/8iv55ow/pipelines-rest-api-v6-1-preview-reference [44] How to create work items in Azure DevOps with Rest API? - YouTube https://www.youtube.com/watch?v=ROTsmDyIF34 [45] Builds - REST API (Azure DevOps Build) | Microsoft Learn https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds?view=azure-devops-rest-7.1 [46] REST API (Azure DevOps Work Item Tracking) - Learn Microsoft https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items?view=azure-devops-rest-7.1 [47] Integrate Pieces Model Context Protocol (MCP) with GitHub Copilot https://docs.pieces.app/products/mcp/github-copilot [48] How to get a Personal Access Token (PAT) for Azure DevOps https://www.youtube.com/watch?v=aIK62vfCIqg [49] Web app as MCP server in GitHub Copilot Chat agent mode (.NET) https://learn.microsoft.com/en-us/azure/app-service/tutorial-ai-model-context-protocol-server-dotnet [50] Beyond the tools, adding MCP in VS Code https://code.visualstudio.com/blogs/2025/05/12/agent-mode-meets-mcp [51] Extending Copilot Chat with the Model Context Protocol (MCP) https://docs.github.com/en/copilot/how-tos/context/model-context-protocol/extending-copilot-chat-with-mcp [52] Visual Studio Code + Model Context Protocol (MCP) Servers https://dev.to/thangchung/visual-studio-code-model-context-protocol-mcp-servers-the-first-look-18nb [53] Sign in with a Personal Access Token (PAT), Azure DevOps CLI https://learn.microsoft.com/en-us/azure/devops/cli/log-in-via-pat?view=azure-devops [54] How to Use Postgres MCP Server with GitHub Copilot in VS Code https://techcommunity.microsoft.com/blog/azuredevcommunityblog/how-to-use-postgres-mcp-server-with-github-copilot-in-vs-code/4412547 [55] Visual Studio Code + Model Context Protocol (MCP) Servers Getting ... https://www.youtube.com/watch?v=iS25RFups4A [56] Use MCP servers in VS Code https://code.visualstudio.com/docs/copilot/chat/mcp-servers [57] Discover and install MCP Servers in VS Code https://code.visualstudio.com/mcp