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.


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.
How it works
GitLab stays the source of truth. GitLab Code Search keeps a fast index next to it.
- GitLab sends a system hook whenever code is pushed.
- The indexer fetches the changed repositories and updates the Zoekt index.
- The search API runs your query against the index and drops every result you cannot read in GitLab.
- 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.


Quick start
You need a GitLab CE instance you administer and a host with Docker.
-
Create a GitLab OAuth application
In GitLab, go to Admin Area → Applications and create an application with the
openid,profileandread_apiscopes. Set the callback URL tohttps://<your-host>/app/api/auth/callback. -
Configure and start
Copy
.env.exampleto.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 -
Add the system hook
In GitLab, go to Admin Area → System hooks, add
https://<your-host>/hooks/gitlabwith 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.

