Skip to content

gkg server

Manage the GitLab Knowledge Graph HTTP server, providing a web interface, HTTP API, and optional file watching for automatic re-indexing.

Terminal window
gkg server start [OPTIONS]

The gkg server command starts a long-running HTTP server that provides:

  • Web Interface: Browser-based UI for exploring the knowledge graph
  • HTTP API: RESTful endpoints for programmatic access to workspace and graph data
  • Real-time Events: Server-Sent Events (SSE) for live progress updates during indexing
  • File Watching: Automatic re-indexing when files change (optional)
  • Background Jobs: Queue-based processing for concurrent operations
  • MCP Integration: Model Context Protocol support for AI tools with dedicated tools for code analysis

The server is designed for ongoing development workflows, providing continuous access to the knowledge graph and automatic updates as your code changes.

Register the server with MCP (Model Context Protocol) configuration.

  • Type: File path
  • Default: None
  • Example: ~/.gitlab/duo/mcp.json

This option automatically registers the GitLab Knowledge Graph server with your MCP configuration file, enabling AI tools to discover and use the knowledge graph API.

Example:

Terminal window
gkg server start --register-mcp ~/.gitlab/duo/mcp.json

Enable automatic file watching and re-indexing.

  • Type: Flag
  • Default: false

When enabled, the server monitors registered workspaces for file changes and automatically queues re-indexing jobs. This keeps the knowledge graph up-to-date as you develop.

Currently, reindexing is in active development and does not support Ruby, as it involves resolving cross-file references, and will result in undefined behavior. All other languages supported by gkg will work, but until GA (General Availability) of gkg is reached, use at your own risk.

Example:

Terminal window
gkg server start --enable-reindexing

Starts the server in detached (background) mode. This is useful when the server should not be bound to a terminal session, for example, when running it in a CI pipeline for integration testing or registering it for system autostart.

Example:

Terminal window
gkg server start --detached

You can stop both foreground and background servers from any terminal session with:

Terminal window
gkg server stop

The server also respects SIGINT and SIGTERM signals on Unix-like systems. You can gracefully stop the server from the attached terminal by pressing Ctrl+C.