First off, thank you for considering contributing to Memory Graph! 🎉
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.
Before creating bug reports, please check existing issues. When you create a bug report, include as many details as possible:
- Use a clear and descriptive title
- Describe the exact steps to reproduce the problem
- Provide specific examples (JSON payloads, error messages)
- Describe the behavior you observed and what you expected
- Include your environment (OS, Rust version, MCP client)
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion:
- Use a clear and descriptive title
- Provide a detailed description of the suggested enhancement
- Explain why this enhancement would be useful
- List any alternatives you've considered
-
Fork the repo and create your branch from
main:git checkout -b feature/amazing-feature
-
Make your changes:
- Follow the existing code style
- Add tests if applicable
- Update documentation if needed
-
Run the test suite:
cargo test cargo clippy cargo fmt --check -
Commit your changes:
git commit -m "Add amazing feature" -
Push to your fork:
git push origin feature/amazing-feature
-
Open a Pull Request
- Rust 1.70+ (
rustup update stable) - Git
git clone https://github.com/maithanhduyan/memory-graph.git
cd memory-graph
cargo build# Run all tests
cargo test
# Run with output
cargo test -- --nocapture
# Run specific test
cargo test test_concurrent_accessWe use standard Rust formatting:
# Format code
cargo fmt
# Check for issues
cargo clippymemory-graph/
├── memory.rs # Main implementation (single file)
├── Cargo.toml # Dependencies
├── memory.jsonl # Knowledge graph data (runtime)
├── Dockerfile # Container build
├── README.md # Documentation
├── CHANGELOG.md # Version history
├── CONTRIBUTING.md # This file
└── .github/
└── workflows/
└── rust.yml # CI/CD
The codebase is organized into sections within memory.rs:
- Types - Core data structures (
Entity,Relation,KnowledgeGraph) - Validation - Standard types and validation functions
- Synonym Dictionary - Semantic search word groups
- KnowledgeBase - Thread-safe storage with Mutex
- Tools - Individual MCP tool implementations
- MCP Server - JSON-RPC protocol handler
- Tests - Unit and concurrency tests
- Create a struct implementing the
Tooltrait:
pub struct MyNewTool {
kb: std::sync::Arc<KnowledgeBase>,
}
impl Tool for MyNewTool {
fn definition(&self) -> McpTool {
McpTool {
name: "my_new_tool".to_string(),
description: "Description here".to_string(),
input_schema: json!({
"type": "object",
"properties": {
// Define parameters
},
"required": []
}),
}
}
fn execute(&self, params: Value) -> McpResult<Value> {
// Implementation
Ok(json!({
"content": [{
"type": "text",
"text": "Result"
}]
}))
}
}- Register the tool in
main():
server.register_tool(Box::new(MyNewTool::new(kb.clone())));- Add tests and update documentation.
- Use present tense ("Add feature" not "Added feature")
- Use imperative mood ("Move cursor to..." not "Moves cursor to...")
- Keep the first line under 72 characters
- Reference issues when applicable
Examples:
Add temporal query support for relationsFix race condition in concurrent writesUpdate README with Docker instructions
Feel free to open an issue with the question label or reach out to the maintainers.
Thank you for contributing! 🙏