|
| 1 | +# AI Tools Integration Guide |
| 2 | + |
| 3 | +> **Note**: This document is currently under development and will be populated with guidance on using AI coding assistants effectively with dd-trace-java. |
| 4 | +
|
| 5 | +## The AI tools |
| 6 | + |
| 7 | +This section describes the AI tools and integrations available for dd-trace-java development. |
| 8 | + |
| 9 | +**Index:** |
| 10 | +- [MCP Servers Integration (Beta)](#mcp-servers-integration-beta) |
| 11 | + - [Datadog MCP Server Setup](#datadog-mcp-server-setup-for-dd-trace-java) |
| 12 | +- [Claude CLI](#claude-cli) |
| 13 | +- [GitHub CLI (gh)](#github-cli-gh) |
| 14 | +- [GitLab CLI (glab)](#gitlab-cli-glab) |
| 15 | + |
| 16 | + |
| 17 | +### MCP Servers Integration (Beta) |
| 18 | + |
| 19 | +Model Context Protocol (MCP) servers extend AI capabilities with specialized tools and integrations. The dd-trace-java repository provides several MCP server configurations to enhance your development workflow. MCP servers can be used with any compatible AI tool, including Cursor and Claude CLI. |
| 20 | + |
| 21 | +**Available MCP Servers:** |
| 22 | + |
| 23 | +- **Datadog MCP Server**: Provides CI Visibility integration including pipeline event search and aggregation, test event analysis, flaky test detection, code coverage summaries, and PR insights. Pre-configured in the repository via `.cursor/mcp.json` (for Cursor) and `.mcp.json` (for Claude CLI and other compatible tools). See [Datadog MCP Server Setup](datadog-mcp-server.md) for detailed setup and usage instructions. |
| 24 | + |
| 25 | +To set up MCP servers, follow the specific setup guides for each server. All MCP servers integrate seamlessly with compatible AI tools, providing enhanced context and capabilities for working with the dd-trace-java repository. |
| 26 | + |
| 27 | +#### Datadog MCP Server Setup for dd-trace-java |
| 28 | + |
| 29 | +The Datadog MCP server connects Cursor's AI assistant to Datadog's CI Visibility platform, letting you query pipeline events, test results, flaky tests, code coverage, and PR insights directly from the chat. |
| 30 | + |
| 31 | +##### Setup |
| 32 | + |
| 33 | +**1. Repository Configuration (Pre-configured)** |
| 34 | + |
| 35 | +The repository already includes the MCP server configuration in `.cursor/mcp.json`: |
| 36 | + |
| 37 | +```json |
| 38 | +{ |
| 39 | + "mcpServers": { |
| 40 | + "datadog": { |
| 41 | + "url": "https://mcp.datadoghq.com/api/unstable/mcp-server/mcp?toolsets=software-delivery", |
| 42 | + "headers": {} |
| 43 | + } |
| 44 | + } |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +**2. Authentication via SSO** |
| 49 | + |
| 50 | +The Datadog MCP server uses SSO for authentication. No API or App keys are required. |
| 51 | + |
| 52 | +1. Open Cursor IDE in the dd-trace-java repository |
| 53 | +2. Go to the MCP settings panel and trigger the **login** command on the `datadog` server |
| 54 | + For the in terminal agent use `/mcp login`. |
| 55 | +3. A browser tab opens automatically for Datadog SSO login |
| 56 | +4. Complete the login in your browser — Cursor picks up the session automatically |
| 57 | + |
| 58 | +After logging in, the MCP tools are immediately available in the AI chat. |
| 59 | + |
| 60 | +##### Available Tools |
| 61 | + |
| 62 | +The repository configuration enables the **software-delivery** toolset. See the [official Datadog MCP toolsets documentation](https://docs.datadoghq.com/bits_ai/mcp_server/#toolsets:~:text=MCP%20Server.-,Toolsets,-The%20Datadog%20MCP) for the full list of available tools. |
| 63 | + |
| 64 | +##### Example Prompts |
| 65 | + |
| 66 | +``` |
| 67 | +Show me the latest failed CI jobs on the main branch of DataDog/dd-trace-java |
| 68 | +``` |
| 69 | + |
| 70 | +``` |
| 71 | +Find the top 10 flaky tests in dd-trace-java sorted by failure rate |
| 72 | +``` |
| 73 | + |
| 74 | +``` |
| 75 | +What issues are blocking PR #1234 in DataDog/dd-trace-java? |
| 76 | +``` |
| 77 | + |
| 78 | +``` |
| 79 | +What's the P95 pipeline duration for dd-trace-java over the last 30 days? |
| 80 | +``` |
| 81 | + |
| 82 | +### Claude CLI |
| 83 | + |
| 84 | +The dd-trace-java repository provides native support for **Claude CLI** (Anthropic's command-line interface for Claude) through a dedicated configuration in the `.claude/` directory. |
| 85 | + |
| 86 | +#### Configuration Files |
| 87 | + |
| 88 | +``` |
| 89 | +.claude/ |
| 90 | +├── CLAUDE.md # Claude-specific instructions and rules pointer |
| 91 | +├── settings.json # Claude CLI settings (permissions, environment, MCP enablement) |
| 92 | +
|
| 93 | +.mcp.json # MCP server configuration (shared across AI tools) |
| 94 | +``` |
| 95 | + |
| 96 | +* **`.claude/CLAUDE.md`**: Contains Claude-specific instructions and points to the shared rules in `AGENTS.md` |
| 97 | +* **`.claude/settings.json`**: Configures Claude CLI behavior, including default permission mode, environment variables, and MCP server enablement (e.g., the Datadog MCP server) |
| 98 | +* **`.mcp.json`**: Defines MCP server connections at the repository root. Claude CLI automatically discovers this file and makes the configured servers available. Currently includes the Datadog MCP server for CI Visibility integration |
| 99 | + |
| 100 | +### GitHub CLI (gh) |
| 101 | + |
| 102 | +The AI tools are configured to use the **GitHub CLI** (`gh`) for all interactions with GitHub (github.com), including repository management, pull requests, issues, and CI/CD operations. The AI assistant will automatically use `gh` commands when performing GitHub-related tasks. |
| 103 | + |
| 104 | +#### Installation |
| 105 | + |
| 106 | +```bash |
| 107 | +brew install gh |
| 108 | +``` |
| 109 | + |
| 110 | +#### Authentication |
| 111 | + |
| 112 | +```bash |
| 113 | +gh auth login |
| 114 | +``` |
| 115 | + |
| 116 | +To verify your authentication status: |
| 117 | + |
| 118 | +```bash |
| 119 | +gh auth status |
| 120 | +``` |
| 121 | + |
| 122 | +### GitLab CLI (glab) |
| 123 | + |
| 124 | +The AI tools are configured to use the **GitLab CLI** (`glab`) for all interactions with GitLab (gitlab.ddbuild.io), including pipeline management, merge requests, and CI/CD operations. The AI assistant will automatically use `glab` commands when performing GitLab-related tasks. |
| 125 | + |
| 126 | +#### Installation |
| 127 | + |
| 128 | +```bash |
| 129 | +brew install glab |
| 130 | +``` |
| 131 | + |
| 132 | +#### Authentication |
| 133 | + |
| 134 | +You will need a **personal access token** to authenticate with GitLab. You can create one from your GitLab profile at **Settings > Access Tokens** on `gitlab.ddbuild.io`. |
| 135 | + |
| 136 | +Once you have your token, authenticate: |
| 137 | + |
| 138 | +```bash |
| 139 | +glab auth login --hostname gitlab.ddbuild.io |
| 140 | +``` |
| 141 | + |
| 142 | +To set the default host: |
| 143 | + |
| 144 | +```bash |
| 145 | +glab config set host gitlab.ddbuild.io |
| 146 | +``` |
0 commit comments