ContextHub
Integrates with Git repositories to map memories to branches, authors, commit hashes, and file diffs, providing tools for getting recent changes, git summaries, and commit-related memories.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ContextHubsave memory: refactored database layer"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ContextHub
AI Memory Layer for Developers โ Persistent context, semantic search, and intelligent context injection for every AI agent in your repositories.
What is ContextHub?
ContextHub is a local-first, privacy-focused AI memory and context orchestration layer that gives coding agents persistent memory across sessions. It understands your codebase, provides intelligent context injection to any AI agent, and keeps all your data encrypted and private.
Key Features
โก Token & Cost Optimizer โ Saves 70%-90% context window and API costs via smart session compression and dynamic RRF filtering
๐ง Persistent Memory โ Saves conversations, decisions, and learnings across sessions
๐ Semantic Search โ Natural language queries across all your memories with offline-verified local bigram embeddings
๐ Code Intelligence โ Analyzes repo structure, dependencies, and transitive God-nodes
๐ MCP-Compatible โ Works natively with Cursor, Claude Code, Windsurf, and any stdio MCP client
๐ Encrypted Storage โ Bank-grade AES-256-GCM encryption at rest with per-repo unique salt
๐ก๏ธ Auto-Redaction โ API keys, tokens, private keys, and passwords detected and redacted before write
๐ Local Dashboard โ Interactive web dashboard to visually explore memory timelines and codebase topology
๐ฟ Git Integration โ Automatically maps memories to branches, authors, commit hashes, and file diffs
๐ Multi-Root Support โ Standard multi-root workspace configs limit file indexing strictly to active folders
๐ Docs Ingest โ Ingest markdown directories and PDFs directly into semantic memory
๐ง DeepSync โ One command to scan your entire repo (code + docs + git) and build a complete knowledge graph with auto-updates
๐ Local-First โ Zero telemetry and zero external network calls. Your code and memories never leave your workstation
Quick Start
You can set up ContextHub either Globally (for all your coding repositories) or as a Single-Repo local setup (isolated to this project only).
Option A: Single Repository Setup (Recommended)
Add ContextHub as a local dependency inside this specific project:
# 1. Install locally in the project root
npm install --save-dev @imayuur/contexthub
# 2. Run the local setup
npx contexthub setupOption B: Global Installation (Universal)
Install globally to make the contexthub command globally accessible anywhere on your system:
# 1. Install globally
npm install -g @imayuur/contexthub
# 2. Run setup in the project root
contexthub setupOption C: Instant Execution (No Install)
Run instantly via npx without storing any packages locally or globally:
npx @imayuur/contexthub setupThat's it! ContextHub will:
Initialize encrypted storage in
.contexthub/Generate encryption key (
.contexthub/.keyfile, owner-only0600permissions)Generate auth token (
.contexthub/.auth-token)Start the MCP server in the background with PID tracking
For AI Agents
Configure your AI agent to connect to ContextHub as an MCP server via stdio transport. The agent will automatically:
Fetch relevant context before responding
Save interactions as encrypted memories
Query the knowledge graph and repo intelligence
๐ง DeepSync โ One Command, Total Repo Awareness
npx @imayuur/contexthub deepsyncDeepSync performs a deep scan of your entire repository in one shot:
๐ Code Analysis โ Parses all source files across 15+ languages, indexes symbols and import relationships
๐ Documentation โ Ingests all markdown files into searchable, semantic memory
๐ Git Mining โ Analyzes commit history, identifies hot files and recent focus areas
๐ข Embeddings โ Generates vector embeddings for semantic search across all memories
๐ Report โ Writes a rich
DEEPSYNC.mdsummary to.contexthub/
After the initial scan, ContextHub auto-updates incrementally on every ensure_session call โ only changed files are re-analyzed. Zero manual effort.
Usage Examples
CLI Commands
# Memory operations
contexthub memory --list
contexthub memory --add "Handle race condition in auth module"
contexthub memory --search "authentication bug"
contexthub memory --list --type bugfix
# Session timeline
contexthub timeline --limit 20
# Semantic search (vector-enabled)
contexthub search --query "how to implement caching" --limit 5
# Unified RRF query (memory + graph + git)
contexthub query "auth race condition"
# Generate context bundle for agents
contexthub context --query "caching strategy"
# Watch for incremental graph updates
contexthub watch
# Launch interactive dashboard
contexthub dashboard
# DeepSync โ one-command repo intelligence
contexthub deepsync
contexthub deepsync --force # force full re-scan
# Server lifecycle
contexthub start --port 3000
contexthub stop
# Ingest documentation
contexthub ingest-docs
# Health & performance
contexthub doctor
contexthub benchmarkDashboard (Interactive Web UI)
# Launch the local dashboard (localhost only)
contexthub dashboard
# Custom port
contexthub dashboard --port 4000Opens at http://127.0.0.1:3847. Features:
Memory Feed โ browse all encrypted memories with tags and timestamps
Intelligent Query โ unified search across memories, graph, and git
Topology Graph โ interactive force-directed Vis.js graph of your codebase dependencies
Click any node to inspect package workspace, dependency degree, and direct neighbors
Dashboard binds to
127.0.0.1only โ never exposed to the network.
Architecture
contexthub/
โโโ packages/ # 14 packages
โ โโโ shared-types/ # TypeScript interfaces (Session, MemoryEntry, CodeGraph)
โ โโโ core/ # Storage, security, RRF query, config, limits
โ โโโ cli/ # 25 CLI commands (setup, deepsync, dashboard, watch, query, etc.)
โ โโโ mcp-server/ # MCP protocol server (35+ tools, hardened)
โ โโโ knowledge-graph/ # Code graph: god-nodes, communities, snapshots, reports
โ โโโ vector-engine/ # Embeddings: local bigram TF-IDF, optional transformers
โ โโโ repo-parser/ # Tree-sitter (TS/JS/TSX/Py) + regex 15+ languages
โ โโโ git-integration/ # Git history & commit tracking (simple-git)
โ โโโ docs-ingest/ # Markdown chunk + embed into vector engine
โ โโโ plugin-pdf/ # PDF parse (optional, env flag)
โ โโโ context-injector/ # Smart context retrieval
โ โโโ memory-engine/ # Compact, archive, deduplication algorithms
โ โโโ agent-connectors/ # AI agent adapters (sanitized)
โ โโโ skills/ # Built-in skills only: architect, debug, review
โโโ scripts/ # publish-packages.js, rename-scope.js
โโโ docs/ # Marketing site, assets
โโโ SECURITY.md # ๐ Full security scan report (26 findings, all fixed)
โโโ .contexthub/ # Per-repo encrypted storage (created at runtime)
โโโ memories.json # ๐ Encrypted memory storage
โโโ sessions.json # ๐ Encrypted session history
โโโ project-metadata.json # ๐ Encrypted metadata
โโโ .keyfile # ๐ Encryption key (mode 0600)
โโโ .auth-token # ๐ MCP auth token (mode 0600)
โโโ server.pid # Process ID for server management
โโโ graph/ # ๐ Encrypted code knowledge graph
โโโ embeddings/ # Vector embeddings
โโโ GRAPH_REPORT.md # Auto-generated dependency report
โโโ DEEPSYNC.md # ๐ง DeepSync intelligence reportHow It Works
Capture โ Interactions saved via MCP tools (no shell hooks)
Sanitize โ All input validated, sensitive data auto-redacted
Encrypt โ Data encrypted with AES-256-GCM before writing to disk
Analyze โ RepoParser builds code structure understanding (sandboxed)
Embed โ VectorEngine generates semantic embeddings
Inject โ ContextInjector retrieves relevant context for AI queries
MCP Tools Available (35+)
Session & Memory: ensure_session, record_turn, save_session, end_session, get_project_context, save_memory, search_memory, semantic_search, search_memory_by_code, contexthub_query, get_context_bundle, explain_symbol
Code Graph: get_code_graph_stats, get_related_symbols, get_blast_radius, trace_code_path, update_knowledge_graph, get_god_nodes, get_graph_communities, diff_code_graph, what_changed_since_session
Repo & Git: summarize_repo, get_architecture_summary, get_related_files, get_recent_changes, get_git_summary, get_memories_for_commit
Docs & Skills: ingest_docs, search_docs, ingest_pdf, list_skills, load_skill, run_skill_command
Resources: contexthub://policy, contexthub://graph-stats, contexthub://report
Prompts: summarize-session, onboard-repo, pre-commit-review
All tools are wrapped with
safeHandler()โ errors never expose internal paths or stack traces.
Security & Privacy
ContextHub is secure by design. See SECURITY.md for the full audit report.
Protection | Details |
๐ Encryption | AES-256-GCM at rest for all data files |
๐ก๏ธ Auto-Redaction | API keys, tokens, passwords detected and redacted |
๐ซ No Shell Hooks | No |
๐ Path Safety | Directory traversal and symlink attacks prevented |
โ Input Validation | All parameters validated and sanitized |
๐ Auth Support | Optional HMAC token authentication for MCP |
๐ฆ Atomic Writes | No data corruption on crash |
๐งน Error Sanitization | No internal paths or stack traces leaked |
๐ Local-First | Zero telemetry, zero external calls |
๐ 0 npm Vulnerabilities | Clean dependency tree |
Quick Security Setup
# Optional: Enable MCP authentication
export CONTEXTHUB_TOKEN=your-secret-token
# Optional: Provide your own encryption key
export CONTEXTHUB_KEY=your-strong-passphrase
# Optional: Enable the ingest_pdf tool (max 50 pages / 20MB per file)
export CONTEXTHUB_ENABLE_PDF=1
# Verify file permissions
ls -la .contexthub/
# Directory: drwx------ (700)
# Files: -rw------- (600)Memory Types
Type | Description |
| User prompt / query |
| AI response / solution |
| Session summary |
| Architectural decision |
| Design pattern / structure |
| Bug description & fix |
| User-added note |
| Git commit record |
Skills System
ContextHub includes 3 built-in skills (no external skill loading for security):
Skill | Commands | Triggers |
|
| architecture, design, structure |
|
| bug, error, fix, issue |
|
| review, pr, pull request |
System Limits
ContextHub enforces strict performance caps centrally to ensure agents don't freeze your system or consume unbounded tokens:
Memory Context Size: 50KB maximum per entry
Total Memories: 10,000 max entries per repo
Graph Display Nodes: 5,000 nodes rendered max
Search Query Result: 100 max entries returned
Repo Parser Limits: 1,000 files max, 1MB max file size
Memory Tags/Refs: 20 tags, 20 linked paths, 20 linked symbols
Development
Building from Source
# Clone repository
git clone https://github.com/iMayuuR/contexthub.git
cd contexthub
# Install dependencies
npm install
# Build all packages
npm run build
# Run CLI
node packages/cli/dist/index.js --helpPackage Structure (14 packages)
Package | Purpose |
| TypeScript interfaces (Session, MemoryEntry, CodeGraph) |
| Storage, security, RRF query, config, contexthub-ignore, limits |
| 25 CLI commands (setup, deepsync, dashboard, watch, query, etc.) |
| MCP protocol with 35+ tools, resources, prompts |
| Graph build/patch, god-nodes, communities, reports, snapshots |
| Local bigram TF-IDF embeddings, optional transformers |
| Tree-sitter WASM (TS/JS/TSX/Py) + regex 15+ languages |
| Git operations via simple-git |
| Markdown chunk + embed into vector engine |
| PDF text extraction (optional, env flag) |
| Compact, archive, deduplication algorithms |
| Smart context retrieval and prompt enhancement |
| AI agent adapters (sanitized with safeSaveMemory) |
| Built-in only: architect, debug, review (allowlist) |
Implementation Roadmap
All features, optimizations, and unit/integration tests are 100% complete.
Roadmap
Web Dashboard for memory visualization
Comprehensive test suite
๐ง DeepSync โ one-command repo intelligence with auto-sync
Electron desktop app with system tray
WebSocket transport for MCP
Cloud sync with E2E encryption
Team collaboration features
Contributing
Contributions welcome! Please read our Contributing Guide and submit PRs.
License
MIT ยฉ 2026 Mayur Dattatray Patil
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/iMayuuR/contexthub'
If you have feedback or need assistance with the MCP directory API, please join our Discord server