Skip to content

MCP Server

The CI server exposes a Model Context Protocol (MCP) endpoint at /mcp. This lets AI assistants (GitHub Copilot, Claude, etc.) inspect pipeline runs, list task output, and search across pipelines directly from your editor — no manual curl required.

Quick start

1. Start the server

bash
pocketci server \
  --storage sqlite://pocketci.db \
  --basic-auth admin:yourpassword \
  --port 8080

2. Configure VS Code

Add a .vscode/mcp.json file to your workspace:

jsonc
{
  "servers": {
    "ci": {
      "url": "http://localhost:8080/mcp",
      "type": "http",
      "headers": {
        "Authorization": "Basic ${input:ciBasicAuth}"
      }
    }
  },
  "inputs": [
    {
      "id": "ciBasicAuth",
      "type": "promptString",
      "description": "Base64-encoded 'user:password' (run: echo -n 'admin:yourpassword' | base64)",
      "password": true
    }
  ]
}

Generate the Base64 value once and store it securely:

bash
echo -n 'admin:yourpassword' | base64

VS Code will prompt for the value on first use and remember it for the session.

3. Use the tools

Open GitHub Copilot Chat (or any MCP-compatible assistant) and ask questions like:

  • "What failed in run abc123?"
  • "Show me the stdout of the last task in this run."
  • "Find pipelines that use the busybox image."

Available tools

get_run

Retrieve the status and metadata for a single pipeline run.

Input

FieldTypeDescription
run_idstringThe run ID to fetch

Returns JSON with status (queued / running / success / failed), pipeline_id, started_at, finished_at, and any error message.

Example prompt

"Get the status of run _Y0_q5n3RMUktK5y2tYGO."


list_run_tasks

List every task that executed within a run, including stdout, stderr, elapsed time, and exit status.

Input

FieldTypeDescription
run_idstringThe run ID whose tasks to list

Returns An array of task objects, each with:

FieldDescription
pathHierarchical task identifier
statussuccess / failed / running / queued
typetask, agent, or pipeline
stdoutCaptured standard output
stderrCaptured standard error
elapsedWall-clock duration
started_atRFC3339 start timestamp

Example prompt

"List all tasks for run _Y0_q5n3RMUktK5y2tYGO and tell me which one failed."


search_tasks

Full-text search in two modes — either within one run's task output, or across all runs for a pipeline.

Input

FieldTypeRequiredDescription
run_idstringone of the twoSearch task stdout/stderr within this single run
pipeline_idstringone of the twoSearch runs for this pipeline (by ID, status, error) — mirrors the web UI runs search
querystringyesSearch query (see mode notes below)
pageintegerno1-based page number (default: 1, pipeline_id mode only)
per_pageintegernoResults per page (default: 20, pipeline_id mode only)

Provide either run_id or pipeline_id. If run_id is given it takes precedence.

Mode 1 — search task output within a run (run_id)

Uses FTS5 to match any task's stdout/stderr/text fields. Returns matching task records (path, status, stdout, stderr). Useful for pinpointing an error message or stack trace without scrolling through all output.

FTS5 queryMatches
panicAny task containing "panic"
"exit code 1"Exact phrase
error NOT warn"error" but not "warn"

Mode 2 — search runs for a pipeline (pipeline_id)

Uses FTS5 on run ID, status, and error message. Supports the same prefix matching and quoted phrases as run_id mode. Returns a paginated PaginationResult[PipelineRun]. Equivalent to the pipeline-level runs search in the web UI (/pipelines/:id/runs-search/).

Query exampleMatches
failedRuns with status failed
timeoutRuns with "timeout" in error
"out of mem"Exact phrase in error message
segPrefix match ("segfault", etc.)

Example prompts

"Search run _Y0_q5n3RMUktK5y2tYGO for permission denied." (run_id mode)

"Search pipeline d22bcae276f280529d3c4c351e81c699 runs for failed." (pipeline_id mode)


search_pipelines

Full-text search across all stored pipelines by name or content. Supports pagination.

Input

FieldTypeDescription
querystringSearch string (empty → return all)
pageinteger1-based page number (default: 1)
per_pageintegerResults per page (default: 20)

Returns Paginated list of pipelines with id, name, and driver_dsn.

Example prompt

"Find all pipelines that reference golang in their source."

Connecting to a remote server

For a deployed instance (e.g. on Fly.io), point the URL at the public hostname:

jsonc
{
  "servers": {
    "ci": {
      "url": "https://ci.fly.dev/mcp",
      "type": "http",
      "headers": {
        "Authorization": "Basic ${input:ciBasicAuth}"
      }
    }
  },
  "inputs": [
    {
      "id": "ciBasicAuth",
      "type": "promptString",
      "description": "Base64-encoded 'user:password' for ci.fly.dev",
      "password": true
    }
  ]
}

Typical debug workflow

  1. A pipeline run fails. Copy the run ID from the URL (/runs/<run_id>/tasks).
  2. Ask the assistant: "What failed in run <run_id>?"
  3. The assistant calls get_run to confirm the status, then list_run_tasks to surface the failed step and its stderr.
  4. If the output is noisy, use search_tasks to zero in on the error.
  5. Fix the pipeline source and re-run.