azure-devops-mcp-server
このリポジトリは、Azure DevOpsの操作を公開するための.NETライブラリとモデルコンテキストプロトコル(MCP)サーバーを含んでいます。AIエージェントが一般的なタスクを自動化できるように設計されており、作業項目の作成やプルリクエストの管理、ビルドのキューイングなどを統一されたMCPエンドポイントを通じて実行できます。現在はプレリリース段階です。
GitHubスター
12
ユーザー評価
未評価
お気に入り
0
閲覧数
7
フォーク
0
イシュー
1
Azure DevOps MCP Server for .NET
This repository contains a set of .NET libraries and a Model Context Protocol (MCP) server that expose Azure DevOps operations. The goal is to make Azure DevOps automation accessible to AI agents by surfacing common tasks—creating work items, managing pull requests, queuing builds, working with artifacts, and more—through a uniform MCP endpoint.
Status
Currently in pre-release stage.
Preview Notice
This repository is being released as a public preview to gather feedback from the community. The API surface and overall structure are still taking shape and may change substantially as development continues. Future updates might introduce breaking changes without prior notice, and functionality available today could be refactored or removed.
If you choose to build on top of this project during the preview phase, be prepared to regularly sync with the repository and adjust your code to accommodate these changes.
Build | Integration Tests | End to End |
---|---|---|
SonarCloud static analysis |
---|
Overview
The repository contains multiple C# projects that wrap the Microsoft Azure DevOps SDK and REST APIs. Each Azure DevOps tab—Boards, Repos, Pipelines, Artifacts and others—has a project under /src/
exposing a simplified client interface. These thin wrappers are consumed by Dotnet.AzureDevOps.Mcp.Server
to surface Model Context Protocol (MCP) tools. While most calls forward to the official SDKs or, when necessary, the REST endpoints, this layer keeps the MCP server decoupled from Azure DevOps so it can evolve independently or swap implementations in the future.
The solution is organized as a multi‑project workspace targeting .NET 9. Each service area of Azure DevOps has its own client library:
Overview – manage wikis and pages.
- Create, read, list and delete wikis
- Create or update pages, list pages and fetch page text
Boards – manage work items and boards.
- Create and update Epics, Features, Stories and Tasks
- Query work items, manage comments, attachments and links
- Bulk updates and exports, list boards, columns and iterations
- Manage iterations and areas and get work item counts
Repos – pull request and repository management.
- Create, complete and list pull requests with labels and comments
- Create tags, list branches and diffs, create and delete repositories
- Update pull request iterations and search commits
Pipelines – build and pipeline operations.
- Queue, cancel and retry builds, list runs and download logs
- Retrieve changes, logs and build reports
- List definitions and full pipeline CRUD
Artifacts – manage feeds and packages.
- Create, update, list and delete feeds
- List packages, view permissions and retention policies
- Manage feed views and attempt package and upstreaming operations
Test Plans – work with test plans and suites.
- Create, read, list and delete test plans and suites
- Create test cases, add them to suites and fetch test results
Project Settings – team and process configuration.
- Create, update and delete teams
- Retrieve board settings and iterations
- Create and delete inherited processes
Search – search Azure DevOps artifacts.
- Search wiki pages
- Search work items
The Dotnet.AzureDevOps.Mcp.Server
project brings these libraries together and exposes them as MCP tools. The server is implemented as a console application that hosts an ASP.NET Core web server using the ModelContextProtocol
package. You can run it directly or adapt it to your preferred hosting environment—such as a container image, Azure Functions, or a Windows service.
The MCP server follows the Model Context Protocol specification by serving MCP tools at the /mcp
endpoint using Server-Sent Events (SSE) over HTTP. AI assistants can discover available tools at runtime by connecting to this endpoint and invoke them using structured function calls.
Integration tests exercise each client against a real Azure DevOps organization. Another test suite validates end‑to‑end agent interactions using Semantic Kernel, demonstrating that an LLM can automatically invoke the published tools.
Repository structure
- src – source projects implementing the client libraries and MCP server.
- test – unit, integration and end-to-end tests.
Dotnet.AzureDevOps.sln
– solution file linking all projects.
Getting started
Prerequisites
- Install the latest .NET 9 release.
- Clone this repository.
Quick Start
Option A: Run Locally
# Build and run
dotnet build
dotnet run --project src/Dotnet.AzureDevOps.Mcp.Server
Option B: Run with Docker
# Build and run in container
docker build -t azure-devops-mcp-server .
docker run -p 5050:5050 azure-devops-mcp-server
Development Setup
For development and testing:
- Restore dependencies and build:
dotnet build
- Run the tests:
dotnet test
- Start the MCP server:
dotnet run --project src/Dotnet.AzureDevOps.Mcp.Server
The server listens on http://localhost:5050 by default.
The MCP endpoint is available at /mcp
(http://localhost:5050/mcp).
Visit /health
to check that it is running.
Example: Using the MCP server with Semantic Kernel
The end‑to‑end tests
show how a Semantic Kernel agent can call tools published by the MCP server. A
new console application can reproduce the same workflow:
Prerequisites
- .NET 9 SDK installed
- A running MCP server accessible via URL
- An OpenAI API key and model name
- Environment variables configured:
MCP_SERVER_URL
OPENAI_API_KEY
OPENAI_MODEL
dotnet new console -n MyMcpClient
cd MyMcpClient
dotnet add package Microsoft.SemanticKernel --version 1.59.0
dotnet add package Microsoft.SemanticKernel.Agents.Core --version 1.59.0
dotnet add package ModelContextProtocol-SemanticKernel --version 0.3.0-preview-01
Replace Program.cs
with the following and configure your MCP server URL and
OpenAI credentials as environment variables:
using Microsoft.Extensions.DependencyInjection;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Agents;
using Microsoft.SemanticKernel.Connectors.OpenAI;
using ModelContextProtocol.SemanticKernel.Extensions;
var serverUrl = Environment.GetEnvironmentVariable("MCP_SERVER_URL")!;
var openAiKey = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;
var model = Environment.GetEnvironmentVariable("OPENAI_MODEL")!;
// Note: MCP_SERVER_URL should include the /mcp endpoint path
// Example: "http://localhost:5050/mcp"
IKernelBuilder builder = Kernel.CreateBuilder();
builder.Services.AddOpenAIChatCompletion("openai", model, openAiKey);
var kernel = builder.Build();
await kernel.Plugins.AddMcpFunctionsFromSseServerAsync("MyMcpServer", serverUrl);
var settings = new OpenAIPromptExecutionSettings
{
ToolCallBehavior = ToolCallBehavior.AutoInvokeKernelFunctions
};
var agent = new ChatCompletionAgent
{
Name = "McpTester",
Kernel = kernel,
Instructions = "Use available tools to answer the user's question.",
Arguments = new KernelArguments(settings)
};
await foreach (var update in agent.InvokeAsync(
"Call the echo tool with the text \"Hello MCP!\" and return the raw output."))
{
Console.WriteLine(update.Message);
}
Running this program prints Hello MCP!
once the agent invokes the echo
tool
exposed by your MCP server.
Deployment Options
The Azure DevOps MCP Server supports two deployment methods:
Option 1: Local HTTP Server
Run the server directly on your machine for development and testing:
# Build and run directly
dotnet run --project src/Dotnet.AzureDevOps.Mcp.Server
# Or use the provided scripts
./run-local.sh # Linux/macOS
run-local.cmd # Windows
The server listens on http://localhost:5050 by default.
The MCP endpoint is available at /mcp
(http://localhost:5050/mcp).
Visit /health
to check that it is running.
Option 2: Docker Container
Run the server in a Docker container for consistent, isolated deployment:
# Build the Docker image
docker build -t azure-devops-mcp-server .
# Run the container
docker run -d \
--name azure-devops-mcp-server \
-p 5050:5050 \
-e ASPNETCORE_ENVIRONMENT=Production \
azure-devops-mcp-server
# Or use the provided scripts
./run-docker.sh # Linux/macOS
run-docker.cmd # Windows
The containerized server is available at http://localhost:5050.
The MCP endpoint is accessible at /mcp
(http://localhost:5050/mcp).
Docker Benefits
- Isolation: Runs in its own environment
- Consistency: Same behavior across different machines
- Production-ready: Includes health checks and proper logging
- Easy deployment: Single container to deploy anywhere
Configuration
Both deployment methods support the same configuration options:
Settings are read from appsettings.json
and environment variables prefixed with MCP_
.
Environment Variables
MCP_McpServer__Port=5050
- Server port (default: 5050)MCP_McpServer__LogLevel=Information
- Log levelMCP_McpServer__EnableOpenTelemetry=true
- Enable telemetryMCP_McpServer__EnableApplicationInsights=false
- Enable App InsightsASPNETCORE_ENVIRONMENT=Production
- ASP.NET Core environment
Azure DevOps Configuration
For connecting to Azure DevOps services, set these environment variables:
AZURE_DEVOPS_ORG
- Your Azure DevOps organization name (e.g., "mycompany")AZURE_DEVOPS_PAT
- Personal Access Token with appropriate permissionsAZURE_DEVOPS_SEARCH_ENDPOINT
(optional) - Custom search endpoint URL
Example:
export AZURE_DEVOPS_ORG=mycompany
export AZURE_DEVOPS_PAT=your_personal_access_token_here
# Optional: Custom search endpoint
export AZURE_DEVOPS_SEARCH_ENDPOINT=https://custom-search.mydomain.com/
Examples
Local server with custom port:
MCP_McpServer__Port=7070 dotnet run --project src/Dotnet.AzureDevOps.Mcp.Server
Docker container with custom configuration:
docker run -d \
--name azure-devops-mcp-server \
-p 7070:7070 \
-e MCP_McpServer__Port=7070 \
-e MCP_McpServer__LogLevel=Debug \
-e MCP_McpServer__EnableOpenTelemetry=false \
azure-devops-mcp-server
The script Set-Local-Test-Dev-Env-Vars.ps1
can help define the environment variables used by the tests and examples.
License
This project is licensed under the MIT License. See LICENSE for details.
Code of Conduct
This project has adopted the Microsoft Open Source Code of Conduct.
For more information see the Code of Conduct FAQ
or contact opencode@microsoft.com with any additional questions or comments.