Sandbox
@EtienneChollet/ontomics

MCP server for codebase domain knowledge

ontomics builds a semantic index of a repo’s concepts, conventions, and behavior, then serves that index through MCP. It parses source with tree-sitter, clusters concepts and logic with embeddings, and stores the result locally for fast repeated use.

41 stars9 forksRustUpdated 5mo ago
Who it's for

Builders who want their agent to query concepts, naming patterns, and similar logic inside a codebase.

What it delivers

You can answer domain questions about a repo with one agent tool call instead of a long search trail.

What it does

Concept and vocabulary queries

Find concepts, related terms, abbreviations, naming patterns, and where each one appears with tools like `query_concept`, `list_concepts`, and `list_conventions`.

Logic similarity search

Compare function bodies by behavior with `find_similar_logic` and `describe_logic` to surface duplicated or related implementations.

Codebase structure views

Inspect files, entity maps, and type flow with `describe_file`, `concept_map`, `type_flows`, and `trace_type`.

Portable domain packs

Export repo knowledge as YAML with `export_domain_pack` so conventions can be reused in other projects.

Local index and cache

Builds and stores the index in `<repo>/.ontomics/index.db`, then reloads it locally on later runs.

How to get it

  1. 1npm (macOS/Linux)
    npm install -g @ontomics/ontomics
  2. 2macOS (Homebrew)
    brew install EtienneChollet/tap/ontomics
  3. 3Shell installer (macOS/Linux)
    curl --proto '=https' --tlsv1.2 -LsSf https://github.com/EtienneChollet/ontomics/releases/latest/download/ontomics-installer.sh | sh
  4. 4From source
    git clone https://github.com/EtienneChollet/ontomics.git
    cd ontomics
    cargo build --release
  5. 5Claude Code
    claude mcp add -s user ontomics -- ontomics
  6. 6Codex
    codex mcp add ontomics -- ontomics

README

ontomics

Python Rust TypeScript JavaScript platform MCP MCP Registry Glama Claude Code Codex pi

ontomics gives any coding agent instant knowledge of your codebase. One tool call instead of 19. ~20x fewer tokens.

https://github.com/user-attachments/assets/01afa8a0-1bc2-4686-94d7-965fef7610c3

Visualization for the voxelmorph project -- a library for unsupervised learning in image registration

Benchmark

Tested with Claude Sonnet — same question, with and without ontomics.

"What does 'transform' mean in this codebase?" on voxelmorph (full transcript):

With ontomicsWithout
Tool calls119
Tokens~3.7k~76k
Time5s1m 15s
Answer qualityCompleteComplete

"What are the main domain concepts in this codebase?" on ScribblePrompt (full transcript):

With ontomicsWithout
Tool calls126
Tokens~3.7k~61.6k
Time~5s56s
Answer qualityCompleteComplete

Both conditions produced complete, correct answers. ontomics got there in one call.

What it does that search can't

Search tells you where a string appears. An LSP tells you where a symbol is defined and referenced. Neither answers: what are the domain concepts in this codebase? How do they relate? What naming conventions emerged? What changed in the domain vocabulary since last release? Which functions behave similarly, regardless of what they're named?

ontomics builds a semantic index of your project's domain — clustering related symbols into concepts, detecting naming conventions from usage frequency, resolving abbreviations, grouping functions by behavioral similarity, and tracking how the vocabulary evolves over time. That index can be exported as a portable artifact to bootstrap conventions in other repos.

Behavioral similarity

Beyond naming and concepts, ontomics embeds raw function bodies using CodeRankEmbed (768-dim, contrastive code retrieval) and clusters them by behavioral similarity. This surfaces relationships that neither naming nor call graphs expose:

❯ What functions behave like spatial_transform()?

  random_transform()   nn/functional.py:352   0.80
  spatial_transform()  functional.py:596      0.69
  random_transform()   functional.py:1399     0.67
  random_disp()        nn/functional.py:275   0.65
  integrate_disp()     functional.py:764      0.65
  compose()            nn/functional.py:216   0.63
  disp_to_trf()        functional.py:343      0.62

The result also reveals that random_transform appears at two locations with different similarity scores — a sign of implementation duplication that concept-level search would miss entirely.

Install

Install once, available in every project. No configuration needed — ontomics auto-detects the repo and indexes it on first run.

ontomics requires a git repository (.git/ directory). It will refuse to index home, root, or temp directories. To index a non-git directory, pass --force.

1. Install the binary

npm (macOS/Linux):

npm install -g @ontomics/ontomics

macOS (Homebrew):

brew install EtienneChollet/tap/ontomics

Shell installer (macOS/Linux):

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/EtienneChollet/ontomics/releases/latest/download/ontomics-installer.sh | sh

From source:

git clone https://github.com/EtienneChollet/ontomics.git
cd ontomics
cargo build --release

2. Register with your harness

Claude Code:

claude mcp add -s user ontomics -- ontomics

Codex:

codex mcp add ontomics -- ontomics

OpenClaw:

openclaw mcp set ontomics '{"command":"ontomics"}'

pi-coding-agent:

pi install npm:@ontomics/ontomics

Share with your team — drop an .mcp.json in your repo root:

{
  "mcpServers": {
    "ontomics": {
      "command": "npx",
      "args": ["-y", "@ontomics/ontomics", "--repo", "."]
    }
  }
}

Supported languages

Python, TypeScript, JavaScript, Rust. Auto-detected from file extensions.

Tools

Concepts and vocabulary

ToolWhat it does
query_conceptFind all variants, related concepts, and occurrences of a term
locate_conceptFind the key signatures, classes, and files for a concept
describe_symbolGet the signature, docstring, and relationships for a function or class
trace_conceptTrace how a concept flows through the codebase via call chains
list_conceptsList the top domain concepts by frequency
list_conventionsList all detected naming patterns (prefixes, suffixes, conversions)
list_entitiesList code entities (classes, functions) filtered by concept, role, or kind
check_namingCheck an identifier against project conventions; suggests the canonical form
suggest_nameGenerate an identifier name that fits the project's vocabulary
vocabulary_healthMeasure convention coverage, naming consistency, and cluster cohesion
ontology_diffShow new, changed, or removed domain concepts since a git ref
export_domain_packExport domain knowledge as portable YAML for use in other repos

Behavioral similarity

ToolWhat it does
find_similar_logicFind functions with behaviorally similar implementations, ranked by embedding similarity
describe_logicGet the behavioral description, body text, and logic cluster membership for a function
compact_contextAssemble tiered context (concepts + logic) for a symbol, optimized for LLM consumption

Codebase structure

ToolWhat it does
describe_fileOverview of a file's entities, concepts, and relationships
concept_mapShow which modules contain which domain concepts
type_flowsShow dominant types and how data flows through the codebase
trace_typeTrace how a specific type propagates across files and call sites

Resources

ResourceWhat it does
ontomics://briefingSession briefing: top conventions, abbreviations, key concepts, contrastive pairs, and vocabulary warnings. Also available via ontomics briefing CLI.

How it works

ontomics runs a multi-stage pipeline entirely on your machine — no API keys required:

  1. Parse — tree-sitter extracts every identifier, signature, and call site from your source files
  2. Analyze — TF-IDF scoring identifies domain-specific concepts and detects naming conventions
  3. Embed (concepts) — BGE-small (384-dim) clusters related concepts by semantic similarity
  4. Embed (logic) — CodeRankEmbed (768-dim) embeds raw function bodies and clusters them by behavioral similarity
  5. Centrality — PageRank scores entities by structural importance

Both embedding models are downloaded once on first run and cached locally. The index lives at <repo>/.ontomics/index.db — subsequent startups load from cache and watch for file changes.

Configuration via .ontomics/config.toml in the repo root. All fields have sensible defaults. See SPEC.md for the full design contract.

Files in the repo

Repository payload18 top-level entries
  • .github
  • benchmarks
  • doc
  • pi
  • src
  • tests
  • .gitignore
  • build.rs
  • Cargo.lock
  • Cargo.toml
  • CLAUDE.md
  • CONTRIBUTING.md
  • dist-workspace.toml
  • glama.json
  • install.sh
  • LICENSE
  • README.md
  • server.json

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface

86k

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
tirth8205/
code-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

31k
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k