Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**
!package.json
!package-lock.json
61 changes: 61 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Validate

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

jobs:
container:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- run: npm ci --ignore-scripts

- name: Check scripts
run: |
node --check scripts/generate-tools-json.mjs
node --check scripts/check-tools-json.mjs
node --check scripts/smoke-mcp.mjs

- name: Build image
run: docker build -t gitkraken-mcp:test .

- name: Check catalog tool-list drift
env:
TOOLS_COMMAND: '["docker","run","--rm","gitkraken-mcp:test","--list-tools"]'
run: npm run check:tools

- name: Smoke test MCP and mounted repository access
run: |
repository="$(mktemp -d)"
git init "$repository"
export repository
MCP_COMMAND="$(node -e 'console.log(JSON.stringify(["docker", "run", "--rm", "-i", "--mount", `type=bind,source=${process.env.repository},target=/workspace/repo`, "gitkraken-mcp:test"]))')"
MCP_COMMAND="$MCP_COMMAND" MCP_SMOKE_REPOSITORY=/workspace/repo npm run smoke:mcp

multiarch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: docker/setup-qemu-action@v3

- uses: docker/setup-buildx-action@v3

- name: Build Linux architectures
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# syntax=docker/dockerfile:1

FROM node:22-bookworm-slim

RUN apt-get update \
&& apt-get install --no-install-recommends -y ca-certificates git \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /app /workspace \
&& chown node:node /app /workspace

WORKDIR /app

COPY --chown=node:node package.json package-lock.json ./

USER node

RUN --mount=type=cache,target=/home/node/.npm,uid=1000,gid=1000 \
npm ci --omit=dev

RUN /app/node_modules/.bin/gk mcp --list-tools --no-telemetry > /dev/null

RUN git config --global --add safe.directory '*'

WORKDIR /workspace

LABEL io.modelcontextprotocol.server.name="com.gitkraken/gk-cli"

ENTRYPOINT ["/app/node_modules/.bin/gk", "mcp"]
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,24 @@ If you want to read more about the MCP server, you can check out the [introducto
- [Tools](#tools)
- [Prompts](#prompts)
- [Installation](#installation)
- [Docker](#docker)
- [Troubleshooting](#troubleshooting)
- [Support](#support)

## Tools

Tools are the primary purpose of the MCP server. They are a set of finely curated commands that AI can use to interact with GitKraken without exploding your context. Some of those tools include: `issues_assigned_to_me`, `gitlens_commit_composer`, and `pull_request_create_review`. A full list of tools can be found in the GitKraken Help Center's [Tools Reference](https://help.gitkraken.com/mcp/mcp-tools-reference/).

The repository also includes a Docker MCP Catalog-compatible [`tools.json`](tools.json). To refresh it from an installed GitKraken CLI, run:

```bash
node scripts/generate-tools-json.mjs
```

Set `GK_BIN` when `gk` is not on `PATH`, or set `TOOLS_COMMAND` to a JSON
command array when generating from a container. The generator intentionally
excludes app-only tools that MCP agents must not call.

## Prompts

Prompts are the secondary purpose of the MCP server. They are a set of carefully crafted instructions that AI can use to understand how to use the tools, when to use them, and what information to provide when using them. A full list of prompts can be found in the GitKraken Help Center's [Prompts Reference](https://help.gitkraken.com/mcp/mcp-prompts-reference/).
Expand Down Expand Up @@ -48,6 +59,43 @@ The installation process details may vary by AI tool, but the general gist is th
}
```

## Docker

This repository includes auth-independent Docker packaging for the local MCP
server. The image can list tools and run local Git tools against explicitly
mounted repositories. Cloud workspaces, issues, pull requests, and provider
operations still require a supported non-interactive GitKraken authentication
contract.

Build the image:

```bash
docker build -t gitkraken-mcp:local .
```

List the tools without authenticating:

```bash
docker run --rm gitkraken-mcp:local --list-tools
```

Check `tools.json` against the clean image:

```bash
npm install
TOOLS_COMMAND='["docker","run","--rm","gitkraken-mcp:local","--list-tools"]' npm run check:tools
```

The image runs as a non-root user and starts `gk mcp` over stdio. When using it
through Docker MCP Toolkit, only mount repository paths that the server should
be allowed to read and modify. Linked Git worktrees also require access to the
external Git directory referenced by their `.git` file. A draft registry entry
is available in
[`docker/catalog/server.yaml.template`](docker/catalog/server.yaml.template).
Copy that template and `tools.json` into `servers/gitkraken/` in a checkout of
[`docker/mcp-registry`](https://github.com/docker/mcp-registry) when preparing
the catalog pull request.

### CLI

#### macOS
Expand Down
21 changes: 21 additions & 0 deletions docker/catalog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Docker MCP Catalog submission

This directory contains the source template for the GitKraken entry in
[`docker/mcp-registry`](https://github.com/docker/mcp-registry).

To prepare a registry pull request:

1. Copy `server.yaml.template` to `servers/gitkraken/server.yaml` in a checkout
of `docker/mcp-registry`.
2. Replace `<PINNED_COMMIT_SHA>` with the full commit SHA containing the
Dockerfile being submitted.
3. Copy the repository root `tools.json` next to `server.yaml`.
4. Add the approved GitKraken authentication configuration once its
non-interactive container contract is finalized.
5. Confirm that the license declared by the distributed `@gitkraken/gk`
package is acceptable for Docker Catalog redistribution.
6. Run the registry's `task build -- --tools gitkraken` and
`task catalog -- gitkraken` checks before opening the pull request.

The `paths` parameter is intentionally required because the local Git tools
must only receive access to repositories explicitly selected by the user.
33 changes: 33 additions & 0 deletions docker/catalog/server.yaml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: gitkraken
image: mcp/gitkraken
type: server
meta:
category: devops
tags:
- git
- devops
- issues
- pull-requests
about:
title: GitKraken
description: Work with Git repositories, issues, and pull requests through GitKraken.
icon: https://avatars.githubusercontent.com/u/92606490?v=4
source:
project: https://github.com/gitkraken/mcp
commit: <PINNED_COMMIT_SHA>
run:
volumes:
- "{{gitkraken.paths|volume|into}}"
config:
description: Configure the local repository paths GitKraken is allowed to access.
parameters:
type: object
properties:
paths:
type: array
items:
type: string
default:
- /Users/local-test
required:
- paths
Loading
Loading