How ctx| works
End-to-end flow from repository connection to agent context via MCP.
ctx| is built as a multi-tenant system: users belong to organisations, and
almost every resource (repositories, conversations, API access) is scoped to one
org. The browser UI uses org slugs in the path (/:orgSlug/...); MCP calls pass
orgSlug as a query parameter on /mcp.
1. Connect sources
You add repositories by Git URL from the dashboard (or via GitHub App installation flows for GitHub-hosted code). The backend records the repo under your organisation and triggers ingestion workflows (OpenWorkflow) that:
- Resolve the ref to clone (branch / commit),
- Coordinate with the codesearch service to clone and Zoekt-index the tree,
- Progress code ingestion LangGraph pipelines that extract structured claims (services, APIs, dependencies, patterns, and more) into your graph database (OpenCypher-compatible, FalkorDB by default in Compose).
Search and file reads for agents go through that index; graph-backed reasoning uses the extracted model plus embeddings where configured.
2. Instruction hierarchy
Alongside code, agents benefit from how your org wants to work: repo-level
AGENTS.md, skills, ADRs, and similar artefacts. When you use ctx_advisor
over MCP, prompts are routed through a chat graph that is designed to respect
that hierarchy and synthesise answers aligned with your standards — not just raw
search hits.
3. Agent access (MCP)
Agents do not get a second bespoke API for “graph queries” in the quick path:
they connect to one MCP endpoint (/mcp?orgSlug=...) using a Bearer API
key or OAuth (ctx| acts as an OAuth 2.0 authorisation server). Transport
is Streamable HTTP (stateless HTTP POSTs per tool call).
The main tool is ctx_advisor: one string prompt in, streamed progress
optional, natural-language answer out — backed by your org’s context.
4. Self-hosting parity
The same components exist in the open-source repo: backend (Hono on Bun, REST
- MCP + workflows), UI (TanStack Start), codesearch (Zoekt orchestration), worker, Postgres, and graph DB. See Self hosting for compose profiles, env vars, and operations.
For REST details beyond these guides, the backend serves OpenAPI at
/.docs/openapi and a Scalar UI at /.docs/api-reference on your deployment
base URL.