Skip to content

Instantly share code, notes, and snippets.

@jmanhype
Created January 18, 2026 17:06
Show Gist options
  • Select an option

  • Save jmanhype/73711f8087047ac2615e00c83a92f051 to your computer and use it in GitHub Desktop.

Select an option

Save jmanhype/73711f8087047ac2615e00c83a92f051 to your computer and use it in GitHub Desktop.
NLP Interface to Dagger CI/CD via Apollo MCP Server - Natural language pipeline execution with Claude Desktop

NLP Interface to Dagger CI/CD via Apollo MCP Server

Natural language CI/CD execution: Claude Desktop → Apollo MCP Server → Dagger GraphQL API

Architecture

┌─────────────────┐     ┌──────────────────┐     ┌─────────────────┐
│  Claude Desktop │────▶│  Apollo MCP      │────▶│  Dagger GraphQL │
│  (Natural Lang) │     │  Server          │     │  Server         │
└─────────────────┘     └──────────────────┘     └─────────────────┘
         │                      │                        │
    "Run tests"          MCP Tool Calls           GraphQL Queries
    "Check coverage"     + Introspection          to Dagger API

Why This Matters

  • Dagger replaces complex CI/CD YAML with code (Go, Python, TypeScript)
  • Apollo MCP Server exposes any GraphQL API as Claude-compatible tools
  • Result: Ask Claude to run your CI/CD pipelines in natural language

Prerequisites

  • Dagger CLI installed (brew install dagger/tap/dagger)
  • Node.js (for Apollo MCP Server)
  • Claude Desktop with MCP support

Setup Steps

1. Start Dagger GraphQL Server

# Start Dagger listening on port 8080 with session token "FU"
DAGGER_SESSION_TOKEN=FU dagger listen --allow-cors --listen 127.0.0.1:8080

The session token becomes the Basic Auth username (base64 encoded).

2. Export Dagger Schema

# Introspect and export the GraphQL schema
dagger query --doc schema.graphql > schema.graphql

This creates the full Dagger API schema that Apollo MCP Server will use.

3. Create Apollo Supergraph Config

supergraph.yaml:

federation_version: =2.10.0
subgraphs:
  dagger:
    routing_url: http://127.0.0.1:8080/query
    schema:
      file: ./schema.graphql

4. Create Router Config (for Auth Headers)

router.yaml:

headers:
  subgraphs:
    dagger:
      request:
        - insert:
            name: "Authorization"
            value: "Basic RlU6"  # Base64 of "FU:"

The RlU6 is base64 encoding of FU: (username:password format, empty password).

5. Start Apollo MCP Server

npx @anthropic/apollo-mcp-server \
  --supergraph supergraph.yaml \
  --router router.yaml

6. Connect to Claude Desktop

# Use MCP remote connection
npx @anthropic/mcp-remote --server apollo-mcp

Or add to Claude Desktop's MCP config directly.

Example Dagger Functions

dagger/main.go:

package main

import (
    "context"
    "dagger/hello-go/internal/dagger"
)

type HelloGo struct{}

// Test runs all unit tests with coverage
func (m *HelloGo) Test(ctx context.Context, source *dagger.Directory) (string, error) {
    return dag.Container().
        From("golang:1.22").
        WithDirectory("/src", source).
        WithWorkdir("/src").
        WithExec([]string{"go", "test", "-cover", "./..."}).
        Stdout(ctx)
}

// Build compiles the project
func (m *HelloGo) Build(ctx context.Context, source *dagger.Directory) *dagger.File {
    return dag.Container().
        From("golang:1.22").
        WithDirectory("/src", source).
        WithWorkdir("/src").
        WithExec([]string{"go", "build", "-o", "app", "."}).
        File("/src/app")
}

// Lint runs golangci-lint
func (m *HelloGo) Lint(ctx context.Context, source *dagger.Directory) (string, error) {
    return dag.Container().
        From("golangci/golangci-lint:latest").
        WithDirectory("/src", source).
        WithWorkdir("/src").
        WithExec([]string{"golangci-lint", "run"}).
        Stdout(ctx)
}

Usage with Claude Desktop

Once connected, you can use natural language:

User: Please use the Dagger MCP to run the test function and 
      let me know how much code coverage I have.

Claude: I'll run the test function using Dagger...
        [Executes GraphQL introspection]
        [Gets directory ID for current project]
        [Runs test function with directory ID]
        
        The tests passed with 63.4% code coverage.

Other example prompts:

  • "Build my Go project and show me any errors"
  • "Run the linter on my codebase"
  • "What Dagger functions are available in this project?"

How It Works Under the Hood

  1. Claude receives natural language request
  2. Apollo MCP Server introspects the Dagger GraphQL schema
  3. Finds matching operations (test, build, lint functions)
  4. Executes GraphQL mutations against Dagger server
  5. Returns results to Claude for natural language response

GitHub Actions Integration

Replace complex workflow steps with single Dagger call:

.github/workflows/ci.yml:

name: CI

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dagger/dagger-for-github@v6
        with:
          verb: call
          args: test --source=.

Benefits

Traditional CI/CD Dagger + MCP
YAML configs per platform Code once, run anywhere
Platform-specific syntax Portable GraphQL API
Manual debugging Natural language queries
Separate local/CI testing Same Dagger functions locally

Resources

Future Ideas

  • AI-powered CI/CD debugging: "Why did my build fail?"
  • Automatic fix suggestions: "The test failed because X, here's the fix"
  • Pipeline generation: "Create a Dagger function to deploy to Kubernetes"
  • Cross-project orchestration: "Run tests on all my Go projects"

Created: 2026-01-18 Source: YouTube tutorial on Dagger + Apollo MCP integration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment