agentleFS
Tiberriver256Tiberriver256/mcp-server-azure-devops/.github/copilot-instructions.md

mcp-server-azure-devops

Copilot instructions393 starsChanged 5 months agoMITView on GitHub

Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here. You need to have Node.js and npm installed. Node 20 (LTS) or later is recommended for development; on the 20.x line, current tooling requires Node >=20.19.0 (or >=22.12.0 on newer majors). Copy .env.example to .env and configure Azure DevOps credentials: Required environment variables: Alternative setup methods: - Use ./setup_env.sh script for interactive environment setup with…

  • Reads credentials
  • Installs packages

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

20 rules. About 0 are common, 8 are distinctive, and 12 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 12

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does …

    line 3
  2. Very specific:

    Use ./setup_env.sh script for interactive environment setup with Azure CLI

    line 71
  3. Distinctive:

    Before submitting a PR, ensure:

    line 80
  4. Very specific:

    Test server startup: npm run dev (should start or fail gracefully with clear error messages)

    line 99
  5. Very specific:

    Test MCP protocol using npm run inspector (requires working Azure DevOps credentials)

    line 100
  6. Very specific:

    Path aliases: Use @/ instead of relative imports (e.g., import { something } from '@/shared/utils')

    line 125
  7. Distinctive:

    Follow the Feature Module pattern used throughout the codebase:

    line 137
  8. Very specific:

    Add to src/server.ts following existing patterns

    line 155
  9. Distinctive:

    Follow the same structure and naming conventions

    line 159
  10. Distinctive:

    When updating existing features:

    line 163
  11. Distinctive:

    Update or add tests: Always update existing tests or add new ones

    line 168
  12. Very specific:

    Authentication issues: Check docs/authentication.md first

    line 213
  13. Very specific:

    Testing patterns: Use docs/testing/setup.md

    line 216
  14. Distinctive:

    Ensure all imports are valid

    line 223
  15. Very specific:

    Verify tsconfig.json paths configuration

    line 224
  16. Very specific:

    Run npm run lint:fix to auto-fix common issues

    line 232
  17. Very specific:

    Check Oxlint rules in .oxlintrc.json

    line 233
  18. Very specific:

    Verify .env file configuration

    line 236
  19. Distinctive:

    Check error messages for missing environment variables

    line 237
  20. Very specific:

    Use @/ path aliases instead of relative imports

    line 245

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Azure DevOps MCP Server - Development Instructions

Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.

Prerequisites

You need to have Node.js and npm installed. Node 20 (LTS) or later is recommended for development; on the 20.x line, current tooling requires Node >=20.19.0 (or >=22.12.0 on newer majors).

Building and Running

1. Install Dependencies

npm install  # Takes ~25 seconds. NEVER CANCEL. Set timeout to 60+ seconds.

2. Build the Server

npm run build  # Takes ~5 seconds. Compiles TypeScript to `dist/` directory.

3. Run Tests

# Unit tests (no Azure DevOps credentials required)
npm run test:unit  # Takes ~19 seconds. NEVER CANCEL. Set timeout to 60+ seconds.

# Integration tests (requires Azure DevOps credentials)
npm run test:int  # Takes ~18 seconds. NEVER CANCEL. Set timeout to 60+ seconds.

# E2E tests (requires Azure DevOps credentials)
npm run test:e2e  # Takes ~6 seconds. NEVER CANCEL. Set timeout to 30+ seconds.

# All tests
npm test  # Takes ~45 seconds total. NEVER CANCEL. Set timeout to 90+ seconds.

4. Code Quality

npm run lint       # Takes ~3 seconds. Runs Oxlint for code quality.
npm run lint:fix   # Auto-fix linting issues.
npm run format     # Takes ~3 seconds. Runs oxfmt for code formatting.
npm run format:check  # Checks formatting with oxfmt.

5. Run the Server

# IMPORTANT: Always configure environment first using `.env` file (copy from `.env.example`)

npm run dev        # Development mode with auto-restart using ts-node-dev
npm run start      # Production mode - runs compiled version from `dist/index.js`
npm run inspector  # Debug mode with MCP Inspector tool

Environment Setup

Copy .env.example to .env and configure Azure DevOps credentials:

cp .env.example .env
# Edit .env with your Azure DevOps credentials

Required environment variables:

AZURE_DEVOPS_ORG_URL=https://dev.azure.com/your-organization
AZURE_DEVOPS_AUTH_METHOD=pat  # Options: pat, azure-identity, azure-cli
AZURE_DEVOPS_PAT=your-personal-access-token  # For PAT auth
AZURE_DEVOPS_DEFAULT_PROJECT=your-project-name  # Optional

Alternative setup methods:

  • Use ./setup_env.sh script for interactive environment setup with Azure CLI
  • See docs/authentication.md for comprehensive authentication guides
  • Copy from docs/examples/ directory for ready-to-use configurations (PAT, Azure Identity, Azure CLI)
  • For CI/CD environments: Reference docs/ci-setup.md for secrets configuration

Note: The application will fail gracefully with clear error messages if credentials are missing.

Submitting Changes

Before submitting a PR, ensure:

  1. Linting and formatting pass:
    npm run lint:fix && npm run format
  2. Build succeeds:
    npm run build
  3. Unit tests pass:
    npm run test:unit
  4. Manual testing complete:
    • Configure .env file (copy from .env.example and update values)
    • Test server startup: npm run dev (should start or fail gracefully with clear error messages)
    • Test MCP protocol using npm run inspector (requires working Azure DevOps credentials)
  5. Integration/E2E tests pass (if you have Azure DevOps credentials):
    npm run test:int && npm run test:e2e
  6. Conventional commits:
    npm run commit  # Use this for guided commit message creation

Note: Unit tests must pass even without Azure DevOps credentials - they use mocks for all external dependencies.

Project Architecture

  • TypeScript project with strict configuration (tsconfig.json)
  • Feature-based architecture: Each Azure DevOps feature area is a separate module in src/features/
    • Example: src/features/work-items/, src/features/projects/, src/features/repositories/
  • MCP Protocol implementation for AI assistant integration using @modelcontextprotocol/sdk
  • Test Strategy: Testing Trophy approach (see docs/testing/README.md)
    • Unit tests: .spec.unit.ts (mock all external dependencies, focus on logic)
    • Integration tests: .spec.int.ts (test with real Azure DevOps APIs, requires credentials)
    • E2E tests: .spec.e2e.ts (test complete MCP server functionality)
    • Tests are co-located with feature code
  • Path aliases: Use @/ instead of relative imports (e.g., import { something } from '@/shared/utils')

Key Directories

  • src/index.ts and src/server.ts - Main server entry points
  • src/features/[feature-name]/ - Feature modules
  • src/shared/ - Shared utilities (auth, errors, types, config)
  • src/clients/azure-devops.ts - Azure DevOps client
  • tests/setup.ts - Test configuration
  • docs/ - Comprehensive documentation (authentication, testing, tools)

Adding a New Feature

Follow the Feature Module pattern used throughout the codebase:

  1. Create feature module directory:
    src/features/[feature-name]/
  2. Add required files:
    • feature.ts - Core feature logic
    • schema.ts - Zod schemas for input/output validation
    • tool-definitions.ts - MCP tool definitions
    • index.ts - Exports and request handlers
  3. Add test files:
    • feature.spec.unit.ts - Unit tests (required)
    • feature.spec.int.ts - Integration tests (if applicable)
  4. Register the feature:
    • Add to src/server.ts following existing patterns
  5. Reference existing modules:
    • See src/features/work-items/ or src/features/projects/ for complete examples
    • Follow the same structure and naming conventions

Modifying Existing Features

When updating existing features:

  1. Update core logic: src/features/[feature-name]/feature.ts
  2. Update schemas: schemas.ts (if input/output changes)
  3. Update tool definitions: tool-definitions.ts (if MCP interface changes)
  4. Update or add tests: Always update existing tests or add new ones
  5. Run validation: Execute the full validation workflow before committing

Dependencies

Core libraries:

  • @modelcontextprotocol/sdk - MCP protocol implementation
  • azure-devops-node-api - Azure DevOps REST APIs
  • @azure/identity - Azure authentication
  • zod - Schema validation and type safety

Development tools:

  • jest - Testing framework (with separate configs for unit/int/e2e tests)
  • ts-node-dev - Development server with auto-restart
  • oxlint + oxfmt - Code quality and formatting
  • husky - Git hooks for commit validation

CI/CD:

  • GitHub Actions workflow: .github/workflows/main.yml
  • Runs on PRs to main: Install → Lint → Build → Unit Tests → Integration Tests → E2E Tests
  • Integration and E2E tests require Azure DevOps secrets in CI
  • Release automation with release-please

Documentation

The repository has extensive documentation. Reference these for specific scenarios:

Authentication & Configuration

  • docs/authentication.md - Complete authentication guide (PAT, Azure Identity, Azure CLI)
  • docs/azure-identity-authentication.md - Detailed Azure Identity setup and troubleshooting
  • docs/ci-setup.md - CI/CD environment setup and secrets configuration
  • docs/examples/ - Ready-to-use environment configuration examples

Testing & Development

  • docs/testing/README.md - Testing Trophy approach, test types, and testing philosophy
  • docs/testing/setup.md - Test environment setup, import patterns, VSCode integration
  • CONTRIBUTING.md - Development practices, commit guidelines, and workflow

Tool & API Documentation

  • docs/tools/README.md - Complete tool catalog with examples and response formats
  • docs/tools/[feature].md - Detailed docs for each feature area (work-items, projects, etc.)
  • docs/tools/resources.md - Resource URI patterns for accessing repository content

When to Reference

  • Starting new features: Review CONTRIBUTING.md and docs/testing/README.md
  • Authentication issues: Check docs/authentication.md first
  • Available tools: Browse docs/tools/README.md
  • CI/CD problems: Reference docs/ci-setup.md
  • Testing patterns: Use docs/testing/setup.md
  • Environment setup: Copy from docs/examples/

Troubleshooting

Build fails:

  • Check TypeScript errors
  • Ensure all imports are valid
  • Verify tsconfig.json paths configuration

Tests fail:

  • Unit tests: Should pass without Azure DevOps credentials (they use mocks)
  • Integration/E2E tests: Check .env file has valid Azure DevOps credentials
  • See docs/testing/setup.md for environment variables and patterns

Lint errors:

  • Run npm run lint:fix to auto-fix common issues
  • Check Oxlint rules in .oxlintrc.json

Server won't start:

  • Verify .env file configuration
  • Check error messages for missing environment variables
  • See docs/authentication.md for comprehensive setup guides

Authentication issues:

  • See docs/authentication.md for comprehensive troubleshooting
  • For CI/CD: Reference docs/ci-setup.md for proper secrets configuration

Import errors:

  • Use @/ path aliases instead of relative imports
  • Verify tsconfig.json paths configuration

Unknown tool capabilities:

  • Browse docs/tools/README.md for complete tool documentation

Available Skills

Skills are modular, self-contained packages that extend capabilities with specialized knowledge, workflows, and tools. Reference these skills when working on related tasks.

Skill NameUse When...Path
skill-creatorCreating a new skill or updating an existing skill that extends capabilities with specialized knowledge, workflows, or tool integrations.github/skills/skill-creator/SKILL.md
azure-devops-rest-apiImplementing new Azure DevOps API integrations, exploring API capabilities, understanding request/response formats, or referencing the official OpenAPI specifications from the vsts-rest-api-specs repository.github/skills/azure-devops-rest-api/SKILL.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.