Skip to main content

Mimir — Context Server: intelligent code context engine for LLMs working with large, multi-repo codebases

Project description

Mimir — Context Server

In Norse mythology, Mimir was the wisest being in all the Nine Realms — guardian of the Well of Wisdom beneath Yggdrasil, the World Tree. Odin sacrificed his eye for a single drink from that well. Mimir brings that same depth of knowledge to your codebase.

PyPI Python PyPI - Client License: MIT

Mimir is an intelligent context engine that helps LLMs understand large, multi-repo codebases. Instead of dumping raw files into a prompt, Mimir builds a semantic code graph with real cross-file dependency edges, ranks nodes by relevance and recency, and assembles a minimal, connected, token-budget-aware context bundle — exactly what the model needs, nothing it doesn't.


The Problem

When you ask Claude or GPT to help with a large codebase, you face a brutal choice:

  • Too little context — the model hallucinates or misses related code
  • Too much context — you burn tokens on irrelevant files and hit limits
  • Copy-paste — fragile, manual, doesn't scale across repos

The Solution

Mimir indexes your code into a hierarchical graph of repositories, files, classes, and functions. Cross-file dependencies — function calls, type references, inheritance hierarchies — are resolved into typed edges. At query time, a hybrid search finds seed nodes and a beam search assembles the tightest connected subgraph that answers your question — within your token budget.


Key Features

  • Hierarchical beam search — finds connected code paths, not isolated snippets
  • Cross-file symbol resolution — automatically discovers CALLS, USES_TYPE, and INHERITS edges across files using tree-sitter AST analysis
  • Hybrid search — combines semantic embeddings, BM25 keyword matching, and name/path scoring for precise retrieval
  • Live file watching — monitors your repos for changes and re-indexes on every save
  • Query intent classification — automatically detects query type (locate, trace, write, debug) and tunes retrieval parameters
  • Subgraph expansion — automatically surfaces callers, callees, type definitions, and config references
  • Connectivity quality scoring — nodes scored by edge density, embedding presence, and content completeness; gap detection identifies under-indexed areas
  • Temporal reranking — recently and frequently changed code scores higher
  • Session deduplication — exponential decay model tracks what the LLM remembers
  • Write-path context — shows interfaces, sibling implementations, test files, and DI registrations before you edit
  • Impact analysis — reverse-traces callers and transitive dependencies to show blast radius
  • Architectural guardrails — validates AI-generated changes against structural rules (layer violations, cycles, coupling, blast radius, scope bans) before commit, with agent policy for bounded autonomy and audit logging
  • Backstage catalog integration — auto-populates service catalogs from the code graph with dependency drift detection
  • Multi-repo — single server spans multiple repositories with cross-repo edge detection
  • MCP server — plug-and-play with Claude Desktop, Cursor, and any MCP-compatible IDE
  • HTTP API — shared team server for enterprise environments
  • Docker-ready — zero Python setup, embedding model pre-baked
  • 100% offline — local embeddings, no API keys required for indexing

Quick Start

pip install mimir-context-server
cd /your/project
mimir init          # creates mimir.toml
mimir index         # builds the semantic code graph
mimir search "how does authentication work?"
mimir serve         # start MCP server for your IDE

# Architectural guardrails
mimir guardrail init                          # generate example rules + agent policy
git diff | mimir guardrail check --diff -     # validate changes before committing

Installation

Package Install Who needs it
mimir-context-server pipx install mimir-context-server Server operators — devs who index repos and run the server
mimir-server-client pipx install mimir-server-client Client devs — devs who query a remote server without repos locally
# Server (full install)
pipx install mimir-context-server

# Client only (lightweight)
pipx install mimir-server-client

# From source
git clone https://github.com/repfly/mimir && cd mimir
pip install -e .

Documentation

Topic Description
Configuration mimir.toml reference with all sections and keys
How It Works Indexing pipeline, retrieval pipeline, session dedup, incremental indexing, live watching, quality scoring
Serving Modes Local MCP, shared HTTP server, remote proxy, MCP tools, HTTP API reference
Docker Deployment Build, run, Compose, entrypoint modes, environment variables
Workspaces Per-project isolation and workspace management
Web Inspector Browser-based graph visualization
Backstage Integration Auto-discovered service catalog and dependency drift detection
Architectural Guardrails Rule types, agent policy, enforcement points, audit logging
CLI Reference Full command reference for mimir and mimir-client
Architecture Hexagonal architecture, project structure, data storage, supported languages
Contributing Development setup, testing, PyPI publishing

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mimir_context_server-1.1.3.tar.gz (5.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mimir_context_server-1.1.3-py3-none-any.whl (160.0 kB view details)

Uploaded Python 3

File details

Details for the file mimir_context_server-1.1.3.tar.gz.

File metadata

  • Download URL: mimir_context_server-1.1.3.tar.gz
  • Upload date:
  • Size: 5.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mimir_context_server-1.1.3.tar.gz
Algorithm Hash digest
SHA256 89fca914733006e4563c34ef39ffa18dbff4395110acabd7c7952b2f1f5cf959
MD5 ca8d0d40b973df7ae46b8014b523ae6b
BLAKE2b-256 c29b91a408652461e015069aa5a02aa46f9ca6d21756b335bed6762a254b1b64

See more details on using hashes here.

Provenance

The following attestation bundles were made for mimir_context_server-1.1.3.tar.gz:

Publisher: publish.yml on repfly/mimir-context-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mimir_context_server-1.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for mimir_context_server-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 db3b610ee5dcb406f65549bb54afb125ca7a0e04a4834a0380cf48c8445cf74d
MD5 f918d7838ad64300e1dbd63801c4db70
BLAKE2b-256 ec8a6b92d512bc788d314b457cd8131d941567d1f83aa958bb17e86a2c4498d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for mimir_context_server-1.1.3-py3-none-any.whl:

Publisher: publish.yml on repfly/mimir-context-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page