Gitlas MCP Server
by sethiraj
README.md
# Gitlas
**git + atlas — a live map of everything your team ships.**
Gitlas builds a knowledge graph of your whole software lifecycle — requirements, ADRs,
designs, code, tests, PRs, incidents — across many repos, keeps it aligned to git commits,
and serves it to coding agents as small, grounded context packs.
> **Status: pre-alpha.** Git-native sync, requirement traceability and the agent surface (SDK + MCP server) work end to end; multi-repo composition with cross-repo impact works too. Nothing here is stable yet.
---
## Why another graph?
There are several good open-source code knowledge graphs already — and if you want a *code*
graph, use one of them:
- [codegraph](https://github.com/colbymchenry/codegraph) — tree-sitter → SQLite, 2 MCP tools, excellent zero-config UX
- [Codebase-Memory](https://arxiv.org/html/2603.27277v1) — 66 languages, benchmarked across 31 repos
- [code-graph-rag](https://github.com/vitali87/code-graph-rag) — multi-language monorepos on Memgraph
Gitlas is not trying to beat them at code graphing. It is aimed at three things they
structurally do not do:
**1. The graph covers more than code.**
A requirement, the ADR that shaped it, the code that implements it, and the tests that cover
it are one connected story. Every code-graph tool sees only the third of those. Gitlas answers
*"which requirement does this function implement, and which tests cover it?"* — and its
inverse, *"which requirements have no implementing code or no covering test?"*
**2. Freshness is driven by git, not by re-indexing.**
The incumbents ask you to re-index by hand, or watch the filesystem. Gitlas reads
`git diff --name-status` between your last-indexed commit and `HEAD`, re-extracts only what
changed, and tracks symbol identity across `git mv`. Every answer reports the commit it was
built from, and **a query never blocks waiting for a rebuild**.
**3. Accuracy is a gate, not a footnote.**
The published benchmark for this category reports ~10× fewer tokens at **83% answer quality
versus 92%** for a plain file-reading agent. Trading nine points of accuracy for tokens is a
bad trade that gets reported as a win because only the token half is published. Gitlas's
success criterion is *correctness within 2 points of an unaided agent at ≥5× fewer tokens*,
and we publish both numbers or neither.
## How it works
Gitlas does not do extraction. [graphify](https://github.com/safishamsi/graphify) does that
well for 90+ file types, so Gitlas orchestrates it and adds the git, multi-repo, traceability
and retrieval layers on top. Exactly one module is allowed to import graphify, which is how
we survive an upstream that ships every couple of days.
```
your repos ──git plumbing──▶ change set ──▶ graphify (extraction) ──▶ per-repo/branch graph
│
requirements · ADRs · tests ──▶ traceability edges (SQLite) ───────────────┤
▼
context pack ──▶ MCP / Python SDK ──▶ your agent
```
**Storage is SQLite plus files. There is no server to run.**
## Install
Not yet published. From a clone:
```bash
python -m venv .venv && .venv/Scripts/activate # Windows
pip install -e ".[dev,mcp,tokens]"
gitlas doctor
```
## Run it for an organisation (preview)
`gitlas_server` turns the library into a self-hosted service: a worker that clones and
indexes repositories, a read-only HTTPS API, and an encrypted secret store, in one
`docker compose up`. Sign-in, roles, MCP over HTTPS and the web UI follow (milestones G2-G4).
```bash
cp deploy/.env.example deploy/.env # fill in POSTGRES_PASSWORD, GITLAS_SECRET_KEY, GITLAS_BOOTSTRAP_TOKEN
docker compose -f deploy/docker-compose.yml --env-file deploy/.env up -d --build
docker compose -f deploy/docker-compose.yml --env-file deploy/.env exec worker gitlas-server repo add https://github.com/acme/payments.git --branch main
curl https://localhost/api/health
curl -H "Authorization: Bearer $GITLAS_BOOTSTRAP_TOKEN" "https://localhost/api/pack?q=how+are+refunds+issued"
```
Access is by Space: an admin groups repositories into Spaces and gives people a role in
each (`gitlas-server space create|add-repo|grant`, `user add`, `token create`). A token
is bound to one user and one Space; a repository outside it does not exist for that
token. Raw source is returned only to people the SCM itself says can read the repository.
Administrative writes go through `gitlas-server` inside the worker container; the API is
read-only.
Secret values are read from stdin, stored envelope-encrypted, and never returned.
Interactive API docs are at `/api/docs`.
## Use it from an agent
```bash
gitlas add path/to/repo # register a clone in place; nothing is copied
gitlas sync # index it (later syncs re-extract only what git says changed)
gitlas install claude --project path/to/repo # writes .mcp.json, merging with what is there
```
Claude Code then gets five tools - about 600 tokens of definitions per turn:
| Tool | What it answers |
|---|---|
| `gitlas_pack` | Compact, token-bounded context for a question, with file:line |
| `gitlas_trace` | Requirement -> code -> tests, symbol -> requirement, or untested requirements |
| `gitlas_impact` | Dependents, requirements at risk and tests to run for a symbol, file, commit range or uncommitted edits |
| `gitlas_source` | The exact lines for a node, instead of whole files |
| `gitlas_repos` | Which graphs exist and how far behind HEAD each one is |
Every answer says which commit it was built from, and a query never waits for a rebuild.
Replace graphify's own MCP server with this one rather than running both.
**Several repositories.** Register each one; with more than one, calls that do not pass
`repo=` span all of them. `gitlas deps` shows which repo depends on which - read from the
package manifests and import statements, with the file and line that proves it - and
`gitlas_impact("validate_token")` follows callers into the repos that import it.
From Python - no MCP process needed:
```python
from gitlas.surfaces.sdk import Gitlas
g = Gitlas()
print(g.pack("how are tokens validated").render())
print(g.trace("REQ-1").render())
print(g.impact("working-tree").render())
```
LangChain / LangGraph (`pip install "gitlas[langchain]"`):
```python
from gitlas.surfaces.frameworks import as_langchain_tools
agent = create_react_agent(model, as_langchain_tools())
```
## Design principles
- **Deterministic before clever.** Traceability edges come from explicit references and
structural joins first. LLM-proposed links are written to a review file for a human to
accept — never straight into the graph. In one study, bad relationship modelling caused
[123 of 164 wrong answers](https://arxiv.org/pdf/2601.08773).
- **Every inferred edge carries its evidence.** An edge you cannot check is a bug.
- **A small tool surface.** MCP tool definitions are re-sent every turn; a token-reduction
tool with a bloated surface defeats itself.
- **Honest measurement.** See [`CONTEXT.md`](CONTEXT.md) §5 for the current benchmark state.
Architecture of record: [`CONTEXT.md`](CONTEXT.md).
## License
Apache-2.0.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues