historical-kb-mcp
Stores and retrieves completed defect-triage analyses to find similar past defects during new ticket triage. Provides tools for storing, searching, updating, and listing historical defect records with hybrid retrieval (dense + BM25).
README
Historical Search Engineering KB MCP
Stores and retrieves completed defect-triage analyses so the orchestrator can find similar past defects when triaging a new ticket. This is the third MCP in the Rapid7 SI Triage pipeline — the persistent memory of the system.
What it does
- Store — after the triage agent completes its analysis, it calls
store_analysiswith the full triage result: root cause, verdict, fix, affected class/method, error signature, PR link, confidence, and 30+ other metadata fields. If the same ticket is stored again, fields are merged (upsert). - Search — at the start of a new triage,
search_similarruns hybrid retrieval (dense + BM25 via Reciprocal Rank Fusion) to find historical defects with similar error signatures, root causes, or components. - Retrieve —
get_analysisreturns the full record for a specific ticket. - Update —
update_analysispatches fields (e.g. adding the PR link after the fix is merged, or upgrading the verdict after investigation). - List —
list_analyseswith optional filters for browsing/dashboarding. - Delete —
delete_analysisremoves a record. - Stats —
get_kb_statsreturns counts by verdict, defect type, component, product, and average resolution time.
Tools
| Tool | Purpose |
|---|---|
store_analysis(data) |
Store or merge a triage result (ticket_id required) |
get_analysis(ticket_id) |
Retrieve full record by Jira key |
search_similar(query, top_k, component?, verdict?, product?, error_type?) |
Hybrid search with optional filters |
update_analysis(ticket_id, updates) |
Patch specific fields |
list_analyses(component?, verdict?, product?, limit?) |
Filtered listing |
delete_analysis(ticket_id) |
Remove from KB |
get_kb_stats() |
Aggregate statistics |
Metadata schema (AnalysisRecord)
Every analysis stores 30+ fields across these categories:
- Identity — ticket_id, record_id
- Ticket context — summary, description, product, component, version, environment, reporter, priority, labels
- Triage analysis — root_cause, verdict, defect_type, severity_assessed, confidence
- Code location — affected_class, affected_method, affected_file, affected_line
- Error signature — error_type, error_message, error_code, stack_trace_signature
- Fix / resolution — fix_description, fix_type, pr_link, pr_status, commit_hash, branch, files_changed
- Linked artefacts — confluence_page_ids, related_tickets, log_query_used, log_chunks_referenced
- Timestamps — created_at, resolved_at, resolution_time_hours, updated_at
- Agent metadata — analyst, model_used, pipeline_version
- Extension — tags, custom_fields
Verdict taxonomy
code_fix · config_change · infra · dependency · data_issue ·
user_error · duplicate · wontfix · needs_info · not_a_bug
Defect type taxonomy
null_pointer · class_cast · arithmetic · concurrent_modification ·
number_format · parse_error · resource_leak · timeout ·
connection_failure · auth_failure · permission_denied · missing_table ·
schema_mismatch · config_invalid · thread_pool · memory · other
Install & run
cd historical-kb-mcp
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .
cp .env.example .env # adjust SI_DATA_DIR if needed
# stdio (for Claude Desktop / local MCP client):
python -m historical_kb_mcp --transport stdio
# HTTP (for MCP Inspector / remote clients):
python -m historical_kb_mcp --transport http
# Serves at http://127.0.0.1:8082/mcp
This server is one of four processes in the SI Triage POC (this + the Jira/Confluence and Log Intelligence MCPs + the orchestrator). For the full multi-service manual startup sequence,
.envlayout across all four repos, and end-to-end test steps, seeorchestrator-agent/si-triage-automation/README.md→ "Running the full system manually".
Seed the KB with the 10 Nexpose defects
python -m historical_kb_mcp.seed
This pre-populates the KB with completed triage analyses for all 10 planted
defects (root causes, verdicts, fixes, PR links, error signatures), so
search_similar returns meaningful results immediately.
MCP Inspector
npx @modelcontextprotocol/inspector
# URL: http://127.0.0.1:8082/mcp
Register with an MCP client (stdio)
{
"mcpServers": {
"historical-kb": {
"command": "python",
"args": ["-m", "historical_kb_mcp", "--transport", "stdio"],
"env": { "SI_DATA_DIR": "/absolute/path/to/si_data" }
}
}
}
How it fits in the pipeline
Orchestrator (Claude)
│
├──1─▶ jira-confluence-mcp (get ticket, download logs, search Confluence)
│ └─writes→ si_data/logs/<ticket_id>/
│
├──2─▶ log-intelligence-mcp (ingest logs, hybrid query)
│ └─reads← si_data/logs/<ticket_id>/
│ └─writes→ si_data/vector_store/
│
├──3─▶ historical-kb-mcp ◀── THIS MCP
│ ├─ search_similar(error_signature) ← find past defects
│ └─ store_analysis(triage_result) ← save when done
│ └─writes→ si_data/kb/records/ + si_data/kb/vectors/
│
└──4─▶ jira-confluence-mcp (post comment, update ticket)
All three MCPs share SI_DATA_DIR — set it to the same absolute path.
Hybrid search
Same approach as the Log Intelligence MCP:
- Dense — sentence-transformers
all-mpnet-base-v2(768-dim) for semantic similarity ("payment failed" ≈ "authorization error") - BM25 — keyword matching for exact identifiers (class names, error codes, CVEs)
- Reciprocal Rank Fusion — merges the two rankings without fragile score normalisation
The text embedded is the concatenation of error signature fields, root cause, fix, summary, description, and class/method — ordered so the most semantically distinctive fields dominate.
Backends (same as log MCP)
| Concern | Production | Offline fallback |
|---|---|---|
| Embeddings | sentence-transformers all-mpnet-base-v2 |
Hashed n-gram TF-IDF (numpy) |
| Vector store | Chroma (persistent) | Numpy .npz + JSON |
| Sparse search | BM25 (always) | same |
EMBED_BACKEND=auto / VECTOR_BACKEND=auto use production backends when
importable and fall back otherwise. The offline backends are real (genuine
vectors, real cosine search) — not mocks.
Tests
pytest # in the POC environment
python tests/_runner.py # offline (when pytest isn't installed)
12 tests: model serialisation, searchable text ordering, BM25 keyword ranking, store/retrieve, update (field merge), search (hybrid + filters), delete, list (with filters), stats aggregation, upsert merge (no duplicates), and the full seed of all 10 defects.
Configuration
See .env.example. Key variables: SI_DATA_DIR, EMBED_BACKEND,
VECTOR_BACKEND, RRF_K, DEFAULT_TOP_K, MCP_HTTP_PORT (default 8082).
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。