Kshitijijari09/azure-devops-mcp-server
If you are the rightful owner of azure-devops-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This is a Model Context Protocol (MCP) server that provides access to Azure DevOps resources and tools through a standardized interface.
Azure DevOps MCP Server
This is a Model Context Protocol (MCP) server that provides access to Azure DevOps resources and tools through a standardized interface.
Features
The server provides the following Azure DevOps tools:
- get_workitems - Retrieve work items using WIQL queries
- get_repositories - List Git repositories
- get_pullrequests - Get pull requests from repositories
- get_builds - Retrieve build pipeline information
- get_commits - Get Git commits from repositories
- create_workitem - Create new work items (bugs, features, tasks, etc.)
Prerequisites
- Azure DevOps Account: You need access to an Azure DevOps organization
- Personal Access Token: Generate a PAT with the following scopes:
- Work Items (Read & Write)
- Code (Read)
- Build (Read)
- Release (Read)
Setup Instructions
1. Configure Environment Variables
Edit the .env file in the project root and replace the placeholder values:
# Your Azure DevOps organization name (e.g., "mycompany" for dev.azure.com/mycompany)
AZURE_DEVOPS_ORG=your-actual-organization
# Your Azure DevOps project name
AZURE_DEVOPS_PROJECT=your-actual-project
# Your Azure DevOps Personal Access Token
AZURE_DEVOPS_TOKEN=your-actual-personal-access-token
2. Generate Personal Access Token
- Go to your Azure DevOps organization:
https://dev.azure.com/{your-org}/_usersSettings/tokens - Click "New Token"
- Set the following scopes:
- Work Items: Read & Write
- Code: Read
- Build: Read
- Release: Read
- Copy the generated token and add it to your
.envfile
3. Test the Server
Run the server to test your configuration:
# Activate virtual environment
source azure-mcp-venv/bin/activate
# Run the server
python main.py
If successful, you should see: 🚀 Azure DevOps MCP Server running...
Running the MCP Server
Option 1: Terminal Interactive Client (Recommended for VPN environments)
If you're behind a VPN or can't connect through VS Code, you can use the interactive MCP client directly from the terminal:
# Navigate to the project directory
cd /Users/kshitijijari/Desktop/MySpace/MCP/azure-devops-mcp-server
# Activate the virtual environment
source azure-mcp-venv/bin/activate
# Run the interactive MCP client
python mcp_client.py
This will start an interactive menu with the following options:
- List available tools - See all Azure DevOps tools available
- Get work items - Run custom WIQL queries
- Get repositories - List Git repositories
- Get builds - View build pipeline information
- Get pull requests - View PRs from repositories
- Get commits - View Git commits
- Create work item - Create new work items
- Exit
Option 2: Direct MCP Server
Run the MCP server directly (for use with MCP clients):
# Navigate to the project directory
cd /Users/kshitijijari/Desktop/MySpace/MCP/azure-devops-mcp-server
# Activate the virtual environment
source azure-mcp-venv/bin/activate
# Run the MCP server
python main.py
Option 3: Using the startup script
# Make the script executable
chmod +x start_mcp_server.sh
# Run the startup script
./start_mcp_server.sh
Adding to MCP Client (VS Code/Cursor)
Option 1: Using the provided configuration
Copy the mcp_config.json file to your MCP client configuration directory and update the environment variables:
{
"mcpServers": {
"azure-devops": {
"command": "python",
"args": [
"/Users/kshitijijari/Desktop/MySpace/MCP/azure-devops-mcp-server/main.py"
],
"env": {
"AZURE_DEVOPS_ORG": "your-actual-organization",
"AZURE_DEVOPS_PROJECT": "your-actual-project",
"AZURE_DEVOPS_TOKEN": "your-actual-personal-access-token"
}
}
}
}
Option 2: Manual configuration
Add this to your MCP client configuration:
{
"mcpServers": {
"azure-devops": {
"command": "python",
"args": ["/absolute/path/to/your/azure-devops-mcp-server/main.py"],
"env": {
"AZURE_DEVOPS_ORG": "your-organization",
"AZURE_DEVOPS_PROJECT": "your-project",
"AZURE_DEVOPS_TOKEN": "your-personal-access-token"
}
}
}
}
Option 3: Using the startup script
You can also use the provided startup script:
{
"mcpServers": {
"azure-devops": {
"command": "/Users/kshitijijari/Desktop/MySpace/MCP/azure-devops-mcp-server/start_mcp_server.sh",
"env": {
"AZURE_DEVOPS_ORG": "your-organization",
"AZURE_DEVOPS_PROJECT": "your-project",
"AZURE_DEVOPS_TOKEN": "your-personal-access-token"
}
}
}
}
Usage Examples
Terminal Interactive Client Examples
When using the interactive MCP client (python mcp_client.py), you can:
Get work items with custom queries:
- Enter a WIQL query like:
SELECT [System.Id], [System.Title], [System.State] FROM WorkItems WHERE [System.AssignedTo] = 'John Doe' - Or use the default query for recent work items
Get repositories:
- Optionally filter by repository name
- View all available Git repositories
Get builds:
- Filter by build definition ID
- Filter by status (inProgress, completed, all)
- Set custom limits
Create work items:
- Choose work item type (Bug, Feature, Task, User Story, Epic)
- Set title, description, assignee, area path, and iteration path
MCP Client Integration Examples
Once configured, you can use the Azure DevOps tools in your MCP client:
Get Work Items
{
"name": "get_workitems",
"arguments": {
"query": "SELECT [System.Id], [System.Title], [System.State] FROM WorkItems WHERE [System.TeamProject] = @project",
"limit": 10
}
}
Get Repositories
{
"name": "get_repositories",
"arguments": {}
}
Create Work Item
{
"name": "create_workitem",
"arguments": {
"work_item_type": "Bug",
"title": "New bug report",
"description": "Description of the bug",
"assigned_to": "user@example.com"
}
}
Troubleshooting
Common Issues
- Authentication Error: Verify your Personal Access Token is correct and has the required scopes
- Organization/Project Not Found: Check that your organization and project names are spelled correctly
- Permission Denied: Ensure your PAT has the necessary permissions for the operations you're trying to perform
Debug Mode
To enable debug logging, modify the logging level in main.py:
logging.basicConfig(level=logging.DEBUG)
Security Notes
- Never commit your
.envfile or Personal Access Token to version control - Use environment variables or secure configuration management in production
- Regularly rotate your Personal Access Tokens
- Use the principle of least privilege when setting token scopes
Support
For issues or questions:
- Check the Azure DevOps API documentation
- Verify your token permissions
- Test your connection using the Azure DevOps REST API directly