ontology-rag-mcp
Allows ingesting and analyzing GitHub repositories to build a searchable code ontology with REST request flows.
Provides tools to analyze and query Spring Boot microservices, including REST endpoints, call chains, and dependencies.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ontology-rag-mcpwalk me through what happens when a user places an order"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π§ ontology-rag-mcp
A generic code ontology platform that ingests Spring Boot REST microservice codebases from GitHub, indexes them into Apache Solr, builds a REST request-flow ontology + relationship graph, and serves it through a Model Context Protocol (MCP) server β so any MCP client (Cursor, Claude, etc.) can ask natural-language questions about the code and get accurate, flow-aware answers with citations.
π Table of Contents
Related MCP server: Axon.MCP.Server
π Overview
ontology-rag-mcp turns a GitHub repository into a queryable knowledge layer β not just semantic search, but an understanding of:
REST endpoints (
@GetMapping,@PostMapping, etc.)Request flows behind each endpoint (Controller β Service β Repository)
Service relationships and cross-service calls (
@FeignClient,RestTemplate,WebClient)Configuration files, README/docs, and OpenAPI specs linked to the code they describe
How is this different from plain RAG?
Plain RAG | ontology-rag-mcp |
Chunks code by text similarity | Builds a request-flow ontology per endpoint |
Returns similar-looking snippets | Returns ordered call chains with Mermaid diagrams |
No graph awareness | Persists |
Needs an LLM to answer | Works fully offline with retrieval-only mode |
Tied to one vector DB | Uses only Solr 9 (BM25 + dense vector kNN) |
The whole point: any MCP client can ask "walk me through what happens when a user places an order" and get the real ControllerβServiceβRepository chain β even when the query names no class or method.
β¨ Key Features
Feature | Description |
REST Flow Ontology | Per-endpoint call graph: Controller β Service β Repository β external calls |
Hybrid Retrieval | Solr BM25 + dense vector kNN fused with Reciprocal Rank Fusion (RRF) |
Flow-Aware Search | Intent routing + flow-doc seeding for vague "how does X work" questions |
10 MCP Tools | Typed DTOs β |
Offline Embeddings |
|
Optional LLM | OpenAI-compatible endpoint for narrative summaries (Ollama, Azure, vLLM, etc.) |
Incremental Indexing | Commit SHA tracking β re-runs only re-index changed files |
Pluggable Providers | Local defaults + optional GitHub/Jenkins/SSH MCP adapters |
Docker Compose |
|
Spring Boot First | Parses |
π Hard Constraints
These are architectural invariants β the platform is designed around them:
Constraint | Implementation |
Retrieval stack | Apache Solr 9.x only (BM25 + dense vector kNN). No Pinecone/Weaviate/Chroma/Neo4j. Graph is in-memory, persisted as Solr fields. |
Source of code | Git/GitHub only (public repos or private via |
Target codebases | REST Spring Boot microservices (Java, Maven/Gradle). Parser is pluggable for future languages. |
Embeddings | Local/offline by default ( |
LLM | Optional. System fully functions with |
Configuration | Everything via environment variables. Secrets never committed. |
Core reproducibility | Any developer can run with just |
π Architecture
Local Path (git + docker)
The default path β no external MCP servers required. Fully reproducible from a public GitHub clone.
flowchart TB
subgraph source [Source]
GitHub[GitHub Repo] --> GitClone[GitPython Shallow Clone]
ReposYml[repos.yml] --> GitClone
end
subgraph parse [Parse & Ontology]
GitClone --> JavaParser[javalang Java Parser]
JavaParser --> ClassDocs[class / method / endpoint docs]
JavaParser --> FlowBuilder[Flow Ontology Builder]
FlowBuilder --> FlowDocs[flow docs + Mermaid]
FlowBuilder --> GraphEdges[callsOut / calledBy edges]
end
subgraph solr [Solr 9]
ClassDocs --> RawCol[product-raw collection]
FlowDocs --> RawCol
GraphEdges --> RawCol
RawCol --> Embed[Local Embeddings bge-small-en-v1.5]
Embed --> RAGCol[product-rag collection]
end
subgraph serve [Serving]
RAGCol --> Retrieval[Hybrid Retrieval BM25 + kNN + RRF]
Retrieval --> Intent[Intent Classifier]
Intent --> MCP[FastMCP Server]
MCP --> Client[Cursor / Claude / any MCP client]
endβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AI IDE (MCP Client) β
β Cursor / Claude Desktop / VS Code β
ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββ
β HTTP (streamable-http) or stdio
ββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββ
β MCP Server (ontology-rag serve) β
β 10 tools Β· FastMCP + Python β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββββββββββ β
β β Retriever β β Intent β β LLM Client (optional) β β
β β BM25+kNN β β Classifier β β OpenAI-compatible β β
β ββββββββ¬ββββββββ ββββββββββββββββ ββββββββββββββββββββββββββββ β
βββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Apache Solr 9.x β
β βββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββ β
β β {product}-raw βββββΆβ {product}-rag β β
β β (source of truth) β β (+ 384-dim embedding vectors) β β
β βββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββHeadless Path (GitHub β Jenkins β SSH)
Optional adapters for zero-manual-step deployment. The core platform does not depend on these β they degrade to local defaults when absent.
sequenceDiagram
participant Agent as Cursor Agent
participant Jenkins as Jenkins MCP
participant Platform as ontology-rag-mcp
participant GitHub as GitHub MCP
participant SSH as Linux SSH MCP
participant Target as Target Linux Host
Agent->>Jenkins: trigger ontology-rag-onboard
Note over Jenkins: Params: REPOS, BRANCH, PRODUCT, TARGET_HOST
Jenkins->>Platform: checkout-platform
Platform->>GitHub: fetch source + record commit SHA
GitHub-->>Platform: file tree + metadata
Platform->>Platform: parse + index + build flow ontology
Platform->>Platform: embed into Solr
Jenkins->>SSH: deploy-mcp to TARGET_HOST
SSH->>Target: sync code, create venv, start MCP on free port
SSH->>Target: health-check + tail logs
Jenkins-->>Agent: {"petclinic-ontology": {"url": "http://host:port/mcp"}}Stage | What Happens |
| Clone ontology-rag-mcp, install deps |
| GitHub MCP (or GitPython) fetches repos, records SHA |
| Java parser β Solr raw collection |
| Endpoint extraction, call graph, flow docs |
| Local embeddings β Solr serving collection |
| SSH MCP starts MCP server on target host |
| Health-check + print |
π¦ Prerequisites
For Docker Compose (recommended)
Requirement | Version | Verify |
Docker | 20.10+ |
|
Docker Compose | v2+ |
|
Git | any |
|
For local development
Requirement | Version | Verify |
Python | 3.11+ |
|
Git | any |
|
Apache Solr 9 | 9.x | via Docker, or |
First ingest downloads ~130 MB for the embedding model (
BAAI/bge-small-en-v1.5). Subsequent runs use the cached model.
π Quickstart
Option 1: Docker Compose (Recommended)
# 1. Clone and configure
cd C:\AI_Workspaces\Anti_Workspace\ontology-rag-mcp
copy .env.example .env
# 2. Start Solr + MCP server
docker compose up -d
# 3. Wait for Solr to be healthy (~30s), then ingest the sample repo
docker compose exec app ontology-rag ingest
# 4. One-shot RAG query
docker compose exec app ontology-rag ask "What REST endpoints does this expose?"
# 5. MCP server is already running β check startup logs for mcp.json snippet
docker compose logs appThe default sample repo is spring-projects/spring-petclinic (configured in repos.yml).
Expected ingest output:
=== Ingesting petclinic ===
Cloning https://github.com/spring-projects/spring-petclinic (branch=main)
Indexing 150+ documents into petclinic-raw
Embedding 150+ documents
Ingest complete: {'repos': 1, 'files': 80, 'docs': 150, 'embedded': 150}Option 2: Local Development
cd C:\AI_Workspaces\Anti_Workspace\ontology-rag-mcp
# Create virtual environment
python -m venv .venv
.venv\Scripts\Activate.ps1
# Install
pip install -e ".[dev]"
# Copy config
copy .env.example .env
# Start Solr separately (or use docker compose up solr -d)
docker compose up solr -d
# Ingest
ontology-rag ingest
# Start MCP server
ontology-rag serveOn startup, the server prints a ready-to-paste mcp.json snippet:
{
"ontology-rag": {
"url": "http://localhost:8765/mcp"
}
}π Configuring Your AI IDE
ontology-rag-mcp supports two MCP transports:
Transport | Use Case | Config Style |
| Docker / remote deploy | URL-based |
| Local dev without HTTP | Command-based |
Set MCP_TRANSPORT=streamable-http or MCP_TRANSPORT=stdio in .env.
1. π± Cursor
Streamable HTTP (Docker / deployed server)
Create .cursor/mcp.json in your project (or ~/.cursor/mcp.json globally):
{
"mcpServers": {
"ontology-rag": {
"url": "http://localhost:8765/mcp"
}
}
}The server prints this snippet on startup when you run
ontology-rag serve.
stdio (local development)
{
"mcpServers": {
"ontology-rag": {
"command": "ontology-rag",
"args": ["serve"],
"env": {
"MCP_TRANSPORT": "stdio",
"SOLR_BASE_URL": "http://localhost:8983/solr",
"RAG_PRODUCT": "petclinic"
}
}
}
}Verifying in Cursor
Open Settings β MCP (or
Ctrl+Shift+Pβ "MCP")Look for
ontology-ragwith a green status indicatorTry: "What REST endpoints does this expose?"
The agent should call
find_rest_endpointsand return cited routes
2. π€ Claude Desktop
Configuration File Location
OS | Path |
Windows |
|
macOS |
|
Streamable HTTP
{
"mcpServers": {
"ontology-rag": {
"url": "http://localhost:8765/mcp"
}
}
}stdio
{
"mcpServers": {
"ontology-rag": {
"command": "ontology-rag",
"args": ["serve"],
"env": {
"MCP_TRANSPORT": "stdio",
"SOLR_BASE_URL": "http://localhost:8983/solr",
"RAG_PRODUCT": "petclinic"
}
}
}
}Restart Claude Desktop after saving. Look for the tools icon in the chat input.
3. π» VS Code with Continue / Cline
Add to .continue/config.json or Cline MCP settings:
{
"mcpServers": {
"ontology-rag": {
"url": "http://localhost:8765/mcp"
}
}
}β‘ How It Works
Ingestion Pipeline
repos.yml / CLI --repos
β
βΌ
βββββββββββββββββββββ
β Source Provider β SOURCE_PROVIDER=local β GitPython shallow clone
β β SOURCE_PROVIDER=github β GitHub MCP (falls back to git)
ββββββββββ¬βββββββββββ
β Records commit SHA for incremental re-runs
βΌ
βββββββββββββββββββββ
β File Curation β Skips: target/, build/, .git/, node_modules/,
β β *.class, *.jar, /test/, generated-sources/
ββββββββββ¬βββββββββββ
βΌ
βββββββββββββββββββββ
β Java Parser β javalang β class-level docs (+ optional method chunks)
β (javalang) β Also: application.yml, README, OpenAPI specs
ββββββββββ¬βββββββββββ
βΌ
βββββββββββββββββββββ
β Flow Ontology β Endpoint extraction, call graph, flow docs + Mermaid
β Builder β Cross-service: @FeignClient, RestTemplate, WebClient
ββββββββββ¬βββββββββββ
βΌ
βββββββββββββββββββββ
β Solr Raw Index β {product}-raw β source of truth, no vectors
ββββββββββ¬βββββββββββ
βΌ
βββββββββββββββββββββ
β Embed Pipeline β BAAI/bge-small-en-v1.5 β {product}-rag collection
β β Optional LLM summaries if LLM_ENABLED=true
βββββββββββββββββββββChunk types indexed:
| Description |
| One doc per Java class (package, annotations, methods, dependencies) |
| Per-method chunk (when |
| REST route: HTTP method, path, controller#method, request/response types |
| Ordered request flow for an endpoint + Mermaid sequence diagram |
|
|
| README, markdown, OpenAPI/Swagger specs |
REST Flow Ontology
For every @RestController method with an HTTP mapping, the platform:
Extracts the endpoint β class-level
@RequestMappingprefix + method@GetMappingetc.Resolves dependencies β
@Autowiredfields, constructor injection,@QualifierTraces the call chain β Controller β Service(s) β Repository / external call (bounded depth, cycle-safe)
Detects cross-service calls β
@FeignClientinterfaces,RestTemplate/WebClientusagePersists as Solr fields β
callsOut,calledBy,flowName,httpMethod,routeLinks docs to code β README/OpenAPI chunks inherit flows from mentioned class/endpoint names
Example flow doc for POST /api/orders:
1. [controller] com.example.OrderController#createOrder
2. [service] com.example.OrderService#createOrder
3. [repository] com.example.OrderRepository#savePlus a Mermaid sequence diagram:
sequenceDiagram
participant Client
participant OrderController as OrderController
participant OrderService as OrderService
participant OrderRepository as OrderRepository
Client->>OrderController: POST /api/orders
OrderController->>OrderService: createOrder
OrderService->>OrderRepository: saveHybrid Retrieval
User query
β
βΌ
βββββββββββββββββββββββ
β Intent Classifier β regex-based (no LLM): flow / endpoint / class / config / default
ββββββββββ¬βββββββββββββ
βΌ
βββββββββββββββββββββββ βββββββββββββββββββββββ
β Solr BM25 (edismax)β β Solr kNN (384-dim) β
β field boosts per β β cosine similarity β
β intent profile β β β
ββββββββββ¬βββββββββββββ ββββββββββ¬βββββββββββββ
β β
βββββββββββββ¬ββββββββββββββββ
βΌ
βββββββββββββββββββββββββ
β RRF Fusion β
βββββββββββββ¬ββββββββββββ
βΌ
βββββββββββββββββββββββββ
β Quality Levers β
β Β· down-rank gettersβ
β Β· MMR diversity β
β Β· adaptive rerank β
β Β· flow-doc seeding β
β Β· call-graph fusionβ
βββββββββββββ¬ββββββββββββ
βΌ
Shaped results with citations
(file path + line range + FQN)Flow-doc seeding (important): when intent is flow and no flow/endpoint doc is in the top results, the retriever runs an extra chunkType-restricted kNN and injects the best-matching flow doc β so anchorless questions like "walk me through what happens when a user places an order" surface the real endpoint flow.
Incremental Indexing
Each repo's latest commit SHA is persisted in .ingest-cache/commit_shas.json.
Scenario | Behavior |
Re-run with no new commits | SHA unchanged β incremental no-op for changed files |
Re-run after new commit | Only changed files (added/modified/deleted) are re-indexed |
Full rebuild | Delete |
π₯ CLI Reference
ontology-rag ingest [--repos URL1,URL2] [--branch main]
ontology-rag serve
ontology-rag ask "your question here"Command | Description |
| Fetch β parse β index β build flow ontology β embed. Reads |
| Start MCP server (streamable HTTP or stdio). Prints |
| One-shot hybrid RAG query with citations (demo / debugging). |
Examples:
# Ingest a specific repo
ontology-rag ingest --repos https://github.com/spring-projects/spring-petclinic --branch main
# Ingest multiple repos (microservices)
ontology-rag ingest --repos https://github.com/org/order-service,https://github.com/org/payment-service
# Ask a flow question
ontology-rag ask "Walk me through what happens when a user creates an order"
# Ask about cross-service calls
ontology-rag ask "Which service calls the payment service?"π Environment Variables
All configuration is via environment variables. Copy .env.example to .env and adjust.
Provider Selection
Variable | Required | Default | Description |
| No |
|
|
| No |
|
|
| No |
|
|
Solr
Variable | Required | Default | Description |
| No |
| Solr base URL (no trailing collection name). |
| No |
| Host port for Solr container. |
| No |
| Collection prefix. Creates |
| No | (auto) | Override serving collection name. Defaults to |
Embeddings
Variable | Required | Default | Description |
| No |
| Local sentence-transformers model. |
| No |
| Vector dimension (must match model). |
| No |
| Enable cross-encoder reranking ( |
| No |
| Reranker model name. |
Retrieval Feature Flags
Variable | Required | Default | Description |
| No |
| Also index per-method chunks (in addition to class-level). |
| No |
| Inject flow/endpoint doc for vague flow questions. |
| No |
| Maximal Marginal Relevance diversity (cap chunks per class). |
| No |
| Comma-separated file/path patterns to skip during ingest. |
LLM (Optional)
Variable | Required | Default | Description |
| No |
| Enable LLM for answer synthesis and domain summaries. |
| No |
| OpenAI-compatible API base URL. |
| No |
| Model name for chat completions. |
| No | β | API key (OpenAI, Azure, etc.). Not needed for Ollama. |
The system fully functions with
LLM_ENABLED=false. Retrieval, MCP tools, and CLIaskall work without an LLM. Enabling an LLM adds narrative summaries on top.
MCP Server
Variable | Required | Default | Description |
| No |
| Bind address for HTTP transport. |
| No |
| Port for streamable HTTP transport. |
| No |
|
|
Ingestion
Variable | Required | Default | Description |
| No |
| Git clone cache + commit SHA store. |
| No |
| Path to repos configuration file. |
| No | β | Enables private repo access. Never commit this value. |
SSH Deploy (DEPLOY_PROVIDER=ssh)
Variable | Required | Default | Description |
| Yes* | β | Target Linux host for remote MCP deploy. |
| Yes* | β | SSH username. |
| No | β | SSH password (or use key). |
| No | β | Path to SSH private key. |
| No |
| SSH port. |
Jenkins Orchestrator (ORCHESTRATOR=jenkins)
Variable | Required | Default | Description |
| Yes* | β | Jenkins server URL. |
| Yes* | β | Jenkins username. |
| Yes* | β | Jenkins API token. |
| No |
| Pipeline job name. |
π Complete MCP Tool Reference
All tools return typed, clean DTOs β not raw Solr fragments. Every result includes citations (file path, line range, FQN) where available.
π§ rag_search
Hybrid semantic + keyword search with citations and optional LLM synthesis.
Parameter | Type | Required | Default | Description |
|
| Yes | β | Natural-language search query. |
|
| No |
| Number of results to return. |
|
| No |
|
|
Returns: query, intent, total, hits[] (with citations), context_block, answer (LLM synthesis if enabled, else context).
Examples:
"Explain the OrderService class"
"How is authentication configured?"
"walk me through what happens when a user places an order"π§ find_rest_endpoints
List REST endpoints with method, route, controller, and flow name.
Parameter | Type | Required | Default | Description |
|
| No |
| Free-text search within endpoints. |
|
| No |
| Filter by HTTP method (e.g., |
|
| No |
| Filter routes containing this substring. |
Returns: List of EndpointInfo β http_method, route, controller, method_name, flow_name, module.
Examples:
find_rest_endpoints()
find_rest_endpoints(http_method="POST")
find_rest_endpoints(path_contains="/orders")π§ flow_of
Return the ordered request flow for an endpoint or class, with a Mermaid sequence diagram.
Parameter | Type | Required | Default | Description |
|
| Yes | β | Route (e.g., |
Returns: FlowResult β name, endpoint, http_method, steps[] (ordered layers), mermaid (diagram string), cross_service[].
Examples:
flow_of("/api/orders")
flow_of("OrderController")
flow_of("POST /api/orders")π§ callers_of
Inbound call edges β who calls this class or method.
Parameter | Type | Required | Default | Description |
|
| Yes | β | Class name, FQN, or |
Returns: List of caller symbol strings.
Example:
callers_of("PaymentService")
callers_of("OrderService#createOrder")π§ uses_of
Outbound call edges β what this class or method calls.
Parameter | Type | Required | Default | Description |
|
| Yes | β | Class name, FQN, or |
Returns: List of callee symbol strings (includes Feign/RestTemplate targets).
Example:
uses_of("OrderController")
uses_of("PaymentService#processPayment")π§ find_services
List @Service beans with summaries. Optional query filter.
Parameter | Type | Required | Default | Description |
|
| No |
| Filter services by name or description. |
Returns: List of service class docs with annotations, dependencies, and summaries.
π§ get_class
Fetch a specific Java class by simple name or fully-qualified name.
Parameter | Type | Required | Default | Description |
|
| Yes | β | Class name (e.g., |
Returns: Class doc with methods, annotations, dependencies, callsOut/calledBy edges, and citation.
π§ get_file
Fetch all indexed chunks for a file path.
Parameter | Type | Required | Default | Description |
|
| Yes | β | File path as indexed (e.g., |
Returns: List of all chunks (class, method, etc.) for that file.
π§ list_services
Inventory of all @Service beans in the indexed codebase.
Parameter | Type | Required | Default | Description |
(none) | β | β | β | Takes no parameters. |
Returns: List of all service class docs.
π§ stats
Index statistics β doc counts, chunk types, modules.
Parameter | Type | Required | Default | Description |
(none) | β | β | β | Takes no parameters. |
Returns: product, raw_collection, serving_collection, total_docs, by_chunk_type, modules[].
π Pluggable Providers
The platform core is fully runnable with just git + docker compose. Three concerns are behind clean provider interfaces β each with a built-in default and an optional MCP adapter.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ontology-rag-mcp CORE β
β (always works: git + docker compose + CLI) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββ ββββββββββββββββ βββββββββββββββββββββ β
β β SOURCE β β ORCHESTRATOR β β DEPLOY β β
β β PROVIDER β β β β PROVIDER β β
β βββββββββββββββ€ ββββββββββββββββ€ βββββββββββββββββββββ€ β
β β local (git) β β local (CLI) β β docker (compose) β β
β β github (MCP)β β jenkins (MCP)β β ssh (MCP) β β
β βββββββββββββββ ββββββββββββββββ βββββββββββββββββββββ β
β β optional β optional β optional β
β GitHub MCP Jenkins MCP Linux SSH MCP β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββConcern | Env Var | Default | MCP Adapter | Degrades To |
Source |
|
|
| GitPython clone |
Orchestration |
|
|
| CLI commands |
Deploy |
|
|
| docker compose |
MCP adapters are first-class optional integrations, not core dependencies. They are used (a) as agents during development/testing and (b) for headless "GitHub URL + target host β live MCP URL" workflows.
Configuring repos (repos.yml)
repos:
- url: https://github.com/spring-projects/spring-petclinic
branch: main
name: petclinic
- url: https://github.com/your-org/order-service
branch: main
name: orders
subpath: order-service # optional: index only this subdirectory
- url: https://github.com/your-org/payment-service
branch: develop
name: payments㪠Sample Queries
These queries are from the acceptance criteria. Use them in Cursor chat or via ontology-rag ask.
Endpoint discovery
What REST endpoints does this expose?Expected: find_rest_endpoints returns a list of routes with HTTP methods, controller classes, and flow names.
Request flow (anchorless)
Walk me through what happens when a user creates an order.Expected: flow_of or rag_search (with flow-doc seeding) returns the ControllerβServiceβRepository chain and a Mermaid sequence diagram β even though the query names no specific class.
Cross-service relationships
Which service calls the payment service?Expected: uses_of / callers_of returns Feign/RestTemplate edges between microservices.
Class explanation
Explain the OrderService class.Expected: get_class returns the class doc, methods, injected dependencies, and collaborator edges.
Configuration
What database is configured in application.yml?Expected: rag_search with config intent returns the relevant configuration chunk with file citation.
π Project Structure
ontology-rag-mcp/
βββ ontology_core/ # Config, Solr client, embeddings, retrieval, intent, MCP server, CLI
β βββ config.py # Pydantic settings from env vars
β βββ models.py # Shared DTOs (SearchHit, FlowResult, etc.)
β βββ embeddings.py # Local sentence-transformers embedder
β βββ intent.py # Offline regex intent classifier
β βββ retrieval.py # Hybrid BM25 + kNN + RRF + flow-aware fusion
β βββ llm.py # Optional OpenAI-compatible LLM client
β βββ mcp_server.py # FastMCP server + 10 tools
β βββ cli.py # ontology-rag CLI (ingest / serve / ask)
β βββ solr/
β βββ client.py # Solr 9 REST client
β βββ managed-schema.xml # Collection schema
βββ ontology_ingest/ # Source providers, parser, flow ontology, pipeline
β βββ source/
β β βββ base.py # SourceProvider interface + factory
β β βββ local_git.py # GitPython shallow clone (default)
β β βββ github_mcp.py # Optional GitHub MCP adapter
β βββ parser/
β β βββ java_parser.py # javalang Java/Spring parser
β β βββ spring_annotations.py
β βββ ontology/
β β βββ flow_builder.py # REST flow tracing + call graph
β βββ chunker.py # Parsed artifacts β Solr docs
β βββ pipeline.py # End-to-end ingest orchestrator
β βββ embed_pipeline.py # Raw β serving collection with vectors
βββ ontology_deploy/ # Deploy providers + Jenkins orchestrator
β βββ base.py # DeployProvider interface
β βββ docker_provider.py # docker compose (default)
β βββ ssh_provider.py # Optional Linux SSH MCP adapter
β βββ jenkins_orchestrator.py # Optional Jenkins MCP adapter
βββ docker-compose.yml # Solr 9.6 + app
βββ Dockerfile
βββ repos.yml # Default repos to ingest
βββ Jenkinsfile # CI/CD pipeline for headless deploy
βββ .env.example # All env vars documented
βββ pyproject.toml
βββ tests/
β βββ test_java_parser.py
β βββ test_spring_annotations.py
β βββ test_flow_builder.py
β βββ test_intent.py
βββ README.mdπ Tech Choices
Choice | Rationale |
javalang | Pure Python, zero native bindings. Sufficient for Spring annotation/method/dependency extraction. tree-sitter is more robust for partial parses but adds build complexity β reserved for future pluggable parser interface. |
Apache Solr 9 | BM25 + dense vector kNN in one stack. Graph stored as document fields ( |
sentence-transformers | Offline embeddings with |
FastMCP | Official MCP Python SDK. Supports streamable HTTP and stdio transports. |
GitPython | Shallow clone for reproducible, MCP-agnostic source fetching. |
Pydantic | Typed settings, DTOs, and tool return values. |
π§ͺ Development & Testing
# Install with dev dependencies
pip install -e ".[dev]"
# Run unit tests
pytest tests/ -v
# Lint
ruff check .
# Ingest a repo
ontology-rag ingest --repos https://github.com/spring-projects/spring-petclinic
# Start MCP server
ontology-rag serve
# One-shot query
ontology-rag ask "What REST endpoints does this expose?"Test coverage:
Test File | Covers |
| Controller/service parsing, HTTP mapping extraction, call detection |
|
|
| ControllerβService flow tracing, call graph edges |
| Query intent classification (flow/endpoint/class/config) |
π§ Troubleshooting
Solr not ready
Symptom: TimeoutError: Solr not ready during ingest.
Fix:
# Check Solr health
curl http://localhost:8983/solr/admin/info/system
# Restart Solr container
docker compose restart solr
# Wait for healthy status
docker compose psEmbedding model download slow
Symptom: First ingest hangs on "Loading embedding model."
Fix: The first run downloads ~130 MB for BAAI/bge-small-en-v1.5. Subsequent runs use the cached model. Ensure internet access on first run, or pre-download:
python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('BAAI/bge-small-en-v1.5')"MCP server not connecting in Cursor
Symptom: ontology-rag shows red/disconnected in Cursor MCP settings.
Fixes:
Verify the server is running:
curl http://localhost:8765/mcpCheck
MCP_PORTmatches yourmcp.jsonURLFor stdio mode, ensure
ontology-ragis in your PATHRestart Cursor after config changes
Empty search results
Symptom: rag_search returns 0 hits.
Fixes:
Run ingest first:
ontology-rag ingestCheck index stats:
ontology-rag askwon't work, but MCPstatstool shows doc countsVerify
RAG_PRODUCTmatches the ingested product nameCheck Solr directly:
curl "http://localhost:8983/solr/petclinic-rag/select?q=*:*&rows=0"
No flow results for vague questions
Symptom: "walk me through..." returns class docs instead of flow docs.
Fix: Ensure RAG_FLOW_SEED=true (default). The retriever injects a flow/endpoint doc when intent is flow but no flow doc is in the top results.
Private repo access denied
Symptom: Git clone fails with 401/403.
Fix: Set GITHUB_TOKEN in .env:
GITHUB_TOKEN=ghp_your_token_hereπ₯ Author & Contact
This project was created by Pawan Gunjkar.
Author: Pawan Gunjkar
Email: pawangunjkar@gamil.com
Bug Reports: If you find any bugs, issues, or want to request help, please report them at the email above.
π License
MIT License β see LICENSE for details.
Built with FastMCP + Apache Solr 9 + sentence-transformers
Turn any Spring Boot repo into a queryable code ontology.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseAqualityDmaintenanceAn MCP server that transforms repositories into queryable knowledge by combining static code analysis with git history tracking. It allows users to investigate codebase structure, identify fragile files based on churn, and receive risk assessments through natural language queries.7
- Flicense-qualityFmaintenanceAn MCP server that transforms codebases into intelligent, queryable knowledge bases, enabling AI assistants to perform semantic search, explore architecture, and analyze code relationships.165
- Flicense-qualityBmaintenanceMCP server that exposes code tracing capabilities including journey flows, HTTP seams, and findings from indexed projects, allowing AI assistants to query software architecture.
- Flicense-qualityBmaintenanceMCP server for indexing source code from repositories into a Neo4j graph database and enabling Graph RAG-based search and traversal of functions via natural language queries.
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
A MCP server built for developers enabling Git based project management with project and personalβ¦
A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.β¦
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Pawangunjkar/ontology-rag-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server