Thank you for your interest in contributing to MCP Memory Keeper! This guide will help you get started with contributing to the project.
- Code of Conduct
- Getting Started
- Development Setup
- How to Contribute
- Pull Request Process
- Coding Standards
- Testing Guidelines
- Documentation
- Community
By participating in this project, you agree to abide by our code of conduct:
- Be respectful: Treat everyone with respect. No harassment, discrimination, or inappropriate behavior.
- Be collaborative: Work together to solve problems and improve the project.
- Be constructive: Provide helpful feedback and accept criticism gracefully.
- Be inclusive: Welcome contributors of all backgrounds and experience levels.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/mcp-memory-keeper.git cd mcp-memory-keeper - Add upstream remote:
git remote add upstream https://github.com/mkreyman/mcp-memory-keeper.git
- Node.js 18+ and npm
- Git
- TypeScript knowledge
- Familiarity with MCP (Model Context Protocol)
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
# Run in development mode
npm run devmcp-memory-keeper/
├── src/
│ ├── index.ts # Main MCP server
│ ├── utils/ # Utility modules
│ │ ├── database.ts # Database operations
│ │ ├── validation.ts # Input validation
│ │ ├── git.ts # Git integration
│ │ ├── knowledge-graph.ts
│ │ ├── vector-store.ts
│ │ └── agents.ts
│ └── __tests__/ # Test files
├── dist/ # Built files
├── docs/ # Documentation
└── examples/ # Example usage
- Search existing issues to avoid duplicates
- Create a new issue with:
- Clear, descriptive title
- Steps to reproduce (for bugs)
- Expected vs actual behavior
- System information (OS, Node version)
- Error messages or logs
Issue Template:
## Description
Brief description of the issue
## Steps to Reproduce
1. Step one
2. Step two
3. ...
## Expected Behavior
What should happen
## Actual Behavior
What actually happens
## Environment
- OS: [e.g., macOS 14.0]
- Node: [e.g., 18.17.0]
- MCP Memory Keeper: [e.g., 0.8.0]- Check existing issues and discussions
- Open a feature request with:
- Use case description
- Proposed solution
- Alternative approaches
- Implementation considerations
- Look for issues labeled
good first issueorhelp wanted - Comment on the issue to claim it
- Ask questions if requirements are unclear
# Update your fork
git checkout main
git pull upstream main
git push origin main
# Create feature branch
git checkout -b feature/your-feature-name
# Or for bugs:
git checkout -b fix/issue-description- Write clean, documented code
- Follow existing patterns
- Add tests for new functionality
- Update documentation as needed
Follow conventional commits format:
# Format: <type>(<scope>): <subject>
# Examples:
git commit -m "feat(search): add semantic search capability"
git commit -m "fix(database): resolve connection pool leak"
git commit -m "docs(api): update context_save examples"
git commit -m "test(agents): add multi-agent coordination tests"
git commit -m "refactor(validation): simplify input validation logic"Types:
feat: New featurefix: Bug fixdocs: Documentation changestest: Test additions/changesrefactor: Code refactoringperf: Performance improvementschore: Maintenance tasks
# Run all checks
npm run lint
npm run type-check
npm test
npm run build
# Ensure no conflicts
git pull upstream main
git rebase upstream/main- Title: Use conventional commit format
- Description:
- Reference related issues (#123)
- Describe what changed and why
- Include screenshots for UI changes
- List breaking changes
- Size: Keep PRs focused and small
- Tests: Include tests for new code
PR Template:
## Description
Brief description of changes
## Related Issues
Closes #123
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Tests pass locally
- [ ] Added new tests
- [ ] Updated existing tests
## Checklist
- [ ] Code follows project style
- [ ] Self-reviewed code
- [ ] Updated documentation
- [ ] No console.logs left- Maintainers will review within 48-72 hours
- Address feedback constructively
- Push additional commits (don't force-push during review)
- Once approved, maintainer will merge
// Use explicit types
function processContext(items: ContextItem[]): ProcessedResult {
// Implementation
}
// Avoid any type
// Bad: let data: any = {};
// Good: let data: Record<string, unknown> = {};
// Use interfaces for objects
interface ContextItem {
id: string;
key: string;
value: string;
category?: ContextCategory;
priority?: Priority;
}
// Use enums for constants
enum Priority {
Critical = 'critical',
High = 'high',
Normal = 'normal',
Low = 'low',
}
// Document complex functions
/**
* Analyzes context items to extract entities and relationships
* @param items - Array of context items to analyze
* @param options - Analysis options
* @returns Extracted entities and relationships
*/
function analyzeContext(items: ContextItem[], options?: AnalysisOptions): AnalysisResult {
// Implementation
}// Use specific error types
class ValidationError extends Error {
constructor(
message: string,
public field?: string
) {
super(message);
this.name = 'ValidationError';
}
}
// Handle errors gracefully
try {
const result = await riskyOperation();
return result;
} catch (error) {
if (error instanceof ValidationError) {
// Handle validation error
throw new McpError(ErrorCode.INVALID_PARAMS, `Validation failed: ${error.message}`);
}
// Log unexpected errors
console.error('Unexpected error:', error);
throw new McpError(ErrorCode.INTERNAL_ERROR, 'An unexpected error occurred');
}- Use 2 spaces for indentation
- Use single quotes for strings
- Add trailing commas in multiline objects/arrays
- Maximum line length: 100 characters
- Use async/await over promises
- Prefer const over let
describe('ContextStorage', () => {
let storage: ContextStorage;
beforeEach(() => {
storage = new ContextStorage();
});
afterEach(() => {
storage.close();
});
describe('save', () => {
it('should save context with all fields', async () => {
const item = {
key: 'test_key',
value: 'test value',
category: 'task' as const,
priority: 'high' as const,
};
const result = await storage.save(item);
expect(result.id).toBeDefined();
expect(result.key).toBe(item.key);
});
it('should throw on duplicate key', async () => {
const item = { key: 'duplicate', value: 'value' };
await storage.save(item);
await expect(storage.save(item)).rejects.toThrow('Duplicate key');
});
});
});- Aim for 90%+ coverage
- Test edge cases and error conditions
- Include integration tests
- Test with real-world scenarios
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Run specific test file
npm test -- storage.test.ts
# Run in watch mode
npm run test:watch- Document all public APIs
- Include JSDoc comments for functions
- Add inline comments for complex logic
- Keep README.md up to date
When adding new features, include:
- API documentation in API.md
- Usage examples in EXAMPLES.md
- Common patterns in RECIPES.md
- Troubleshooting tips if applicable
Good commit messages help maintain project history:
# Good examples
feat(search): implement semantic search with vector embeddings
fix(database): prevent connection leak in transaction handler
docs(api): add examples for context_delegate tool
test(integration): add session branching test cases
# Bad examples
fix: fixed stuff
update code
WIP- Issues: For bugs and feature requests
- Discussions: For questions and ideas
- Discord: Join our Discord (if available)
Not just code! You can help by:
- Improving documentation
- Creating tutorials or blog posts
- Helping others in discussions
- Testing pre-releases
- Translating documentation
- Sharing the project
Contributors are recognized in:
- GitHub contributors page
- Release notes
- Annual contributor spotlight
-
Version Bumping: Follow semantic versioning
- MAJOR: Breaking changes
- MINOR: New features
- PATCH: Bug fixes
-
Release Notes: Include
- New features
- Bug fixes
- Breaking changes
- Contributors
-
Testing: All tests must pass
- Unit tests
- Integration tests
- Manual smoke tests
If you have questions about contributing:
- Check existing documentation
- Search closed issues
- Ask in discussions
- Contact maintainers
Thank you for contributing to MCP Memory Keeper! 🎉