-
-
Notifications
You must be signed in to change notification settings - Fork 0
Contributing
Thank you for your interest in contributing to MCP Agent Toolkit! This guide will help you get started.
Please note that this project follows our Code of Conduct. By participating, you are expected to uphold this code.
- π Report bugs
- π‘ Suggest new features
- π Improve documentation
- π§ Submit bug fixes
- β¨ Add new features
- π§ͺ Write tests
- π¨ Improve code quality
Before you begin, ensure you have the following installed:
- Node.js: v18.x or higher
- npm: v8.x or higher
- Git: Latest version
Check your versions:
node --version # Should be v18 or higher
npm --version # Should be v8 or higher
git --version# Fork the repository on GitHub, then:
git clone https://github.com/YOUR-USERNAME/mcp-agents.git
cd mcp-agents
npm installnpm run buildnpm testgit checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fixmcp-agents/
βββ packages/
β βββ smart-reviewer/ # Code review tool
β βββ test-generator/ # Test generation
β βββ architecture-analyzer/ # Architecture analysis
β βββ security-scanner/ # Security scanning
β βββ refactor-assistant/ # Code refactoring
β βββ api-designer/ # API design
β βββ db-schema/ # Database schema
β βββ doc-generator/ # Documentation
β βββ orchestrator-mcp/ # Workflow orchestration
β βββ config-wizard/ # Installation wizard
β βββ shared/ # Shared utilities (private)
βββ docs/ # Documentation
βββ scripts/ # Build and utility scripts
βββ tests/ # Integration tests
# Build specific package
npm run build -w packages/smart-reviewer
# Run tests for specific package
npm test -w packages/smart-reviewer
# Watch mode for development
npm run dev -w packages/smart-reviewerWe use:
- TypeScript for type safety
- ES Modules (import/export)
- Prettier for formatting
- ESLint for linting
Run formatters before committing:
npm run format # Format all files
npm run lint # Check for lint errors
npm run lint:fix # Auto-fix lint issues# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Run in CI mode (no watch)
npm run test:ci
# Run tests for specific package
npm test -w packages/smart-reviewerTesting Requirements:
- All new features must have tests
- Aim for >70% code coverage
- Test edge cases and error handling
- Use descriptive test names
We use Vitest. Example test structure:
import { describe, it, expect } from 'vitest';
import { MyClass } from './my-class.js';
describe('MyClass', () => {
describe('myMethod', () => {
it('should handle valid input', () => {
const instance = new MyClass();
const result = instance.myMethod('test');
expect(result).toBe('expected output');
});
it('should throw error for invalid input', () => {
const instance = new MyClass();
expect(() => instance.myMethod(null)).toThrow();
});
it('should handle edge cases', () => {
const instance = new MyClass();
expect(instance.myMethod('')).toBe('');
expect(instance.myMethod('a'.repeat(1000))).toBeDefined();
});
});
});Follow the established refactoring pattern:
-
Extract Constants β
constants/directory- Magic numbers, thresholds, patterns
- Single source of truth
-
Extract Helpers β
helpers/directory- Complex calculations (>30 lines)
- Reusable business logic
-
Extract Utilities β
utils/directory- Cross-cutting concerns
- Shared code across modules
Example Structure:
packages/my-tool/src/
βββ mcp-server.ts # MCP protocol orchestration
βββ main-class.ts # Main logic (delegates to modules)
βββ constants/
β βββ thresholds.ts
β βββ patterns.ts
βββ helpers/
β βββ calculator.ts
β βββ validator.ts
βββ utils.ts # Shared utilities
Import from @j0kz/shared for common functionality:
import {
FileSystemManager,
AnalysisCache,
PerformanceMonitor,
validatePath
} from '@j0kz/shared';
// Use shared utilities
const fs = new FileSystemManager();
const cache = new AnalysisCache<AnalysisResult>();
const perf = new PerformanceMonitor();
// Validate paths to prevent traversal attacks
validatePath(filePath);All tools follow this structure:
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import {
ListToolsRequestSchema,
CallToolRequestSchema
} from '@modelcontextprotocol/sdk/types.js';
const server = new Server({
name: 'my-tool',
version: '1.0.0'
}, {
capabilities: {
tools: {}
}
});
// Register tools
server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [
{
name: 'my_tool',
description: 'Description of what it does',
inputSchema: {
type: 'object',
properties: {
param: { type: 'string', description: 'Parameter description' }
},
required: ['param']
}
}
]
}));
// Handle tool calls
server.setRequestHandler(CallToolRequestSchema, async (request) => {
const { name, arguments: args } = request.params;
if (name === 'my_tool') {
const result = await doWork(args);
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }]
};
}
throw new Error(`Unknown tool: ${name}`);
});
// Start server
const transport = new StdioServerTransport();
await server.connect(transport);- Follow the code style guide
- Add/update tests
- Update documentation
- Keep commits atomic and focused
We use Conventional Commits:
# Feature
git commit -m "feat: add auto-fix for unused variables"
# Bug fix
git commit -m "fix: handle null values in analyzer"
# Documentation
git commit -m "docs: update API reference for security-scanner"
# Refactor
git commit -m "refactor: extract validation logic to helpers"
# Test
git commit -m "test: add edge cases for circular dependency detection"
# Chore
git commit -m "chore: update dependencies"Format:
type(scope): description
[optional body]
[optional footer]
Types:
-
feat: New feature -
fix: Bug fix -
docs: Documentation only -
style: Formatting, missing semi-colons, etc. -
refactor: Code change that neither fixes a bug nor adds a feature -
test: Adding missing tests -
chore: Maintaining, dependencies, etc.
git push origin feature/your-feature-nameThen create a pull request on GitHub with:
- Clear title describing the change
- Detailed description of what changed and why
- Reference any related issues (#123)
- Screenshots/examples if applicable
- Respond to feedback promptly
- Make requested changes
- Keep the PR focused and small
- Don't force-push after review starts (makes reviewing harder)
If your change affects user-facing functionality:
- Update README - Main repository README.md
- Update Package README - packages/YOUR_PACKAGE/README.md
- Update Wiki - Create/update wiki pages
- Update CHANGELOG - Add entry to CHANGELOG.md
- Update API Docs - JSDoc comments in code
- Use clear, concise language
- Include code examples
- Explain the "why", not just the "what"
- Add before/after examples for changes
- Link to related documentation
- Check existing issues
- Try the latest version
- Read the troubleshooting guide
**Describe the bug**
A clear description of what the bug is.
**To Reproduce**
Steps to reproduce:
1. Run command '...'
2. With input '...'
3. See error
**Expected behavior**
What you expected to happen.
**Actual behavior**
What actually happened.
**Environment:**
- OS: [e.g., Windows 11]
- Node version: [e.g., 20.10.0]
- Package version: [e.g., 1.0.35]
- Editor: [e.g., Claude Code, Cursor]
**Additional context**
Any other relevant information.- Check if it already exists
- Search closed issues
- Consider if it fits the project scope
**Problem Statement**
What problem does this feature solve?
**Proposed Solution**
How should this feature work?
**Alternatives Considered**
What other solutions did you consider?
**Additional Context**
Any other relevant information.Contributors will be:
- Listed in CHANGELOG.md
- Mentioned in release notes
- Added to GitHub contributors list
- Credited in relevant documentation
- GitHub Discussions: Ask questions
- GitHub Issues: Report bugs or request features
- Wiki: Read documentation
- Discord: Join our community (coming soon)
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing! π