# mcp-gtags-server

> Indexed code navigation for AI coding agents — replaces full-tree grep scans with GNU Global (gtags) lookups over the Model Context Protocol. ~100× faster per query on kernel-scale codebases, with radically less context noise.

URL: https://harshith.in/projects/mcp-gtags-server/
Author: Harshith Sunku (Staff Engineer) — https://harshith.in/about/
Source: https://github.com/harshithsunku/mcp-gtags-server
Live: https://pypi.org/project/mcp-gtags-server/
Stack: Python, MCP, GNU Global, ctags

Every AI coding agent answers "where is this function defined?" the same way: grep the
entire tree. On a full Linux kernel checkout — 65,163 files, 37.1 million lines — that's
1.6 seconds and 7,873 noisy match lines for `kmalloc`. This server answers the same
question in 10 ms with 5 lines, by exposing GNU Global's index to any MCP client
(Claude Code, Cursor, Claude Desktop) through 11 tools: definitions, references,
callers/callees, function bodies, reachability chains, and a `blast_radius` tool that
ranks what an uncommitted diff impacts.

It's built for the codebases LSP tools can't handle: trees that don't compile, machines
without sudo, kernel-scale C/C++. The hard parts are the kernel-isms — `#ifdef` guard
stacks filtered against a `.config`, macro-generated symbols (`sys_read` resolved to its
`SYSCALL_DEFINE3` site), and definitions gtags' parser derails on recovered via their
`EXPORT_SYMBOL` site with ctags. Index management is invisible: the first query builds
it (66 s for the whole kernel), every query incrementally refreshes it in under a second.

Correctness is measured, not assumed: CI runs a 65-case golden eval against a pinned
kernel v6.16 on every push — currently 100% recall and 100% precision@1 across all 11
tools. Install is one user-level config entry (`uvx mcp-gtags-server`); the whole
toolchain bootstraps itself into user space on first use.
