Skip to main content

An MCP server for Azure DevOps pipelines.

Project description

ADO MCP

This project uses FastMCP 2.0 python sdk to interact with Azure DevOps.

Setup

  1. Install Dependencies:

    task install
    
  2. Set up Authentication: The MCP server supports multiple authentication methods (in order of precedence):

    Option 1: Personal Access Token (PAT)

    Environment Variable Method:

    task setup-env
    

    This creates a .env file with your Personal Access Token (PAT) and other necessary variables.

    Direct Configuration:

    export AZURE_DEVOPS_EXT_PAT="your-personal-access-token"
    export ADO_ORGANIZATION_URL="https://dev.azure.com/YourOrg"
    

    Option 2: Azure CLI Authentication (Recommended)

    If you already use Azure CLI, you can authenticate using your existing session:

    # Login to Azure (if not already logged in)
    az login
    
    # The MCP server will automatically use your Azure CLI credentials
    task run
    

    Benefits of Azure CLI authentication:

    • No need to manage Personal Access Tokens
    • Uses your existing Azure credentials
    • More secure than storing PATs
    • Automatically refreshes tokens

    Note: Azure CLI authentication requires the user to be logged in with an account that has access to the Azure DevOps organization.

Testing

  • Run Tests:

    task test
    
  • Test Coverage:

    task coverage
    

Usage

  • Run the MCP Server:

    task run
    
  • Inspect the MCP Server:

    task inspect
    

Working with Azure DevOps URLs

Understanding Azure DevOps URL Structure

When working with Azure DevOps URLs from the web interface, it's important to understand the difference between build/run IDs and pipeline definition IDs:

Example URL: https://dev.azure.com/RussellBoley/ado-mcp/_build/results?buildId=324&view=results

  • Organization: RussellBoley (from the URL path)
  • Project: ado-mcp (from the URL path)
  • buildId=324: This is a run ID (specific execution instance), NOT a pipeline definition ID

Getting Pipeline Information from Build URLs

To work with a specific build/run from an Azure DevOps URL:

  1. Extract URL components:

    • Organization: RussellBoley
    • Project: ado-mcp
    • Build/Run ID: 324 (from buildId parameter)
  2. Use get_build_by_id to find the pipeline:

    # Get build details to find the pipeline definition
    build_details = await client.call_tool("get_build_by_id", {
        "project_id": "49e895da-15c6-4211-97df-65c547a59c22",  # ado-mcp project ID
        "build_id": 324  # The buildId from the URL
    })
    
    # Extract pipeline information
    pipeline_id = build_details.data["definition"]["id"]        # e.g., 84
    pipeline_name = build_details.data["definition"]["name"]    # e.g., "log-test-complex"
    
  3. Then use pipeline-specific tools:

    # Get detailed run information
    run_details = await client.call_tool("get_pipeline_run", {
        "project_id": "49e895da-15c6-4211-97df-65c547a59c22",
        "pipeline_id": pipeline_id,  # 84
        "run_id": 324               # Same as buildId
    })
    
    # Get failure analysis if needed
    failure_summary = await client.call_tool("get_pipeline_failure_summary", {
        "project_id": "49e895da-15c6-4211-97df-65c547a59c22",
        "pipeline_id": pipeline_id,
        "run_id": 324
    })
    

Common Mistake to Avoid

Don't do this:

# This will fail - you can't guess the pipeline_id
await client.call_tool("get_pipeline_run", {
    "project_id": "49e895da-15c6-4211-97df-65c547a59c22",
    "pipeline_id": 15,  # Wrong! This is just a guess
    "run_id": 324
})

Do this instead:

# First, get the build details to find the correct pipeline_id
build_data = await client.call_tool("get_build_by_id", {
    "project_id": "49e895da-15c6-4211-97df-65c547a59c22",
    "build_id": 324  # buildId from URL
})

pipeline_id = build_data.data["definition"]["id"]  # Now you have the correct pipeline_id

# Then use it for pipeline-specific operations
await client.call_tool("get_pipeline_run", {
    "project_id": "49e895da-15c6-4211-97df-65c547a59c22", 
    "pipeline_id": pipeline_id,  # Correct pipeline_id
    "run_id": 324
})

Available Tools for Build/Pipeline Analysis

  • get_build_by_id: Get build details and extract pipeline information from a build/run ID
  • get_pipeline_run: Get detailed run information (requires both pipeline_id and run_id)
  • get_pipeline_failure_summary: Analyze failures with root cause analysis
  • get_failed_step_logs: Get logs for failed steps
  • get_pipeline_timeline: Get execution timeline
  • list_pipeline_logs: List all available logs
  • get_log_content_by_id: Get specific log content
  • run_pipeline_and_get_outcome: Run a pipeline and wait for completion with analysis

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ado_mcp_raboley-0.0.1.tar.gz (49.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ado_mcp_raboley-0.0.1-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

Details for the file ado_mcp_raboley-0.0.1.tar.gz.

File metadata

  • Download URL: ado_mcp_raboley-0.0.1.tar.gz
  • Upload date:
  • Size: 49.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.20

File hashes

Hashes for ado_mcp_raboley-0.0.1.tar.gz
Algorithm Hash digest
SHA256 aa4078647f9f607a4b65e68c9ac9cd7bce406d48e8f13b4c7d3385d1ad03d042
MD5 47c8e5dc2674e7ef497cf82c66dc1dfd
BLAKE2b-256 6246217e1bd6198e61612f4c6195202e23895a42eaeea1399c4f2a2b3308f32e

See more details on using hashes here.

File details

Details for the file ado_mcp_raboley-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ado_mcp_raboley-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a5fb5eaaf617772e74a65a50685c80d8f300498622afcd457fb28db8c4b7e9a5
MD5 6333140d71edc87e0e436a1f49ce09ec
BLAKE2b-256 75de94e944b80c093c9a47d972f71332fe09df5999be30b579c552daf82eb502

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page