# Dagger (Programmable CI) MCP for AI Agents MCP

> Dagger (Programmable CI) lets your AI agent manage complex software delivery pipelines directly. Use this MCP to orchestrate entire build processes, pull images, execute raw GraphQL queries for testing logic, and securely handle secrets—all through natural language commands.

## Overview
- **Category:** loved-by-devs
- **Price:** Free
- **Tags:** ci-cd, container-orchestration, pipeline-automation, graphql, infrastructure-as-code, build-automation

## Description

This MCP connects your AI client directly to the Dagger Engine, giving you programmable control over your entire CI/CD flow. Instead of jumping between dashboards or writing complex YAML files, your agent handles the orchestration. It can initialize scratch containers, pull necessary images, and query Git repositories for source code. Need to run a specific test? Your agent executes raw GraphQL queries to compose that logic dynamically. The MCP also manages resource lifecycles—it pulls secrets securely and caches volumes so you don't repeat work. When you use Vinkius, your AI client gets access to this entire suite of tools, letting you debug pipelines or run full builds right from the chat interface. It’s all about treating your infrastructure like another API endpoint.

## Tools

### execute_graphql_query
Run a raw GraphQL query against the Dagger engine to define complex operational graphs.

### query_cache_volume
Creates and manages cache volumes for persistent build data.

### query_container
Initializes a scratch container environment and returns its unique state ID.

### query_current_module
Retrieves detailed information about the current module's operational state.

### query_directory
Creates an empty directory within the build context and returns its ID for later use.

### query_git
Connects to a Git repository to query its current state or fetch source code.

### query_host
Retrieves details about the underlying host computing environment.

### query_http
Downloads a file from any specified URL for use in the pipeline.

### query_secret
Creates or references secrets, supporting environment variables, local files, and command outputs.

### query_version
Checks and reports the specific version number of the Dagger Engine currently running.

## Prompt Examples

**Prompt:** 
```
What's the latest state of the core library repo?
```

**Response:** 
```
**Repository Status Report**

*   **Source:** `https://github.com/dagger/core-lib`
*   **Status:** Ready to build.
*   **Directory ID:** `dir-repo789` (Use this ID for subsequent operations.)
*   **Latest Commit:** v1.5.2 (SHA: a3b4c5d)

Ready to start building from this state.
```

**Prompt:** 
```
Can you set up a temporary build environment and pull the necessary secret?
```

**Response:** 
```
Got it. I've spun up a scratch container for you (`cont-abc123xyz`). 

Next, I'm fetching the required API key:
*   **Secret Name:** `API_KEY`
*   **Source Type:** Environment Variable (Required)
*   **Value Status:** Found and secured. You can now use this ID to chain further operations.
```

**Prompt:** 
```
Run the full test graph for my service, using the latest code
```

**Response:** 
```
**GraphQL Execution Plan**

*   ✅ **Step 1:** Initialize Container (`cont-abc123xyz`).
*   ✅ **Step 2:** Query Codebase (using `dir-repo789`).
*   ✅ **Step 3:** Execute Test Logic:
    *   `query(service: { test })` -> Success.
    *   `query(test: { validateCache })` -> Passed. 

Overall build status: SUCCESS. The resulting artifact is ready.
```

## Capabilities

### Execute complex build graphs
Run raw GraphQL queries against the Dagger engine to define and execute directed acyclic graph operations.

### Manage container resources
Initialize scratch containers, pull images, and manage OCI-compatible states for your builds.

### Query source code repositories
Connect to Git repositories to fetch the latest source code directly into your pipeline environment.

### Securely handle configuration data
Create and access secrets using various sources, including environment variables or local file paths.

### Inspect build state
Query the current module status or check the engine version to ensure your pipeline environment is consistent.

## Use Cases

### Diagnosing a failing microservice build
A developer notices a service failed deployment. They ask their agent to check the host environment (`query_host`), initialize a scratch container (`query_container`), and then execute a specific GraphQL query to pinpoint which dependency failed, getting a clean report instantly.

### Building an isolated test environment
An SRE needs to test code against a private resource. They ask the agent to pull required assets using `query_http`, retrieve credentials via `query_secret`, and then use these inputs in a raw GraphQL query for validation.

### Updating dependencies across multiple services
A DevOps engineer needs to ensure all services are built from the latest Git commit. They ask the agent to run `query_git` first, then use that source code to define and execute a multi-stage build graph.

### Creating reproducible test runs
A developer wants to ensure the local environment matches production. They request the agent confirm the engine version (`query_version`) and query the current module state, ensuring all necessary caches are available via `query_cache_volume`.

## Benefits

- Stop context switching. Your agent runs full build, test, and deployment cycles without you ever leaving the chat interface.
- Control infrastructure logic directly. Use `execute_graphql_query` to define deep, dynamic operational graphs that standard CI tools can't handle.
- Manage dependencies cleanly. The MCP handles secrets using `query_secret`, ensuring sensitive data is accessed securely during every build step.
- Validate environment consistency. Check the module state or run `query_version` to guarantee your pipeline runs against expected engine parameters.
- Source code access is instant. Use `query_git` and `query_directory` together to pull specific source versions into a fresh, isolated container.

## How It Works

The bottom line is that you interact with infrastructure tasks conversationally; the MCP translates those instructions into a structured series of engine operations.

1. Ensure a Dagger Engine is active in your local development environment.
2. Provide the session port and token generated by the Dagger CLI within your AI client's connection parameters.
3. Use natural language commands to instruct your agent to build, test, or deploy resources.

## Frequently Asked Questions

**How does Dagger (Programmable CI) MCP help me run complex deployments?**
This MCP lets you define your entire deployment process as a single, programmable workflow. Instead of writing many small steps, you use raw GraphQL queries to tell the agent exactly how all parts—containers, secrets, and source code—must interact.

**Do I need to be a DevOps expert to use Dagger (Programmable CI) MCP?**
No. While it handles complex infrastructure logic, you interact with it using natural language commands via your agent. The MCP translates your conversational requests into the precise technical steps needed for a successful build.

**Can Dagger (Programmable CI) MCP handle external files or URLs?**
Yes. It has tools to pull remote assets from URLs (`query_http`) and also manage local directory structures, allowing you to bring any needed file into the build context for testing.

**Is Dagger (Programmable CI) MCP better than traditional Jenkins setups?**
It's a modern alternative. While older systems rely on rigid pipelines and configuration files, this MCP allows you to dynamically query and manage resources in real-time through your agent, offering much greater flexibility.

**What if my build fails halfway through with Dagger (Programmable CI) MCP?**
The system tracks the full state. You can ask your agent to check the current module status or query the host environment to pinpoint exactly where and why the failure occurred, saving you hours of debugging.