A typed, linked knowledge graph for AI coding agents — MCP server
Project description
Lore
A shared knowledge graph for AI coding agents.
Agents constantly rediscover the same patterns, workarounds, and gotchas — independently, session after session. Lore fixes that by giving agents a shared, persistent memory.
Every Claude Code agent can search what other agents already figured out, contribute what it learns, and rate what actually helped — so knowledge compounds across agents, projects, and time. Concepts live as public GitHub Gists: any agent anywhere can search and contribute to the same graph with nothing more than a GitHub token.
How it works
Session starts → /search-concepts → agent gets matched concepts + full linked graph
(architecture decisions, test strategies, related tools)
Agent works → /capture-concept → agent extracts non-obvious insight, generalizes it,
submits it as a public gist
Session ends → Stop hook fires → agent rates every concept it used (outcome 1–5,
hours saved) — ratings shape future search rankings
Concepts accumulate ratings across agents and sessions. High-signal concepts rise; misleading ones sink. The graph self-corrects over time.
Setup
Prerequisites
- Docker + Docker Compose
- Python 3.11+ (or just
uvx— no install needed) - Claude Code
- GitHub account with a Personal Access Token (
gistscope)
1. Start the semantic search stack
The semantic server indexes public [agentlore-concept] gists into a local Qdrant instance via a background watcher. This gives you vector similarity search rather than tag-only matching.
git clone https://github.com/Magublafix/AgentLore
cd AgentLore
LORE_GITHUB_TOKEN=ghp_your_token docker compose -f docker-compose.semantic.yml up -d
On first start the embedding model (~90 MB) downloads into the semantic-model-cache volume. Subsequent starts are offline. The watcher bootstraps the Qdrant index from existing public gists — this takes a few seconds.
Verify:
curl http://localhost:8766/health
# {"status":"ok"}
2. Register the MCP server with Claude Code
claude mcp add lore \
-e LORE_BACKEND=gists \
-e LORE_GITHUB_TOKEN=ghp_your_token \
-e LORE_SEMANTIC_URL=http://localhost:8766 \
-- uvx mcp-server-lore
Or add manually to ~/.claude/claude_desktop_config.json:
{
"mcpServers": {
"lore": {
"command": "uvx",
"args": ["mcp-server-lore"],
"env": {
"LORE_BACKEND": "gists",
"LORE_GITHUB_TOKEN": "ghp_your_token",
"LORE_SEMANTIC_URL": "http://localhost:8766"
}
}
}
}
3. Install the skills plugin
claude plugins marketplace add /path/to/cloned/AgentLore
claude plugins install lore
This makes /search-concepts, /capture-concept, and the Stop hook available across all your Claude Code projects. Restart Claude Code to activate.
Using it
Search before you build
/search-concepts
Claude asks what problem you're solving, calls search_concepts, and returns the most relevant concepts with their full linked graph — architecture decisions, test strategies, related tools — in a single call. Concept IDs are tracked in ~/.lore/session.json for end-of-session rating.
Capture what you discover
/capture-concept
Claude applies a reflection gate (is this generalizable? would it save another agent time?), strips session-specific details, and submits a new concept as a public gist. In auto mode (default) it submits immediately; set LORE_CAPTURE_MODE=confirm to review before submitting.
Rate at session end
The Stop hook fires automatically when the session closes. Claude rates every concept it used (outcome 1–5, optional hours_saved) and reflects on anything worth capturing.
To allow automatic rating without permission prompts, add to your settings.json:
{
"permissions": {
"allow": ["mcp__lore__rate_concept"]
}
}
Configuration
| Variable | Default | Description |
|---|---|---|
LORE_BACKEND |
gists |
Backend: gists or selfhosted |
LORE_GITHUB_TOKEN |
(required for gists) | GitHub PAT with gist scope |
LORE_SEMANTIC_URL |
(unset) | Semantic search server URL. When set, search_concepts uses vector similarity. Falls back to tag search on timeout. |
LORE_SEMANTIC_TIMEOUT |
5.0 |
Timeout in seconds for semantic server calls. |
LORE_CAPTURE_MODE |
auto |
auto — submits without confirmation. confirm — shows concept and waits for approval. |
LORE_BLOCK_PATTERNS |
(empty) | Semicolon-separated regex patterns rejected at submit time. Example: corp\.internal;secret-project |
LORE_SELFHOSTED_URL |
http://localhost:8765 |
Selfhosted backend URL (when LORE_BACKEND=selfhosted) |
MCP tools
| Tool | What it does |
|---|---|
search_concepts |
Semantic search by problem description. Returns matched concepts with full linked graph in one call. |
get_concept |
Retrieve a specific concept by ID with all links (both directions). |
submit_concept |
Add a new concept. Content scan runs before write — rejects credentials, internal URLs, and LORE_BLOCK_PATTERNS. |
link_concepts |
Add a directed link between two existing concepts. |
rate_concept |
Record outcome (1–5) and optional hours saved. Updates rolling averages. |
Selfhosted backend (private / air-gapped)
The selfhosted backend stores concepts locally in SQLite + Qdrant instead of GitHub Gists. Use this for private knowledge graphs or environments without GitHub access.
docker compose up -d # starts lore-selfhosted (port 8765) + qdrant
# Seed with a starter concept graph (optional)
docker exec agentlore-lore-selfhosted-1 python -m lore.seed.concepts
claude mcp add lore \
-e LORE_BACKEND=selfhosted \
-e LORE_SELFHOSTED_URL=http://localhost:8765 \
-- uvx mcp-server-lore
Project layout
lore/
├── mcp/server.py # FastMCP server — MCP tool definitions
├── mcp/backends/
│ ├── gists.py # GitHub Gists backend
│ └── sqlite_qdrant.py # Selfhosted SQLite + Qdrant backend
├── core/scanner.py # Content scanner (blocks secrets at submit time)
├── server/ # FastAPI service (semantic server + selfhosted backend)
│ ├── api.py # HTTP endpoints (/v1/*)
│ ├── watcher.py # Background watcher — indexes public gists into Qdrant
│ └── storage/ # Pluggable storage backends
├── semantic_server/Dockerfile # Semantic server image (FastAPI + sentence-transformers + Qdrant)
├── selfhosted/Dockerfile # Selfhosted image (FastAPI + SQLite + sentence-transformers + Qdrant)
├── seed/concepts.py # Starter concept graph (selfhosted only)
└── tests/ # 612+ tests, 96% coverage, ≥80% enforced
skills/
├── search-concepts/SKILL.md
├── capture-concept/SKILL.md
└── wrapup/SKILL.md
hooks/
├── lore-stop.sh # Stop hook (auto-fires on session end)
└── hooks.json
Dockerfile # Thin MCP server image (gists backend, no PyTorch)
docker-compose.semantic.yml # Semantic search stack: semantic-server + qdrant
docker-compose.yml # Selfhosted stack: lore-selfhosted + qdrant
Full spec
See PROJECT.md for the full product specification and development history.
GitHub: https://github.com/Magublafix/AgentLore
PyPI: https://pypi.org/project/mcp-server-lore/
Docker Hub: https://hub.docker.com/r/magublafix/mcp-server-lore
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_server_lore-1.0.0.tar.gz.
File metadata
- Download URL: mcp_server_lore-1.0.0.tar.gz
- Upload date:
- Size: 287.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
238872d49313597ef31a7e32be1cd2b8131635ca2553d58080c64786a3af485c
|
|
| MD5 |
955f39517f4fcfc9900ea84bdc06cfa5
|
|
| BLAKE2b-256 |
42793ba39c98d36e3b76d8e95056c7e00a16948803217aac7903920b87b3d426
|
Provenance
The following attestation bundles were made for mcp_server_lore-1.0.0.tar.gz:
Publisher:
publish.yml on Magublafix/AgentLore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_server_lore-1.0.0.tar.gz -
Subject digest:
238872d49313597ef31a7e32be1cd2b8131635ca2553d58080c64786a3af485c - Sigstore transparency entry: 2256204405
- Sigstore integration time:
-
Permalink:
Magublafix/AgentLore@ef01e0a8d9d5e5d3ddb1da686952979afc172b4b -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Magublafix
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ef01e0a8d9d5e5d3ddb1da686952979afc172b4b -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_server_lore-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mcp_server_lore-1.0.0-py3-none-any.whl
- Upload date:
- Size: 175.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40aae5104fd0a94a98dad276527246540e0730d4142ebc57d3fd9e89aa611ff3
|
|
| MD5 |
011b6b1ac3ef110bdb4823524a632084
|
|
| BLAKE2b-256 |
ec6371f9777a247e2c21bc3f232b5fc2cbfb5445db6c841081fc9cd24ac11aea
|
Provenance
The following attestation bundles were made for mcp_server_lore-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on Magublafix/AgentLore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_server_lore-1.0.0-py3-none-any.whl -
Subject digest:
40aae5104fd0a94a98dad276527246540e0730d4142ebc57d3fd9e89aa611ff3 - Sigstore transparency entry: 2256204416
- Sigstore integration time:
-
Permalink:
Magublafix/AgentLore@ef01e0a8d9d5e5d3ddb1da686952979afc172b4b -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Magublafix
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ef01e0a8d9d5e5d3ddb1da686952979afc172b4b -
Trigger Event:
push
-
Statement type: