MCP Server
lore mcp
Starts an MCP server on stdio for agent access. Compatible with Claude Code, Cursor, and other MCP clients.
When to Use MCP
Use MCP when you want agents or tools to query Lore programmatically instead of invoking CLI commands directly.
- Retrieval tools: search, ask, graph traversal
- Health tools: lint summary, orphan/gap/ambiguity checks
- Maintenance tools: duplicate checks and index rebuild
Tools
| Tool | Description |
|---|---|
search(query) | BM25-ranked snippets |
ask(question) | BFS/DFS + LLM answer |
list_articles() | Titles + summaries from index.md |
get_article(slug) | Full article markdown |
get_neighbors(slug) | Related articles via backlinks |
path(from, to) | Shortest conceptual path |
graph_stats() | Article count, backlink density |
lint_summary() | Orphans, gaps, ambiguity, suggestions, diagnostics |
check_duplicate(content?, sha256?) | Duplicate precheck against .lore/raw/<sha> |
list_raw_tags() | Raw metadata taxonomy summary (formats + top tags) |
rebuild_index(repair?) | Rebuild search index/backlinks (optional manifest repair) |
list_orphans() | List articles with no incoming links |
list_gaps() | List missing conceptual targets referenced by links |
list_ambiguous() | List articles marked confidence: ambiguous |
Tool Groups
- Retrieval:
search,ask,list_articles,get_article,get_neighbors,path - Graph diagnostics:
graph_stats,lint_summary,list_orphans,list_gaps,list_ambiguous - Ingest/index maintenance:
check_duplicate,list_raw_tags,rebuild_index
Integration Example Pattern
Run Lore MCP server from your project root:
lore mcp
Client pattern:
- Connect to stdio transport
- Call
list_tools - Execute a tool request with JSON arguments
- Parse text payload from response
New Utility Tools
check_duplicateaccepts either rawcontent(hashed server-side) or a knownsha256and returns whether an existing raw entry already exists.list_raw_tagsaggregatesmeta.jsonacross.lore/raw/and returns:- total entry count
- per-format counts
- top inferred tags by frequency
rebuild_indexruns Lore's index rebuild through MCP; passrepair: trueto recover missing manifest entries first.list_orphansreturns a focused orphan-only view from lint diagnostics for graph maintenance workflows.list_gapsreturns unresolved conceptual targets so agents can prioritize article creation.list_ambiguousreturns uncertain articles for review and clarification workflows.lint_summaryincludes adiagnosticsarray with machine-readable findings (rule,severity,file, optionalline,message).
Example MCP Calls
Example duplicate precheck:
{
"name": "check_duplicate",
"arguments": {
"content": "Architecture migration notes..."
}
}
Example ask call:
{
"name": "ask",
"arguments": {
"question": "How does compile lock recovery work?"
}
}
Example graph stats call:
{
"name": "graph_stats",
"arguments": {}
}
Example response:
{
"duplicate": true,
"sha256": "...",
"rawPath": ".../.lore/raw/...",
"title": "Architecture Notes",
"format": "md"
}
Example taxonomy summary call:
{
"name": "list_raw_tags",
"arguments": {}
}
Example index rebuild with repair:
{
"name": "rebuild_index",
"arguments": {
"repair": true
}
}
Recommended Agent Maintenance Loop
list_orphansto find disconnected concepts.list_gapsto find missing concept pages.list_ambiguousto identify uncertain content.- perform edits/compile actions.
rebuild_index(repair=true)to refresh graph/search state.
End-to-End Maintenance Scenario
1) check_duplicate(content)
2) rebuild_index(repair=true)
3) lint_summary()
4) list_gaps()
5) ask("What are the highest-priority wiki gaps?")
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Client cannot connect | Server not running from repo root | Start with lore mcp in initialized Lore repo |
| Tool returns missing article errors | Index/wiki state outdated | Run rebuild_index(repair=true) |
ask answers are weak | Sparse wiki links or stale content | Recompile, reindex, and rerun |
| Duplicate check always false | Content differs after normalization | Provide exact raw content or known sha256 |