Self-hosted code search for GitLab CE

Find any line of code across all your GitLab projects.

GitLab Code Search indexes every repository on your GitLab CE instance and shows each person only the code they can already read. Search with plain text or regex, from the browser or from your AI assistant.

Runs on your infrastructure. Uses your existing GitLab accounts. No data leaves your network.

GitLab Code Search results for a regex query, grouped by repository and file, with matching lines highlighted. GitLab Code Search results for a regex query, grouped by repository and file, with matching lines highlighted.
Regex search across every project you can access, grouped by repository and file.

Built for teams that live in GitLab

Everything you expect from code search, wired into the permissions you already manage.

  • Permission-aware by default

    Results are filtered by your GitLab access on every query. Private projects stay private, and nobody needs to manage a second set of permissions.

  • Plain text or regex

    Switch between literal and regular-expression search, match case when you need to, and narrow results by repository, language or path. Every hit links straight to the file and line in GitLab.

  • MCP for AI assistants

    A built-in MCP server lets assistants such as Claude search your code and read files with your GitLab identity, so they find real examples instead of guessing.

  • Self-hosted, no lock-in

    Ships as Docker images with Docker Compose and a Helm chart. Runs next to GitLab CE, needs no external services, and sends no telemetry.

Everyone sees exactly what GitLab lets them see

You sign in with your GitLab account. On every search, GitLab Code Search checks which projects you can read and only returns matches from those projects — public, internal and private alike.

When someone loses access in GitLab, they lose it in search too. There is no separate user list to keep in sync.

  • Sign-in through GitLab (OAuth 2.0 with PKCE)
  • Project visibility and membership respected per query
  • Index updates on push through GitLab system hooks
The same search as a user with less access shows fewer repositories. The same search as a user with less access shows fewer repositories.
Two people, same query: each sees only the projects GitLab lets them read.

How it works

GitLab stays the source of truth. GitLab Code Search keeps a fast index next to it.

How GitLab Code Search works 1. GitLab sends a system hook whenever code is pushed. 2. The indexer fetches the changed repositories and updates the Zoekt index. 3. The search API runs your query against the index and drops every result you cannot read in GitLab. 4. You see results in the web app, or your AI assistant gets them through the MCP server. GitLab Code Search (your infrastructure) push notify write shards query search search git fetch who can read what? GitLab CE repos & access System hooks push events Indexer fetch & update Zoekt index trigram search Search API access check Web app /app MCP server AI assistants How GitLab Code Search works 1. GitLab sends a system hook whenever code is pushed. 2. The indexer fetches the changed repositories and updates the Zoekt index. 3. The search API runs your query against the index and drops every result you cannot read in GitLab. 4. You see results in the web app, or your AI assistant gets them through the MCP server. GitLab Code Search (your infrastructure) push notify write shards query search git fetch who canread what? GitLab CE repos & access System hooks push events Indexer fetch & update Zoekt index trigram search Search API access check Web app /app MCP server AI assistants
  1. GitLab sends a system hook whenever code is pushed.
  2. The indexer fetches the changed repositories and updates the Zoekt index.
  3. The search API runs your query against the index and drops every result you cannot read in GitLab.
  4. You see results in the web app, or your AI assistant gets them through the MCP server.

Give your AI assistant real code search

GitLab Code Search includes an MCP server. Connect any MCP-capable assistant and it can search across your repositories and open files — always with your own GitLab permissions, never a shared service account.

search_code
Search all readable repositories with text or regex, filtered by repo, language or path.
get_file
Read a file (or a line range) at a specific branch or commit.
{
  "mcpServers": {
    "gitlab-code-search": {
      "url": "https://search.example.internal/mcp",
      "headers": { "Authorization": "Bearer <your GitLab personal access token>" }
    }
  }
}

Use a personal access token with the read_api scope. See the README for client-specific setup.

An AI assistant calling the search_code tool and receiving matching files and line numbers. An AI assistant calling the search_code tool and receiving matching files and line numbers.
Your AI assistant searches the same index, with your permissions.

Quick start

You need a GitLab CE instance you administer and a host with Docker.

  1. Create a GitLab OAuth application

    In GitLab, go to Admin Area → Applications and create an application with the openid, profile and read_api scopes. Set the callback URL to https://<your-host>/app/api/auth/callback.

  2. Configure and start

    Copy .env.example to .env, fill in your GitLab URL and OAuth credentials, then run:

    git clone <repo-url> gitlab-code-search
    cd gitlab-code-search
    cp .env.example .env
    docker compose up -d
  3. Add the system hook

    In GitLab, go to Admin Area → System hooks, add https://<your-host>/hooks/gitlab with the secret token from .env, and enable push events. The first full index starts automatically.

Search your GitLab like you mean it.

Sign in with the GitLab account you already have.