Thank you for your interest in contributing to CodeSight MCP Server! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Workflow
- Pull Request Process
- Coding Standards
- Testing Guidelines
- Documentation Guidelines
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.
- Node.js: v20 LTS or higher
- Rust: 1.75 or higher (for FFI bridge development)
- NAPI-RS CLI:
npm install -g @napi-rs/cli
# Clone the repository
git clone https://github.com/your-org/codesight-mcp.git
cd codesight-mcp
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test# Start development environment
docker-compose -f docker-compose.dev.yml up -d
npm run dev
# Build Rust FFI bridge (optional)
cd rust-core
cargo build --release
cd ../typescript-mcpFork the repository on GitHub and clone your fork locally.
git clone https://github.com/your-username/codesight-mcp.git
cd codesight-mcp
git remote add upstream https://github.com/your-org/codesight-mcp.gitCreate a new branch for your feature or bug fix.
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-fix-name- Follow the Coding Standards
- Write tests for your changes
- Update documentation as needed
- Ensure all tests pass
Write clear and descriptive commit messages.
git add .
git commit -m "feat: add new MCP tool for code analysis
- Implement code analysis functionality
- Add comprehensive tests
- Update documentation
Closes #123"git push origin feature/your-feature-nameThen create a Pull Request on GitHub.
- Title: Clear and descriptive title following Conventional Commits
- Description: Detailed description of changes
- Tests: All tests must pass
- Documentation: Update relevant documentation
- Breaking Changes: Clearly document any breaking changes
## Changes
- [ ] Describe the changes made in this PR
## Testing
- [ ] Describe how you tested these changes
- [ ] All tests pass locally
## Documentation
- [ ] Relevant documentation updated
- [ ] README updated if needed
## Breaking Changes
- [ ] No breaking changes
- [ ] Breaking changes described:
## Checklist
- [ ] Code follows project standards
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] PR title follows conventional commits- Automated Checks: All CI checks must pass
- Code Review: At least one maintainer review required
- Feedback: Address review comments
- Approval: Maintainer approval required for merge
- Use TypeScript 5.3+ features appropriately
- Follow strict TypeScript configuration
- Use proper type annotations
- Implement error handling with proper types
// β
Good
interface SearchResult {
id: string;
name: string;
relevance: number;
}
async function searchCode(query: string): Promise<SearchResult[]> {
try {
const results = await indexingService.search(query);
return results;
} catch (error) {
logger.error('Search failed:', error);
throw new Error(`Search failed: ${error.message}`);
}
}
// β Bad
async function searchCode(query) {
return indexingService.search(query);
}- Follow Rust 2021 edition
- Use
clippyfor linting - Implement proper error handling
- Use
serdefor serialization
// β
Good
use napi_derive::napi;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug)]
#[napi(object)]
pub struct CodeEntity {
pub id: String,
pub name: String,
pub entity_type: String,
pub file_path: String,
}
#[napi]
pub fn parse_code(file_path: String) -> Result<Vec<CodeEntity>> {
// Implementation
}typescript-mcp/
βββ src/
β βββ tools/ # MCP tool implementations
β βββ services/ # Core services
β βββ cli/ # CLI commands
β βββ ffi/ # FFI bridge integration
β βββ types/ # TypeScript definitions
βββ tests/
β βββ unit/ # Unit tests
β βββ integration/ # Integration tests
β βββ contract/ # MCP protocol tests
βββ docs/ # Documentation
- Unit Tests: Test individual functions and components
- Integration Tests: Test component interactions
- Contract Tests: Test MCP protocol compliance
// β
Good test example
describe('SearchCodeTool', () => {
let searchCodeTool: SearchCodeTool;
beforeEach(() => {
searchCodeTool = new SearchCodeTool();
});
describe('execute', () => {
it('should return search results for valid query', async () => {
const result = await searchCodeTool.execute({
query: 'authentication function',
limit: 10
});
expect(result).toHaveProperty('results');
expect(Array.isArray(result.results)).toBe(true);
expect(result.results.length).toBeGreaterThan(0);
});
it('should handle empty query gracefully', async () => {
const result = await searchCodeTool.execute({
query: '',
limit: 10
});
expect(result.results).toEqual([]);
});
});
});- Maintain minimum 80% test coverage
- All critical paths must be covered
- Include both success and error cases
- Test edge cases and boundary conditions
# Run all tests
npm test
# Run specific test suites
npm run test:unit
npm run test:integration
npm run test:contract
# Run with coverage
npm run test:coverage
# Watch mode for development
npm run test:watch- Use JSDoc for TypeScript functions and classes
- Document public APIs thoroughly
- Include examples for complex functionality
/**
* Search for code entities using natural language queries
* @param query - Natural language search query
* @param limit - Maximum number of results to return
* @returns Promise<SearchResult[]> Array of search results
* @example
* const results = await searchCode('authentication functions', 10);
*/
export async function searchCode(
query: string,
limit: number = 10
): Promise<SearchResult[]> {
// Implementation
}- Update README for new features or breaking changes
- Include installation and usage instructions
- Add performance benchmarks for significant changes
- Document all MCP tools and their parameters
- Include request/response examples
- Document error cases and handling
Contributors will be recognized in:
- Contributors file
- Release notes for significant contributions
- GitHub repository contributors section
- Discord: Community Server
- GitHub Issues: Create an issue
- Documentation: Project Documentation
By contributing to this project, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to CodeSight MCP Server! π