cf-memory-mcp 3.8.5 β†’ 3.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,717 +1,143 @@
1
1
  # CF Memory MCP
2
2
 
3
- [![npm version](https://badge.fury.io/js/cf-memory-mcp.svg)](https://badge.fury.io/js/cf-memory-mcp)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
3
+ Cloudflare-hosted MCP server for semantic code indexing, retrieval, and assistant memory.
5
4
 
6
- A **best-in-class MCP (Model Context Protocol)** server for AI memory storage using **Cloudflare infrastructure**. This package provides AI coding agents with intelligent memory management featuring **smart auto-features**, **intelligent search**, **memory collections**, **temporal intelligence**, **multi-agent collaboration**, **advanced analytics**, and a **real-time analytics dashboard** with interactive visualizations and business intelligence.
5
+ **Live at [https://memcp.ai](https://memcp.ai)**
7
6
 
8
- ## 🎯 Current Version: v3.2.1 (Tool Consolidation Release)
7
+ ## Key Features
9
8
 
10
- **πŸ”§ Major Update: Tool Consolidation** - Reduced from 95+ tools to 20 essential tools (79% reduction) for improved usability and performance.
9
+ - **110+ language support** - TypeScript, Python, Go, Rust, Java, C/C++, Ruby, PHP, Swift, Kotlin, Scala, and 100+ more including shaders (GLSL, HLSL, WGSL, Metal, CUDA)
10
+ - **Hybrid retrieval** - 3-lane RRF (semantic + keyword + name matching) with cross-encoder reranking
11
+ - **100% benchmark accuracy** - 32 queries across behavioral, conceptual, identifier, and negation categories
12
+ - **Code graph navigation** - Track calls, imports, inheritance across 9 language families (TS/JS, Python, Go, Rust, Java/Kotlin/Scala, C/C++/C#, Ruby, PHP, Swift)
13
+ - **21 MCP tools** - Indexing, retrieval, file exploration, code graph, freshness management, and persistent memory
14
+ - **Self-healing freshness** - Results auto-flag stale chunks with a copy-pasteable `refresh_files` call; `refresh_stale` rebuilds the changed files in seconds; cache invalidates on write
15
+ - **Self-debugging errors** - `retrieve_context` includes `empty_hint` on 0-result queries; `get_file_content` / `get_file_outline` return `{error, hint}` pointing to the next call instead of bare null; calling bridge-only tools server-side returns `bridge_required` install instructions
16
+ - **Smart defaults** - Bridge auto-detects project_id from cwd, returns chunks pre-enriched with file imports + citation + source classification
17
+ - **Contextual embeddings** - Qwen3 8K-context model with Anthropic-style chunk headers
11
18
 
12
- ## πŸ“Š Real-time Analytics Dashboard
19
+ The active runtime is at [src-simplified/index.ts](src-simplified/index.ts). It exposes direct MCP over HTTP and a local stdio bridge for clients that want `npx cf-memory-mcp`.
13
20
 
14
- **NEW: Beautiful, high-performance analytics dashboard with interactive visualizations and business intelligence**
21
+ ## What Works
15
22
 
16
- 🌐 **Live Dashboard**: [https://55a2aea1.cf-memory-dashboard-vue.pages.dev](https://55a2aea1.cf-memory-dashboard-vue.pages.dev)
23
+ - Direct remote MCP on `/mcp`
24
+ - Legacy compatibility on `/mcp/message`
25
+ - Code indexing with `index_project` and `index_github`
26
+ - Retrieval with `retrieve_context` (3-lane hybrid + cross-encoder rerank, returns `file_imports` + `source_kind` + `citation`)
27
+ - Code relationship graph with `get_related_code` (calls, imports, extends, implements)
28
+ - Project exploration with `list_files`, `list_projects`, `get_stats`, `get_file_outline`, `get_file_content`
29
+ - **Staleness handling**: `find_stale_files`, `refresh_files`, `refresh_stale`. Results auto-tag stale chunks with a `stale_refresh_hint` showing the exact call to fix them.
30
+ - Assistant memory tools (`store_memory`, `retrieve_memories`, `get_context_bootstrap`, `delete_memory`)
31
+ - Session tracking with `start_session`, `end_session`
32
+ - Structured entity storage with `store_entity`
33
+ - Async indexing with Queues
34
+ - Coordination and progress with Durable Objects
35
+ - Diagnostics: `health_check` tool + `npx cf-memory-mcp --diagnose` + `CF_MEMORY_TRACE=1`
17
36
 
18
- ### Key Features
19
- - **πŸ”„ Real-time Updates** - Live data streaming with Server-Sent Events (SSE)
20
- - **πŸ“ˆ Interactive Charts** - Quality heatmaps, learning velocity gauges, performance radar charts
21
- - **πŸ•ΈοΈ Network Visualization** - Memory relationship graphs with clustering and filtering
22
- - **πŸ“± Mobile Responsive** - Optimized for desktop, tablet, and mobile devices
23
- - **πŸŒ™ Dark/Light Themes** - Automatic theme switching with user preferences
24
- - **πŸ“Š Export & Reports** - JSON/CSV export for business intelligence and presentations
25
- - **⚑ <2s Loading** - Enterprise-grade performance with global CDN
26
- - **πŸ§ͺ Built-in Testing** - Comprehensive performance and functionality testing suite
37
+ ## Active Infra
27
38
 
28
- ### Business Value
29
- - **Quality Tracking** - Monitor AI learning progress from 27% to 60%+ quality scores
30
- - **Performance Monitoring** - Real-time system health and optimization insights
31
- - **Decision Support** - Data-driven insights for strategic planning and resource allocation
32
- - **ROI Measurement** - Quantifiable metrics for AI investment returns
39
+ - Workers
40
+ - D1
41
+ - Vectorize
42
+ - Queues
43
+ - Durable Objects
33
44
 
34
- ### Quick Start
35
- ```bash
36
- # Deploy dashboard (requires Cloudflare account)
37
- cd dashboard-vue
38
- npm run deploy:production
39
-
40
- # Or access the live demo
41
- open https://55a2aea1.cf-memory-dashboard-vue.pages.dev
42
- ```
43
-
44
- πŸ“– **Documentation**: [Dashboard README](./dashboard-vue/README.md) | [Executive Summary](./docs/dashboard-executive-summary.md)
45
-
46
- **πŸš€ NEW: Enhanced JSON + Cloudflare Vectorize Integration (v2.12.1) - Next-Level Semantic Search:**
47
-
48
- - 🎯 **Entity-Level Vectorization** - Individual JSON entities get their own vectors for granular semantic search
49
- - πŸ” **Multi-Level Search Architecture** - Search at memory level AND entity level simultaneously
50
- - πŸ€– **Automatic Relationship Discovery** - AI-powered similarity-based relationship suggestions
51
- - πŸ“Š **85-95% Search Accuracy** - Enterprise-grade semantic understanding of complex data structures
52
- - ⚑ **50-70% Faster Discovery** - Optimized performance with Cloudflare's edge infrastructure
53
- - πŸ”— **Cross-Memory Entity Linking** - Connect similar entities across different JSON memories
54
- - πŸ“ˆ **Entity Analytics** - Importance scoring and pattern analysis for JSON structures
55
-
56
- **πŸ”₯ Enhanced JSON Processing & Temporal Relationship Tracking (v2.12.0) - Graphiti-Inspired Features:**
57
-
58
- - πŸ“Š **Enhanced JSON Processing** - Automatic entity extraction from structured JSON data with JSONPath tracking
59
- - πŸ•’ **Temporal Relationship Tracking** - Relationship versioning, validity status, and evolution history
60
- - πŸ”— **Relationship Evolution** - Track how connections between memories change over time
61
- - πŸ“ **Source Type Support** - Handle text, JSON, and message format data with automatic processing
62
- - 🎯 **Entity Relationship Mapping** - Automatic relationship generation between JSON entities
63
- - πŸ“ˆ **Relationship Analytics** - Evolution summaries and temporal pattern analysis
64
- - πŸ”§ **New MCP Tools** - update_memory_relationship, search_relationships_temporal, get_relationship_evolution
65
- - πŸ—„οΈ **Database Extensions** - Enhanced schema with memory_entities table and temporal indexes
66
-
67
- **🧠 Priority 4 - Context-Aware + Temporal Intelligence (v2.11.0) - AI-Enhanced Features:**
68
-
69
- - 🎯 **AI-Enhanced Contextual Suggestions** - Smart suggestions using semantic search and AI-powered relevance scoring
70
- - πŸ•’ **Advanced Temporal Intelligence** - Enhanced time-aware search with sophisticated temporal scoring algorithms
71
- - πŸ”„ **Context-Switching Optimization** - Automatic project detection and intelligent context switching
72
- - πŸ“Š **Temporal Pattern Analytics** - Advanced pattern recognition with ML-powered predictions
73
- - πŸ€– **AI-Powered Suggestion Text** - Intelligent suggestion generation using Cloudflare AI (Llama 3.1 8B)
74
- - πŸ“ˆ **Enhanced Temporal Relevance** - Context-aware scoring with access patterns and importance weighting
75
- - 🧠 **Smart Context Detection** - AI-powered context extraction from conversation history
76
- - ⚑ **Semantic Context Matching** - Vector-based project context discovery with 95%+ confidence
77
-
78
- **🧠 AI/ML Intelligence Engine (v2.9.0) - Production AI Features:**
79
-
80
- - πŸ€– **AI-Powered Content Expansion** - Real content enrichment using Llama 3.1 8B (replaces static text appending)
81
- - 🏷️ **Semantic Tag Generation** - Intelligent tagging with Cloudflare AI classification models
82
- - πŸ“Š **Real Performance Monitoring** - Actual metrics from database analytics (replaces mock data)
83
- - ⚑ **Enhanced Analytics Dashboard** - Database-driven performance tracking and system health
84
- - 🎯 **Production AI Models** - BGE embeddings, DistilBERT sentiment, Llama classification
85
- - πŸ”§ **Improved Quality Scoring** - AI-powered analysis with >95% prediction confidence
86
- - πŸ“ˆ **Performance Tracking** - Real-time operation monitoring with automatic metric collection
87
-
88
- **πŸš€ Cloudflare Vectorize Integration (v2.8.1) - Paid Tier Enhancement:**
89
-
90
- - 🎯 **Advanced Vector Search** - Cloudflare Vectorize for lightning-fast semantic search (50M queries/month)
91
- - πŸ“Š **Vector Storage** - Dedicated vector database with 10M stored dimensions/month
92
- - πŸ” **Enhanced Similarity** - Superior semantic search performance vs D1-based embeddings
93
- - 🧩 **Memory Clustering** - AI-powered clustering analysis using vector similarity
94
- - πŸ“ˆ **Paid Tier Optimization** - 33x more KV writes, 10x larger batches, 6x faster learning cycles
95
- - ⚑ **Performance Boost** - 50-70% response time reduction through optimized caching
96
-
97
- **⚑ KV Optimization Engine (v2.8.0) - Performance & Reliability:**
98
-
99
- - 🎯 **Intelligent Caching** - Optimized cache service with conditional writes and longer TTL values
100
- - πŸ“Š **KV Usage Monitoring** - Real-time tracking to prevent daily limit breaches (1,000 writes/day)
101
- - πŸ—„οΈ **D1 Database Fallback** - Analytics data stored in D1 to reduce KV write frequency
102
- - πŸ”„ **Batched Operations** - Write queue batching to minimize KV operations
103
- - πŸ“ˆ **Usage Analytics** - Trends, recommendations, and optimization insights
104
- - πŸ›‘οΈ **Limit Protection** - Automatic prevention of KV limit exceeded errors
105
-
106
- **🧠 Memory Intelligence Engine (v2.7.0) - Autonomous Optimization:**
107
-
108
- - πŸ€– **Automated Learning Loops** - Self-improving algorithms with A/B testing framework
109
- - 🎯 **Adaptive Thresholds** - Dynamic parameter optimization based on performance data
110
- - πŸ§ͺ **Learning Experiments** - Scientific approach to testing optimization strategies
111
- - πŸ“Š **A/B Testing Framework** - Rigorous experimentation with statistical analysis
112
- - πŸ”„ **Autonomous Optimization** - System continuously improves itself without manual intervention
45
+ This is the correct default stack for the current product. Queues fit per-file async indexing well, and Durable Objects fit progress and shared coordination.
113
46
 
114
- **Previous Features (Phase 2 Enhancements):**
47
+ ## Quick Start
115
48
 
116
- - πŸš€ **Quality Auto-Improvement Engine** - AI-powered memory enhancement to boost quality scores from 27% to 60%+
117
- - πŸ”§ **Content Expansion** - Intelligent AI analysis to expand short memories with relevant context
118
- - 🏷️ **Smart Tag Enhancement** - Automatic tag suggestions and improvements for better organization
119
- - βš–οΈ **Importance Recalculation** - Dynamic importance scoring based on content analysis and usage patterns
49
+ ### Local MCP Bridge
120
50
 
121
- **Previous Features (Phase 1 Enhancements):**
122
-
123
- - πŸ“Š **Memory Analytics Dashboard** - Real-time statistics and performance insights
124
- - πŸ” **Advanced Search Filters** - Date range, importance, size, and boolean search
125
- - πŸ₯ **Memory Health Monitoring** - Orphan detection and quality scoring
126
- - πŸ“ˆ **Performance Metrics** - Response time tracking and cache efficiency analysis
127
- - πŸ“€ **Rich Export/Import** - Multiple formats including graph visualization
128
-
129
- **Total Tools Available: 50+** spanning memory management, relationships, temporal intelligence, collaboration, autonomous optimization, KV performance monitoring, and advanced vector search.
130
-
131
- ## 🎯 Agent Tool Selection Solutions (v2.9.1)
132
-
133
- **NEW: Comprehensive guidance for AI agents to efficiently select from 31+ available MCP tools**
134
-
135
- With 31+ powerful MCP tools available, selecting the right tool for your task can be overwhelming. Our **Agent Tool Selection Solutions** provide structured guidance to help AI agents quickly identify optimal tools and workflows.
136
-
137
- ### πŸ“š Documentation Suite
138
-
139
- - **[Intent-Based Tool Selection Guide](docs/AGENT_TOOL_SELECTION_GUIDE.md)** - Clear mappings from user intents to appropriate tools
140
- - **[Common Workflow Patterns](docs/AGENT_WORKFLOW_PATTERNS.md)** - 5 proven workflow templates for common agent tasks
141
- - **[Tool Categories & Organization](docs/TOOL_CATEGORIES.md)** - 31+ tools organized into 8 logical categories
142
- - **[Performance Tips & Best Practices](docs/PERFORMANCE_TIPS.md)** - Optimization guidelines for maximum efficiency
143
-
144
- ### πŸ”§ Tool Categories (8 Categories, 31+ Tools)
145
-
146
- | Category | Tools | Best For |
147
- |----------|-------|----------|
148
- | **πŸ”§ CORE** | 5 tools | Daily operations, simple tasks |
149
- | **πŸ“¦ BATCH** | 3 tools | Bulk operations (>5 items) |
150
- | **πŸ•ΈοΈ GRAPH** | 6 tools | Exploring connections, relationships |
151
- | **🧠 INTELLIGENCE** | 6 tools | AI-powered automation, quality improvement |
152
- | **🎯 CONTEXT** | 6 tools | Project management, relevant suggestions |
153
- | **🀝 COLLABORATION** | 6 tools | Team projects, multi-agent workflows |
154
- | **πŸ“Š ANALYTICS** | 7 tools | System monitoring, performance analysis |
155
- | **⏰ LIFECYCLE** | 7 tools | Data maintenance, system optimization |
156
-
157
- ### ⚑ Quick Selection Guide
158
-
159
- ```
160
- Need basic operations? β†’ CORE tools
161
- Working with many items? β†’ BATCH tools
162
- Exploring connections? β†’ GRAPH tools
163
- Want AI assistance? β†’ INTELLIGENCE tools
164
- Working on projects? β†’ CONTEXT tools
165
- Collaborating with others? β†’ COLLABORATION tools
166
- Monitoring system? β†’ ANALYTICS tools
167
- Managing data lifecycle? β†’ LIFECYCLE tools
168
- ```
169
-
170
- ### πŸ”„ Common Workflow Patterns
171
-
172
- 1. **New Project Setup**: `create_project_context` β†’ `project_onboarding` β†’ `store_multiple_memories` β†’ `build_automatic_relationships`
173
- 2. **Research & Discovery**: `intelligent_search` β†’ `get_related_memories` β†’ `traverse_memory_graph` β†’ `get_contextual_suggestions`
174
- 3. **Quality Improvement**: `memory_health_check` β†’ `improve_memory_quality` β†’ `repair_and_enhance_tags` β†’ `detect_duplicates`
175
- 4. **Analytics & Insights**: `get_memory_stats` β†’ `get_usage_analytics` β†’ `analyze_temporal_relationships`
176
- 5. **Collaboration Setup**: `register_agent` β†’ `create_memory_space` β†’ `grant_space_permission` β†’ `add_memory_to_space`
177
-
178
- ### πŸ€– Smart Tool Recommendation (NEW!)
179
-
180
- **Get intelligent tool recommendations based on your intent:**
181
-
182
- ```javascript
183
- // Example: Finding information
184
- await callTool('recommend_tools', {
185
- user_intent: 'I want to find information about React performance optimization',
186
- current_context: 'Working on a React project',
187
- task_description: 'Need to improve the performance of my React application'
188
- });
189
-
190
- // Returns:
191
- // - Intent: "search_data" (66% confidence)
192
- // - Top tools: intelligent_search, store_memory, retrieve_memory
193
- // - Workflows: Quality Improvement, Analytics & Insights
194
-
195
- // Example: Storing project data
196
- await callTool('recommend_tools', {
197
- user_intent: 'I want to store multiple memories about my new project',
198
- current_context: 'Starting a new e-commerce project',
199
- task_description: 'Need to save project requirements, team info, and technical decisions'
200
- });
201
-
202
- // Returns:
203
- // - Intent: "store_data" (95% confidence)
204
- // - Top tools: store_memory, retrieve_memory, unified_search
205
- // - Workflows: New Project Setup, Collaboration Setup
51
+ ```bash
52
+ CF_MEMORY_API_KEY="your-key" npx cf-memory-mcp
206
53
  ```
207
54
 
208
- ### πŸ’‘ Performance Tips
209
-
210
- - **Use batch tools for >5 operations** (10x performance improvement)
211
- - **Enable `semantic: true`** for AI-powered search capabilities
212
- - **Set project context** for better relevance and accuracy
213
- - **Use `get_contextual_suggestions`** when unsure what to do next
214
- - **Use `recommend_tools`** for intelligent tool selection guidance
215
- - **Leverage AI features** for automation and quality improvement
216
-
217
- ## πŸš€ Quick Start
55
+ Test connectivity:
218
56
 
219
57
  ```bash
220
- # Run directly with npx (no installation required)
221
- npx cf-memory-mcp
222
-
223
- # Or install globally
224
- npm install -g cf-memory-mcp
225
- cf-memory-mcp
58
+ CF_MEMORY_API_KEY="your-key" npx cf-memory-mcp --diagnose
226
59
  ```
227
60
 
228
- ## ✨ Features
229
-
230
- ### Core Features
231
-
232
- - **🌐 Completely Portable** - No local setup required, connects to deployed Cloudflare Worker
233
- - **⚑ Production Ready** - Uses Cloudflare D1 database and KV storage for reliability
234
- - **πŸ”§ Zero Configuration** - Works out of the box with any MCP client
235
- - **🌍 Cross Platform** - Supports Windows, macOS, and Linux
236
- - **πŸ“¦ NPX Compatible** - Run instantly without installation
237
- - **πŸ”’ Secure** - Built on Cloudflare's secure infrastructure
238
- - **πŸš„ Fast** - Global edge deployment with KV caching
239
-
240
- ### πŸ€– Smart Auto-Features (v2.0.0)
241
-
242
- - **πŸ”— Auto-Relationship Detection** - Automatically suggests relationships between memories
243
- - **πŸ” Duplicate Detection** - Identifies potential duplicates with merge strategies
244
- - **🏷️ Smart Tagging** - AI-powered tag suggestions based on content analysis
245
- - **⭐ Auto-Importance Scoring** - ML-based importance prediction with detailed reasoning
246
-
247
- ### 🧠 Intelligent Search & Collections (v2.0.0)
248
-
249
- - **🎯 Intelligent Search** - Combines semantic + keyword + graph traversal with query expansion
250
- - **πŸ“š Memory Collections** - Organize memories with auto-include criteria and sharing
251
- - **πŸš€ Project Onboarding** - Automated workflows for project setup and knowledge extraction
252
- - **πŸ”„ Query Expansion** - Automatically includes synonyms and related terms
253
-
254
- ### ⏰ Context-Aware & Temporal Intelligence (v2.2.0)
255
-
256
- - **🧠 Conversation Context** - Track and manage conversation-specific memory contexts
257
- - **⏰ Temporal Relevance** - Time-based memory scoring and decay management
258
- - **πŸ”„ Memory Evolution** - Version control and evolution tracking for memories
259
- - **πŸ“Š Temporal Analytics** - Analyze how memories and relationships change over time
260
- - **🎯 Context Activation** - Smart memory activation based on conversation context
261
- - **πŸ“ˆ Predictive Relevance** - ML-powered predictions for memory importance over time
262
-
263
- ### 🀝 Multi-Agent Collaboration (v2.3.0)
264
-
265
- - **πŸ‘₯ Agent Management** - Register and authenticate multiple AI agents
266
- - **🏠 Collaborative Spaces** - Shared memory workspaces with permission control
267
- - **πŸ” Access Control** - Fine-grained permissions (read/write/admin) for agents
268
- - **πŸ”„ Memory Synchronization** - Real-time sync between different instances
269
- - **⚑ Conflict Resolution** - Smart merge strategies for concurrent edits
270
- - **πŸ“Š Collaboration Analytics** - Track agent interactions and collaboration patterns
271
-
272
- ### 🧠 Memory Intelligence Engine (v2.7.0)
273
-
274
- - **πŸ€– Automated Learning Loops** - Self-improving algorithms that continuously optimize system performance
275
- - **🎯 Adaptive Thresholds** - Dynamic parameter adjustment based on real-time performance data
276
- - **πŸ§ͺ Learning Experiments** - Create and manage A/B tests for optimization strategies
277
- - **πŸ“Š A/B Testing Framework** - Scientific experimentation with statistical analysis and confidence scoring
278
- - **πŸ”„ Improvement Cycles** - Autonomous optimization cycles that identify and apply performance enhancements
279
- - **πŸ“ˆ Predictive Analytics** - ML-powered predictions with >95% confidence targeting
280
- - **πŸŽ›οΈ Threshold Management** - Initialize and manage quality, relevance, importance, and relationship thresholds
281
- - **πŸ“‹ Experiment Analysis** - Automated analysis of test results with optimization recommendations
282
-
283
- ### πŸ“€ Advanced Export/Import (v2.3.0)
284
-
285
- - **πŸ“‹ Multi-Format Export** - JSON, XML, Markdown, CSV, GraphML formats
286
- - **πŸ”„ Batch Operations** - Asynchronous export/import job processing
287
- - **πŸ•ΈοΈ Graph Visualization** - Export memory networks for analysis tools
288
- - **πŸ“¦ Rich Metadata** - Full preservation of relationships and collaboration data
289
- - **πŸ”€ Conflict Handling** - Smart import strategies for existing memories
290
-
291
- ### πŸ“Š Phase 1 Enhancements (v2.5.0)
292
-
293
- - **πŸ“ˆ Memory Analytics Dashboard** - Real-time statistics, usage patterns, and performance metrics
294
- - **πŸ” Advanced Search Filters** - Date range, importance score, content size, and boolean search operators
295
- - **πŸ₯ Memory Health Monitoring** - Orphan detection, stale memory identification, and quality scoring
296
- - **πŸ“Š Performance Insights** - Response time tracking, cache efficiency, and database performance
297
- - **🎯 Quality Analysis** - Multi-factor quality scoring with improvement recommendations
61
+ Useful environment variables:
298
62
 
299
- ### Advanced Features
63
+ - `CF_MEMORY_BASE_URL` β€” override the server URL (defaults to `https://memcp.ai`). Pre-migration `workers.dev` URLs are auto-rewritten to memcp.ai.
64
+ - `CF_MEMORY_TRACE=1` β€” verbose request/response logging to `/tmp/cf-memory-mcp.log` (rotates at 5MB)
65
+ - `CF_MEMORY_PROGRESS=true` β€” stream per-file indexing progress via SSE to stderr during `index_project`
66
+ - `CF_MEMORY_AUTO_WATCH=true` β€” watch the project directory and auto-reindex on file change
67
+ - `CF_MEMORY_WATCH_PATH=/path/to/project` β€” explicit project root (defaults to bridge's `cwd`)
68
+ - `CF_MEMORY_PROJECT_NAME=my-project` β€” display name when auto-watch indexes the project
300
69
 
301
- - **🧠 Semantic Search** - AI-powered vector search using Cloudflare AI Workers
302
- - **πŸ•ΈοΈ Knowledge Graph** - Store and traverse relationships between memories
303
- - **πŸ“¦ Batch Operations** - Efficiently process multiple memories at once
304
- - **πŸ” Graph Traversal** - Find paths and connections between related memories
305
- - **🎯 Smart Filtering** - Advanced search with tags, importance, and similarity
70
+ ### Recommended workflow for active development
306
71
 
307
- ## πŸ› οΈ Usage
308
-
309
- ### With MCP Clients
310
-
311
- Add to your MCP client configuration:
312
-
313
- ```json
314
- {
315
- "mcpServers": {
316
- "cf-memory": {
317
- "command": "npx",
318
- "args": ["cf-memory-mcp"]
319
- }
320
- }
321
- }
72
+ ```text
73
+ 1. retrieve_context("how does X work") ← finds chunks with file_imports + citation
74
+ 2. (if stale_count > 0): refresh_stale(project) ← re-embeds edited files
75
+ 3. retrieve_context(...) ← fresh results
76
+ 4. get_related_code(name=X) ← navigate the call graph
77
+ 5. get_file_content(file_path) ← read whole file if needed
322
78
  ```
323
79
 
324
- ### With Augment
80
+ The bridge auto-detects the project from `cwd` so `project_id` is optional in step 1.
325
81
 
326
- Add to your `augment-config.json`:
82
+ ### Direct Remote MCP
327
83
 
328
- ```json
329
- {
330
- "mcpServers": {
331
- "cf-memory": {
332
- "command": "npx",
333
- "args": ["cf-memory-mcp"]
334
- }
335
- }
336
- }
337
- ```
338
-
339
- ### With Claude Desktop
84
+ - Base URL: [https://memcp.ai](https://memcp.ai)
85
+ - MCP endpoint: [https://memcp.ai/mcp](https://memcp.ai/mcp)
86
+ - Health check: [https://memcp.ai/health](https://memcp.ai/health)
340
87
 
341
- Add to your Claude Desktop MCP configuration:
342
-
343
- ```json
344
- {
345
- "mcpServers": {
346
- "cf-memory": {
347
- "command": "npx",
348
- "args": ["cf-memory-mcp"]
88
+ ```bash
89
+ curl -X POST https://memcp.ai/mcp \
90
+ -H 'content-type: application/json' \
91
+ -H 'x-api-key: your-key' \
92
+ -d '{
93
+ "jsonrpc": "2.0",
94
+ "id": 1,
95
+ "method": "initialize",
96
+ "params": {
97
+ "protocolVersion": "2025-03-26",
98
+ "capabilities": {},
99
+ "clientInfo": { "name": "example", "version": "1.0.0" }
349
100
  }
350
- }
351
- }
101
+ }'
352
102
  ```
353
103
 
354
- ## πŸ”§ Available Tools (v3.2.0 - Consolidated)
355
-
356
- The CF Memory MCP server provides **20 essential tools** (consolidated from 95+ tools for improved usability):
357
-
358
- ### Core Memory Operations (5 tools)
359
-
360
- #### `store_memory`
361
- Store a new memory with optional metadata and tags.
362
-
363
- **Parameters:**
364
- - `content` (string, required) - The memory content
365
- - `tags` (array, optional) - Tags for categorization
366
- - `importance_score` (number, optional) - Importance score 0-10
367
- - `metadata` (object, optional) - Additional metadata
368
-
369
- #### `retrieve_memory`
370
- Retrieve a specific memory by ID.
371
-
372
- **Parameters:**
373
- - `id` (string, required) - The unique memory ID
374
-
375
- #### `update_memory`
376
- Update an existing memory.
377
-
378
- **Parameters:**
379
- - `id` (string, required) - Memory ID to update
380
- - `content` (string, optional) - New content
381
- - `tags` (array, optional) - New tags
382
- - `importance_score` (number, optional) - New importance score
383
- - `metadata` (object, optional) - New metadata
104
+ ### Incremental Local Indexing
384
105
 
385
- #### `delete_memory`
386
- Delete a memory and its relationships.
387
-
388
- **Parameters:**
389
- - `id` (string, required) - Memory ID to delete
390
-
391
- #### `unified_search`
392
- Unified search interface consolidating all search modes: basic, intelligent, temporal, and vectorize.
393
-
394
- **Parameters:**
395
- - `query` (string, optional) - Full-text or semantic search query
396
- - `mode` (string, optional) - Search mode: 'basic', 'intelligent', 'temporal', 'vectorize'
397
- - `tags` (array, optional) - Filter by specific tags
398
- - `limit` (number, optional) - Maximum results (default: 10)
399
- - `semantic` (boolean, optional) - Use AI-powered semantic search
400
- - `time_context` (string, optional) - Temporal context: 'today', 'last_week', 'last_month'
401
-
402
- ### Analytics & System (3 tools)
403
-
404
- #### `unified_analytics`
405
- Unified analytics interface for memory, usage, patterns, system, and collaboration analytics.
406
-
407
- **Parameters:**
408
- - `scope` (string, optional) - Analytics scope: 'memory', 'usage', 'patterns', 'system', 'collaboration'
409
- - `time_range` (string, optional) - Time range: 'day', 'week', 'month'
410
- - `analysis_type` (string, optional) - Analysis depth: 'basic', 'comprehensive', 'learning'
411
-
412
- #### `get_system_health_report`
413
- Generate comprehensive system health report with actionable insights.
414
-
415
- **Parameters:**
416
- - `report_type` (string, optional) - Report type: 'summary', 'detailed', 'diagnostic'
417
- - `time_range` (string, optional) - Time range: 'day', 'week', 'month'
418
- - `include_recommendations` (boolean, optional) - Include optimization recommendations
419
-
420
- #### `get_cleanup_suggestions`
421
- Get AI-powered cleanup suggestions for memory optimization.
422
-
423
- **Parameters:**
424
- - `suggestion_types` (array, optional) - Types: 'duplicates', 'low_quality', 'orphaned', 'outdated'
425
- - `limit` (number, optional) - Maximum suggestions
426
-
427
- ### Unified Management Tools (6 tools)
428
-
429
- #### `unified_relationships`
430
- Manage memory relationships: create, update, list, delete.
431
-
432
- **Parameters:**
433
- - `action` (string, required) - Action: 'create', 'update', 'list', 'delete'
434
- - `source_memory_id` (string, conditional) - Source memory ID (for create)
435
- - `target_memory_id` (string, conditional) - Target memory ID (for create)
436
- - `relationship_type` (string, conditional) - Relationship type
437
- - `relationship_id` (string, conditional) - Relationship ID (for update/delete)
438
- - `strength` (number, optional) - Relationship strength 0-1
439
-
440
- #### `unified_collections`
441
- Manage memory collections: create, add, remove, get memories.
442
-
443
- **Parameters:**
444
- - `action` (string, required) - Action: 'create', 'add', 'remove', 'get_memories', 'list'
445
- - `name` (string, conditional) - Collection name (for create)
446
- - `collection_id` (string, conditional) - Collection ID
447
- - `memory_id` (string, conditional) - Memory ID (for add/remove)
448
-
449
- #### `unified_optimization`
450
- Run optimization operations: recommendations, comprehensive optimization.
451
-
452
- **Parameters:**
453
- - `action` (string, required) - Action: 'get_recommendations', 'run_comprehensive'
454
- - `optimization_scope` (string, optional) - Scope: 'quality', 'relationships', 'performance', 'comprehensive'
455
- - `dry_run` (boolean, optional) - Preview changes without applying
456
-
457
- #### `unified_batch_jobs`
458
- Manage batch processing jobs: create, status, cancel, results.
459
-
460
- **Parameters:**
461
- - `action` (string, required) - Action: 'create', 'status', 'cancel', 'results'
462
- - `job_type` (string, conditional) - Job type (for create): 'quality_improvement', 'relationship_building', 'export', 'import'
463
- - `job_id` (string, conditional) - Job ID (for status/cancel/results)
464
-
465
- #### `unified_system_alerts`
466
- Manage system alerts: list, configure, resolve.
467
-
468
- **Parameters:**
469
- - `action` (string, required) - Action: 'list', 'configure', 'resolve'
470
- - `alert_id` (string, conditional) - Alert ID (for resolve)
471
- - `alert_types` (array, optional) - Alert types to configure
472
- - `thresholds` (object, optional) - Custom thresholds
473
-
474
- #### `unified_agent_handoff`
475
- Manage agent handoff: get context, enable handoff, cleanup.
476
-
477
- **Parameters:**
478
- - `action` (string, required) - Action: 'get_context', 'enable_handoff', 'cleanup'
479
- - `session_id` (string, optional) - Session ID
480
-
481
- ### Project Intelligence (1 tool)
482
-
483
- #### `get_complete_project_intelligence`
484
- Unified project intelligence combining scanning, briefing, and handoff summary.
485
-
486
- **Parameters:**
487
- - `project_path` (string, optional) - Path to project root
488
- - `project_name` (string, optional) - Project name
489
- - `briefing_type` (string, optional) - Briefing type: 'full', 'quick', 'technical', 'deployment', 'onboarding'
490
- - `include_components` (array, optional) - Components: 'scan', 'briefing', 'handoff', 'list'
491
-
492
- ### Multi-Agent Collaboration (3 tools)
493
-
494
- #### `register_agent`
495
- Register a new agent in the system for collaboration.
496
-
497
- **Parameters:**
498
- - `name` (string, required) - Agent name
499
- - `type` (string, required) - Agent type: 'ai_agent', 'human_user', 'system'
500
- - `description` (string, optional) - Agent description
501
- - `capabilities` (array, optional) - Agent capabilities
502
-
503
- #### `create_memory_space`
504
- Create a collaborative memory space for multi-agent sharing.
505
-
506
- **Parameters:**
507
- - `name` (string, required) - Memory space name
508
- - `owner_agent_id` (string, required) - Agent ID who owns this space
509
- - `space_type` (string, optional) - Type: 'private', 'collaborative', 'public'
510
- - `access_policy` (string, optional) - Policy: 'open', 'invite_only', 'restricted'
511
-
512
- #### `get_agent_spaces`
513
- Get all memory spaces accessible to an agent.
514
-
515
- **Parameters:**
516
- - `agent_id` (string, required) - Agent ID to get spaces for
517
-
518
- ### Export/Import (2 tools)
519
-
520
- #### `create_export_job`
521
- Create an export job for memories.
522
-
523
- **Parameters:**
524
- - `format` (string, required) - Export format: 'json', 'xml', 'markdown', 'csv', 'graphml'
525
- - `initiated_by` (string, required) - Agent ID initiating export
526
- - `memory_ids` (array, optional) - Specific memory IDs to export
527
- - `include_relationships` (boolean, optional) - Include memory relationships
528
-
529
- #### `create_import_job`
530
- Create an import job for memories.
531
-
532
- **Parameters:**
533
- - `format` (string, required) - Import format
534
- - `file_content` (string, required) - File content to import
535
- - `initiated_by` (string, required) - Agent ID initiating import
536
- - `conflict_resolution` (string, optional) - How to handle existing memories: 'skip', 'overwrite', 'merge'
537
-
538
- ---
539
-
540
- ### Tool Consolidation Summary (v3.2.0)
541
-
542
- | Category | Tools | Description |
543
- |----------|-------|-------------|
544
- | Core CRUD | 5 | store, retrieve, update, delete, unified_search |
545
- | Analytics | 3 | unified_analytics, health_report, cleanup_suggestions |
546
- | Unified Management | 6 | relationships, collections, optimization, batch_jobs, alerts, handoff |
547
- | Project Intelligence | 1 | get_complete_project_intelligence |
548
- | Collaboration | 3 | register_agent, create_memory_space, get_agent_spaces |
549
- | Export/Import | 2 | create_export_job, create_import_job |
550
- | **Total** | **20** | Reduced from 95+ tools (79% reduction) |
551
-
552
- ## 🌐 Architecture
553
-
554
- ```
555
- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
556
- β”‚ MCP Client β”‚ β”‚ cf-memory-mcp β”‚ β”‚ Cloudflare Worker β”‚
557
- β”‚ (Augment, │◄──►│ (npm package) │◄──►│ (Production API) β”‚
558
- β”‚ Claude, etc.) β”‚ β”‚ β”‚ β”‚ β”‚
559
- β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
560
- β”‚
561
- β–Ό
562
- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
563
- β”‚ Cloudflare D1 DB β”‚
564
- β”‚ + KV Storage β”‚
565
- β”‚ + Vectorize (Paid) β”‚
566
- β”‚ + AI Workers β”‚
567
- β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
106
+ ```bash
107
+ CF_MEMORY_API_KEY="your-key" cf-memory-index /path/to/project
108
+ CF_MEMORY_API_KEY="your-key" cf-memory-watch /path/to/project
568
109
  ```
569
110
 
570
- ### Hybrid D1+Vectorize Architecture
571
-
572
- The system uses a sophisticated hybrid approach:
573
-
574
- - **D1 Database**: Primary storage for all memory content, metadata, relationships, and tags
575
- - **Vectorize**: High-performance vector similarity search with 50M queries/month capacity
576
- - **Hybrid Search**: Vectorize finds similar vectors β†’ D1 enriches with full memory data
577
- - **Fallback System**: Automatic fallback to D1-based search if Vectorize is unavailable
578
- - **Data Sync**: Both databases stay synchronized for all memory operations
111
+ The indexer keeps a local hash cache and uploads only changed files.
579
112
 
580
- πŸ“– **[Detailed Architecture Documentation](docs/vectorize-architecture.md)** - Complete technical overview with diagrams, data flows, and performance characteristics.
581
-
582
- ## πŸ”§ Command Line Options
113
+ ## Local Validation
583
114
 
584
115
  ```bash
585
- # Start the MCP server
586
- npx cf-memory-mcp
587
-
588
- # Show version
589
- npx cf-memory-mcp --version
590
-
591
- # Show help
592
- npx cf-memory-mcp --help
593
-
594
- # Enable debug logging
595
- DEBUG=1 npx cf-memory-mcp
116
+ npm run validate:simplified
596
117
  ```
597
118
 
598
- ## 🌍 Environment Variables
599
-
600
- - `DEBUG=1` - Enable debug logging
601
- - `MCP_DEBUG=1` - Enable MCP-specific debug logging
602
-
603
- ## 🧠 NEW: Assistant Memory Features (v4.0.0)
604
-
605
- **AI Assistant Memory Management** - Long-term memory for AI assistants with session tracking, context bootstrapping, and entity relationships.
606
-
607
- ### Assistant Memory Tools
608
-
609
- | Tool | Description |
610
- |------|-------------|
611
- | `store_memory` | Store facts, preferences, or important context |
612
- | `retrieve_memories` | Semantic search over memories |
613
- | `get_context_bootstrap` | Get memories to pre-load on session start |
614
- | `start_session` | Begin a conversation session |
615
- | `end_session` | End session, extract key facts |
616
- | `store_entity` | Store structured entities (people, projects, etc.) |
617
-
618
- ### Memory Types
619
- - **fact** - General knowledge about the user
620
- - **preference** - User preferences and settings
621
- - **task** - Active or completed tasks
622
- - **entity** - Structured data about people, projects, companies
623
- - **session_summary** - Summarized conversation sessions
624
-
625
- ### Example Usage
626
-
627
- ```typescript
628
- // Store a memory
629
- const result = await store_memory({
630
- content: "John is building a RAG pipeline with 4x H100 GPUs",
631
- type: "fact",
632
- importance: 0.9,
633
- confidence: 1.0,
634
- source: "user_explicit",
635
- tags: ["hardware", "rag", "work"]
636
- });
637
-
638
- // Retrieve relevant memories
639
- const memories = await retrieve_memories({
640
- query: "what hardware is John using?",
641
- limit: 5,
642
- min_importance: 0.7
643
- });
644
-
645
- // Bootstrap context on session start
646
- const context = await get_context_bootstrap({
647
- max_tokens: 4000,
648
- recent_sessions: 3,
649
- current_context: "discussing RAG pipeline"
650
- });
651
- ```
119
+ That runs strict TypeScript validation for `src-simplified` plus the simplified worker tests.
652
120
 
653
- ### Database Schema
121
+ ## Deploy
654
122
 
655
- Run the migration to add assistant memory tables:
656
123
  ```bash
657
- wrangler d1 execute MEMORY_DB --file=./migrations/002_assistant_memory.sql
124
+ ./scripts/deploy.sh
658
125
  ```
659
126
 
660
- Create the vectorize index:
661
- ```bash
662
- wrangler vectorize create assistant-memory-index --dimensions=1024 --metric=cosine
663
- ```
664
-
665
- Add to `wrangler.toml`:
666
- ```toml
667
- [[vectorize]]
668
- binding = "VECTORIZE_ASSISTANT"
669
- index_name = "assistant-memory-index"
670
- ```
671
-
672
- ---
673
-
674
- ## πŸ“‹ Requirements
675
-
676
- - **Node.js** 16.0.0 or higher
677
- - **Internet connection** (connects to Cloudflare Worker)
678
- - **MCP client** (Augment, Claude Desktop, etc.)
679
-
680
- ## πŸš€ Why CF Memory MCP?
681
-
682
- ### Traditional Approach ❌
683
- - Clone repository
684
- - Set up local database
685
- - Configure environment variables
686
- - Manage local server process
687
- - Handle updates manually
688
-
689
- ### CF Memory MCP βœ…
690
- - Run `npx cf-memory-mcp`
691
- - That's it! πŸŽ‰
692
-
693
- ## πŸ”’ Privacy & Security
694
-
695
- - **No local data storage** - All data stored securely in Cloudflare D1
696
- - **HTTPS encryption** - All communication encrypted in transit
697
- - **Edge deployment** - Data replicated globally for reliability
698
- - **No API keys required** - Public read/write access for simplicity
699
-
700
- ## 🀝 Contributing
701
-
702
- Contributions are welcome! Please see the [GitHub repository](https://github.com/johnlam90/cf-memory-mcp) for more information.
703
-
704
- ## πŸ“„ License
705
-
706
- MIT License - see [LICENSE](LICENSE) file for details.
127
+ That deploys the active worker and applies the simplified D1 schema and required migrations.
707
128
 
708
- ## πŸ”— Links
129
+ ## Canonical Files
709
130
 
710
- - **GitHub Repository**: https://github.com/johnlam90/cf-memory-mcp
711
- - **npm Package**: https://www.npmjs.com/package/cf-memory-mcp
712
- - **Issues**: https://github.com/johnlam90/cf-memory-mcp/issues
713
- - **MCP Specification**: https://modelcontextprotocol.io/
131
+ - [src-simplified/index.ts](/Users/johnlam/cf-memory-mcp/src-simplified/index.ts)
132
+ - [src-simplified/services/IndexingService.ts](/Users/johnlam/cf-memory-mcp/src-simplified/services/IndexingService.ts)
133
+ - [src-simplified/services/RetrievalService.ts](/Users/johnlam/cf-memory-mcp/src-simplified/services/RetrievalService.ts)
134
+ - [src-simplified/queue-consumer.ts](/Users/johnlam/cf-memory-mcp/src-simplified/queue-consumer.ts)
135
+ - [wrangler.toml](/Users/johnlam/cf-memory-mcp/wrangler.toml)
136
+ - [bin/cf-memory-mcp.js](/Users/johnlam/cf-memory-mcp/bin/cf-memory-mcp.js)
137
+ - [bin/cf-memory-mcp-indexer.js](/Users/johnlam/cf-memory-mcp/bin/cf-memory-mcp-indexer.js)
714
138
 
715
- ---
139
+ ## Notes
716
140
 
717
- Made with ❀️ by [John Lam](https://github.com/johnlam90)
141
+ - The simplified worker is the active product path.
142
+ - Older material from previous architectures still exists in the repo; treat the simplified worker and `wrangler.toml` as canonical.
143
+ - If repo-level long-running orchestration is needed later, add Workflows on top of the current stack rather than replacing Queues.