A high-performance MCP (Model Context Protocol) server that stores memories in GitHub repositories or local filesystems, written in Rust.
This MCP server provides drop-in compatibility with the basic memory protocol while offering powerful features like:
- GitHub Storage: Store memories in GitHub repositories with full version history
- Local Storage: Offline-first local filesystem storage for air-gapped environments
- Fast Search: Embedded full-text search using milli-core (LMDB) with BM25 ranking
- Encryption: Optional end-to-end encryption using age X25519
- Multi-Project: Organize memories across isolated projects
- Auto-Sync: Automatic push to remote after every write operation
# Clone the repository
git clone https://github.com/yourusername/mcp-github-memory-server.git
cd mcp-github-memory-server
# Build the release binary
cargo build --release --features backend-github,index-tantivy,encryption,mcp-gitmem-storage-github/remote-git
# Install using the provided script
./scripts/install.shmacOS Users: If you encounter "Killed: 9" errors, run:
./scripts/fix-macos-security.shSee docs/troubleshooting/macos-security.md for details.
-
Get a GitHub Personal Access Token (for GitHub storage):
- Visit: https://github.com/settings/tokens
- Create a token with
reposcope - Save the token securely
-
Configure your MCP client (e.g., Cursor):
Create or edit ~/.cursor/mcp.json:
{
"mcpServers": {
"gitmem": {
"command": "/usr/local/bin/gitmem",
"args": ["serve", "--config", "/path/to/gitmem.yaml"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}- Create a configuration file (e.g.,
~/.config/gitmem.yaml):
server:
transport: stdio
storage:
backend: github
github:
root: /Users/yourname/memory
auto_push: true
remote_url: https://github.com/yourusername/memory.git
credentials:
mode: token
username: x-access-token
secret_env: GITHUB_TOKEN
encryption:
enabled: false
index:
engine: tantivy- Restart your MCP client to load the new configuration.
┌─────────────────────────────────────────────────────────────────┐
│ MCP Client (IDE, Agent) │
│ JSON-RPC over stdio or WebSocket │
└──────────────┬──────────────────────────────────────────────────┘
│
JSON-RPC server (MCP)
│
┌──────────────▼─────────────────────┐
│ Memory Service Layer │
│ validation, ID generation, merge │
└──────────────┬─────────────────────┘
│
Storage abstraction
┌─────────┴───────────┬────────────┐
│ │ │
┌────▼────┐ ┌─────▼─────┐ ┌────▼─────┐
│ GitHub │ │ Local FS │ │ Ephemeral│
│ adapter │ │ adapter │ │ adapter │
└────┬────┘ └─────┬─────┘ └────┬─────┘
│ │ │
│ ┌────────────▼────────────┐
│ │ Search Index Engine │
│ │ (milli-core or Tantivy)│
│ └────────────┬────────────┘
│ │
│ ┌────────────▼────────────┐
│ │ Crypto (optional) │
│ │ age X25519 │
│ └─────────────────────────┘
Full compatibility with the basic memory protocol plus extended features:
Core Memory Operations:
memory.save- Create new memoriesmemory.get- Retrieve by IDmemory.search- Full-text search with filtersmemory.update- Patch existing memoriesmemory.delete- Soft or hard deletememory.import.basic- Import from JSONLmemory.sync- Sync with storage backend
Project Management:
list_memory_projects- List all projectscreate_memory_project- Create new projectdelete_memory_project- Remove project
Knowledge Base (Basic Memory compatibility):
write_note,read_note,edit_note,delete_notesearch_notes,recent_activity,build_contextmove_note- Move notes between projects
External Folder Linking:
project.link_folder- Link external folders (e.g., Obsidian vaults)project.unlink_folder- Remove linked foldersproject.list_links- List all folder links
GitHub Storage:
- Full git history and audit trail
- Device-specific branches (
devices/<hostname>) - Auto-push on every write (optional)
- Conflict resolution with three-way merge
- Pull request workflow (optional)
Local Storage:
- Offline-first operation
- Atomic file operations with fsync
- File locks for concurrent access
- Same on-disk layout as GitHub for easy migration
- milli-core (default): Embedded LMDB index with BM25 scoring
- Tantivy (optional): Alternative high-performance search engine
- Async indexing: Non-blocking index updates via background worker
- TTL enforcement: Automatic expiry at query time
- Field boosting: Prioritize title matches over content
- Optional encryption: Age X25519 end-to-end encryption
- Multiple recipients: Share encrypted memories securely
- Credential management: Environment variables, OS keychain, or helpers
- Least privilege: Fine-grained GitHub token scopes
- PII redaction: Configurable content filters
- SPEC.md - Complete technical specification
- AGENTS.md - Development guide for humans and AI agents
- INSTALL.md - Detailed installation instructions
- Integration Guide - Cursor/Codex configuration
- Migration Guide - Migrating from basic memory
- Troubleshooting - Common issues and solutions
- Rust 1.89.0 or later (specified in
rust-toolchain.toml) - Git
- Optional: Docker for containerized builds
# Default build with milli-core index
cargo build --workspace
# With all features
cargo build --workspace --features backend-github,backend-local,index-tantivy,encryption,transport-stdio,mcp-gitmem-storage-github/remote-git
# With real Tantivy backend (non-Apple ARM)
cargo build --workspace --features real_tantivy,backend-github,index-tantivy,encryption
# Release build
cargo build --release --features backend-github,index-tantivy,encryption,mcp-gitmem-storage-github/remote-git# Run all tests
cargo test --workspace
# Run with all features
cargo test --workspace --all-features
# Run benchmarks
cargo bench -p mcp-gitmem-benchmarks --bench performance# Format code
cargo fmt --all
# Run linter
cargo clippy --all-targets -- -D warnings -D clippy::pedantic -A clippy::module_name_repetitions
# Check for security issues
cargo audit.
├── crates/
│ ├── core/ # Domain model, validation, types
│ ├── proto/ # MCP protocol definitions
│ ├── storage/
│ │ ├── github/ # GitHub adapter
│ │ ├── local/ # Local filesystem adapter
│ │ └── ephemeral/ # In-memory adapter (testing)
│ ├── index/
│ │ └── tantivy/ # Search index implementations
│ ├── crypto/ # Encryption (age X25519)
│ ├── server/ # MCP server runtime
│ ├── cli/ # Command-line interface
│ ├── compat/ # Basic memory compatibility
│ ├── testing/ # Test utilities and fixtures
│ └── benchmarks/ # Performance benchmarks
├── docs/ # Documentation
├── examples/ # Sample configurations
└── scripts/ # Installation and utility scripts
- Save: p50 < 5ms (local), < 50ms (with GitHub batch push)
- Search: p95 < 50ms on 50k memories
- Import: > 1k writes/sec to local index
- Memory: < 50 MiB baseline idle
See benchmarks for detailed performance data.
Contributions are welcome! Please read AGENTS.md for:
- Architecture guidelines
- Coding standards
- Testing requirements
- Submission process
- Fork the repository
- Create a feature branch
- Make your changes following the coding standards
- Run tests and linters
- Submit a pull request
- ✅ Basic memory protocol compatibility
- ✅ GitHub and local storage backends
- ✅ Full-text search with milli-core
- ✅ Optional encryption
- ✅ Auto-push support
- ✅ External folder linking
- Webhook support for remote sync
- Automatic PR workflow
- Conflict resolution UI
- Enhanced observability (OpenTelemetry)
- Optional embeddings with local models
- Hybrid search (BM25 + vector)
- Re-ranking strategies
- Native platform watchers for linked folders
- Multi-tenant support
- Per-tenant encryption keys
- Policy-based access control
- Collaborative memory workflows
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
- Built on the Model Context Protocol
- Inspired by the basic memory MCP servers
- Powered by milli and Tantivy
- Encryption via age
- Issues: GitHub Issues
- Documentation: docs/
- Discussions: GitHub Discussions
Made with ❤️ by the MCP GitMem Team