This guide helps you set up MemoryGraph for development.
- Python 3.10 or higher
- Neo4j database (local or cloud)
- Git
- GitHub CLI (for issue management)
# Clone the repository
git clone https://github.com/gregorydickson/memory-graph.git
cd memory-graph
# Install in development mode
pip install -e ".[dev]"# Start Neo4j with Docker
docker run \
--name memorygraph-neo4j \
-p 7474:7474 -p 7687:7687 \
-d \
-e NEO4J_AUTH=neo4j/memory123 \
neo4j:latest
# Wait for Neo4j to start, then visit http://localhost:7474- Create account at https://neo4j.com/aura/
- Create new database instance
- Note the connection URI and credentials
# Copy environment template
cp .env.example .env
# Edit .env with your Neo4j credentials
NEO4J_URI=bolt://localhost:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=memory123# Run tests to verify setup
pytest
# Start the MCP server
python -m claude_memorymemory-graph/
├── src/claude_memory/ # Main source code
│ ├── __init__.py
│ ├── models.py # Data models
│ ├── database.py # Neo4j operations
│ ├── server.py # MCP server
│ └── __main__.py # Entry point
├── tests/ # Test suite
├── docs/ # Documentation
└── scripts/ # Utility scripts
# Format code
black src/ tests/
# Lint code
ruff check src/ tests/
# Type checking
mypy src/# Run all tests
pytest
# Run with coverage
pytest --cov=claude_memory
# Run specific test file
pytest tests/test_models.py# List current issues
gh issue list
# Create new issue
gh issue create --title "New feature" --body "Description"
# Work on issue #42
git checkout -b feature/issue-42
# ... make changes ...
git commit -m "feat: implement feature (closes #42)"
git push -u origin feature/issue-42
# Create pull request
gh pr create --title "Implement feature" --body "Closes #42"Add to your Claude Code MCP configuration file:
{
"mcpServers": {
"memorygraph": {
"command": "python",
"args": ["-m", "claude_memory"],
"env": {
"NEO4J_URI": "bolt://localhost:7687",
"NEO4J_USER": "neo4j",
"NEO4J_PASSWORD": "memory123"
}
}
}
}In Claude Code, you can now use:
# Store a memory
store_memory({
"type": "task",
"title": "Setup Database",
"content": "Configured Neo4j for memory storage",
"tags": ["setup", "database"]
})
# Search memories
search_memories({
"query": "database setup",
"memory_types": ["task"],
"limit": 5
})
The schema is automatically created when the server starts. To manually reinitialize:
from claude_memory.database import Neo4jConnection, MemoryDatabase
import asyncio
async def init_schema():
conn = Neo4jConnection()
conn.connect()
db = MemoryDatabase(conn)
await db.initialize_schema()
conn.close()
asyncio.run(init_schema())# Backup Neo4j database
docker exec memorygraph-neo4j neo4j-admin dump --database=neo4j --to=/backups/- Neo4j Browser: http://localhost:7474
- Cypher queries: Access through Neo4j Browser or Python scripts
export MEMORY_LOG_LEVEL=DEBUG
python -m claude_memoryConnection Failed
- Check Neo4j is running:
docker ps - Verify credentials in .env file
- Test connection:
bolt://localhost:7687
MCP Server Won't Start
- Check Python version:
python --version - Verify dependencies:
pip list | grep mcp - Review error logs
Memory Storage Issues
- Check Neo4j disk space
- Verify schema initialization
- Review constraint violations
# Get database statistics
from claude_memory.database import MemoryDatabase
stats = memory_db.get_memory_statistics()
print(stats)- Check existing issues:
gh issue list - Create issue if needed:
gh issue create - Create feature branch:
git checkout -b feature/issue-XX
- All new code must have tests
- Pass linting:
ruff check src/ tests/ - Pass type checking:
mypy src/ - Update documentation for new features
- Create PR:
gh pr create - Ensure CI passes
- Request review
- Update based on feedback
- Merge after approval
Add new memory types in models.py:
class MemoryType(str, Enum):
# ... existing types ...
CUSTOM_TYPE = "custom_type"Add new relationships in models.py:
class RelationshipType(str, Enum):
# ... existing types ...
CUSTOM_RELATION = "CUSTOM_RELATION"- Monitor query performance in Neo4j Browser
- Add indexes for new query patterns
- Use connection pooling for high load
- Issues: https://github.com/gregorydickson/memory-graph/issues
- Discussions: https://github.com/gregorydickson/memory-graph/discussions
- Documentation:
/docsfolder in repository