# Contributing to CodeWiki MCP Server
Thank you for your interest in contributing to the CodeWiki MCP Server! This document provides guidelines and information for contributors.
## Table of Contents
- [Code of Conduct](#code-of-conduct)
- [Getting Started](#getting-started)
- [Development Workflow](#development-workflow)
- [Pull Request Process](#pull-request-process)
- [Coding Standards](#coding-standards)
- [Testing](#testing)
- [Documentation](#documentation)
- [Security](#security)
- [Community](#community)
## Code of Conduct
This project follows the [Contributor Covenant Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). Please read and follow these guidelines in all interactions with the project.
## Getting Started
### Prerequisites
- Node.js 16+
- npm or yarn
- Git
- TypeScript knowledge
### Setup
1. **Fork the repository**
```bash
# Fork on GitHub, then clone your fork
git clone https://github.com/YOUR_USERNAME/codewiki-mcp-server.git
cd codewiki-mcp-server
```
2. **Install dependencies**
```bash
npm install
```
3. **Set up development environment**
```bash
npm run dev
```
4. **Create a feature branch**
```bash
git checkout -b feature/your-feature-name
```
## Development Workflow
### 1. Create an Issue
Before starting work:
- Check if an issue already exists for your change
- Create a new issue if needed
- Discuss the approach in the issue comments
- Wait for feedback from maintainers
### 2. Development
- Write code following our [coding standards](#coding-standards)
- Add tests for new functionality
- Update documentation as needed
- Commit frequently with clear messages
### 3. Testing
- Run the test suite: `npm test`
- Ensure all tests pass
- Add new tests for new features
- Test manually with real-world scenarios
### 4. Submit Pull Request
- Create a pull request with a clear title and description
- Link to related issues
- Request review from maintainers
- Address feedback promptly
## Pull Request Process
### PR Checklist
Before submitting a PR, ensure:
- [ ] Code follows project style guidelines
- [ ] All tests pass
- [ ] New tests are added for new functionality
- [ ] Documentation is updated
- [ ] Commit messages are clear and descriptive
- [ ] PR description explains the changes
- [ ] Linked to any relevant issues
### PR Template
```markdown
## Description
Brief description of changes made.
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] All tests pass
- [ ] New tests added
- [ ] Manual testing completed
## Issues Fixed
Closes #issue_number
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
```
## Coding Standards
### TypeScript Guidelines
- Use TypeScript strictly mode
- Define interfaces for all data structures
- Use arrow functions for callbacks
- Prefer `const` over `let`
- Use meaningful variable and function names
### Code Style
- Follow the existing code format
- Use 2 spaces for indentation
- Include JSDoc comments for public functions
- Keep functions small and focused
- Use error handling consistently
### Security Standards
- Validate all inputs
- Sanitize user data
- Handle sensitive data securely
- Follow OWASP guidelines
- No hardcoded secrets
## Testing
### Test Structure
- Unit tests for individual functions
- Integration tests for component interactions
- End-to-end tests for user workflows
### Running Tests
```bash
# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Run tests in watch mode
npm run test:watch
```
### Writing Tests
- Test both success and failure cases
- Use descriptive test names
- Mock external dependencies
- Test edge cases and boundary conditions
## Documentation
### Types of Documentation
1. **Code Documentation**
- JSDoc comments for functions
- Inline comments for complex logic
- Type definitions and interfaces
2. **User Documentation**
- README updates for new features
- Usage examples
- API documentation
3. **Developer Documentation**
- Architecture decisions
- Setup instructions
- Troubleshooting guides
### Documentation Standards
- Use clear, concise language
- Include code examples
- Update docs with code changes
- Follow markdown formatting
## Security
### Security Considerations
- Never commit sensitive information
- Validate all user inputs
- Use secure coding practices
- Report security vulnerabilities privately
### Security Checklist
- [ ] Input validation implemented
- [ ] Error handling doesn't expose sensitive data
- [ ] Dependencies are up to date
- [ ] No hardcoded secrets
- [ ] Secure defaults used
## Community
### Communication Channels
- **Issues**: For bug reports and feature requests
- **Discussions**: For general questions and ideas
- **PRs**: For code contributions
### Getting Help
- Read existing documentation
- Search existing issues
- Ask questions in discussions
- Join community calls (if available)
### Recognition
Contributors will be:
- Listed in README.md
- Mentioned in release notes
- Invited to contributor discussions
- Recognized in project communications
## Release Process
### Version Management
- Follow semantic versioning
- Update CHANGELOG.md for releases
- Tag releases appropriately
- Update package.json version
### Release Checklist
- [ ] All tests passing
- [ ] Documentation updated
- [ ] CHANGELOG updated
- [ ] Version bumped
- [ ] Release tag created
- [ ] Release notes published
## Additional Resources
- [TypeScript Handbook](https://www.typescriptlang.org/docs/)
- [Node.js Best Practices](https://github.com/goldbergyoni/nodebestpractices)
- [GitHub Docs](https://docs.github.com/)
- [MCP Specification](https://modelcontextprotocol.io/)
## Questions?
If you have questions about contributing:
1. Check existing documentation
2. Search existing issues and discussions
3. Create a new discussion
4. Contact maintainers directly
Thank you for contributing to CodeWiki MCP Server! 🎉