feat: Store MCP documentation lookups as searchable documents (Context7, etc.) #111
Labels
No labels
good first issue
has-pr
help wanted
idea
priority
critical
priority
high
priority
low
priority
medium
status
blocked
status
in-progress
status
needs-review
status
ready
type
bug
type
docs
type
enhancement
type
feature
type
refactor
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
customable/claude-mem#111
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When Claude uses MCP servers like Context7 to look up documentation, the results are valuable knowledge that could be reused:
This creates a personal documentation cache that grows over time, reducing redundant API calls and improving context recall.
Proposed Solution
Dual Storage for Documentation MCP Tools
When certain MCP tools return structured documentation, store them in two places:
Target MCP Tools
Documentation Servers:
mcp__context7__query-docs- Library/framework documentationmcp__context7__resolve-library-id- Library search resultsOther Knowledge Sources:
mcp__playwright__browser_snapshot- Captured web contentWebFetchresults (if structured/valuable)Implementation Strategy
1. Detect Documentation Tools
2. Extract Structured Content
3. Store as Document in Qdrant
4. Deduplication Strategy
Avoid storing duplicate documentation:
Benefits
1. Documentation Cache
2. Context Enrichment
3. Reduced API Calls
4. Cross-Session Learning
UI Integration
Documents View (WebUI)
New section in web viewer:
Search Enhancement
MCP Search Tool Enhancement
Storage Optimization
Document Lifecycle
Compression
Related Issues
Open Questions
Example Schema
This creates a knowledge graph where:
Implementation Summary
Implemented Features
Database Layer:
documentstable with FTS5 full-text searchDocumentRecordtype with fields: id, project, source, source_tool, title, content, content_hash, type, metadata, memory_session_id, observation_id, access_count, last_accessed_epochDocumentTypeenum:library-docs,web-content,api-reference,code-example,tutorial,customIDocumentRepositoryinterface with full CRUD + deduplication supportSQLiteDocumentRepositoryimplementationBackend API:
GET /api/data/documents- List with filters (project, source, sourceTool, type)GET /api/data/documents/:id- Get single document (also records access)GET /api/data/documents/search?q=query- Full-text searchDELETE /api/data/documents/:id- Delete documentAutomatic Document Capture:
Extended
TaskDispatcherto detect and store documentation from:mcp__context7__query-docs→library-docstypemcp__context7__resolve-library-id→library-docstypeWebFetch→web-contenttypeDeduplication:
access_countand updateslast_accessed_epochNot Yet Implemented
Files Changed
packages/database/src/migrations/schema.ts- Documents table schemapackages/database/src/migrations/runner.ts- Migration v4packages/database/src/sqlite/repositories/documents.ts- New repositorypackages/types/src/database.ts- DocumentRecord, DocumentTypepackages/types/src/repository.ts- IDocumentRepository interfacepackages/backend/src/routes/data.ts- Document endpointspackages/backend/src/websocket/task-dispatcher.ts- Auto-capture logic