context-mcp
MCP server for context management, temporal metadata, and lightweight retrieval plumbing.
This crate provides a "memory service" for agents: store/retrieve context items with timestamps and metadata, supporting basic query/retrieval patterns via text matching and filtering.
Features
- Multi-tier Storage: In-memory LRU cache with optional sled-based disk persistence
- Temporal Tracking: Timestamps, age tracking, and time-based filtering for context relevance
- CPU-Optimized Retrieval: Parallel processing with rayon for text-based context queries
- MCP Protocol Support: JSON-RPC server implementation with HTTP/WebSocket and stdio transports
- Screening Status Fields: Built-in fields for tracking security screening state (integration not included)
Status
Alpha / under active development. APIs and tool names may change.
Installation
Add this to your Cargo.toml:
[]
= "0.1"
Usage
As a Library
use ;
async
As an MCP Server
Run as HTTP server:
Run as stdio transport:
What It Does (Verified by Code/Tests)
- JSON-RPC MCP Server: Runs over HTTP/WebSocket or stdio transport
- Context Storage: Store/retrieve contexts with IDs, domains, timestamps, tags, and custom metadata
- Tiered Storage: In-memory LRU cache (always) + optional sled disk persistence
- Text-Based Queries: Query by text content, domain, tags, time ranges with simple text matching
- Temporal Filtering: Filter contexts by creation time, last access, age, and expiration
- Parallel Processing: CPU-optimized retrieval using rayon for performance
- MCP Tools: 10 tools including store_context, get_context, query_contexts, retrieve_contexts, delete_context, update_screening, get_temporal_stats, get_storage_stats, cleanup_expired
What It Does Not Do (Yet)
- Vector embeddings: Mock implementation only - no real embedding generation or similarity search
- Semantic search: Text matching is literal, not semantic
- External integrations: No active security-mcp or other service integrations (only status fields)
- Chunking/citations: No automatic document chunking or citation tracking
- Distributed storage: Single-node only, no replication or clustering
Architecture
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ MCP Client │ │ JSON-RPC Server │ │ Storage Layer │
│ │ │ │ │ │
│ • HTTP/WS │◄──►│ • Store/Retrieve │◄──►│ • In-Memory LRU │
│ • stdio │ │ • Query/Filter │ │ • Sled (opt) │
│ • curl/tools │ │ • Temporal Stats │ │ • Domain Index │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
▼
┌──────────────┐
│ RAG Processor│
│ • Text Match │
│ • Parallel │
│ • Scoring │
└──────────────┘
Contributing
See CONTRIBUTING.md for development setup and contribution guidelines.
License
Licensed under the MIT License. See LICENSE for details.