Thank you for your interest in contributing to mcp-contract-kit!
- Fork the repository
- Clone your fork:
git clone https://github.com/your-name/mcp-contract-kit.git - Install dependencies:
npm install - Build:
npm run build - Test:
npm run test
- Node.js 22 LTS
- npm 10+
# Clone and install
git clone https://github.com/reaatech/mcp-contract-kit.git
cd mcp-contract-kit
npm install
# Build
npm run build
# Run tests
npm run test- Use TypeScript for all new code
- Follow existing patterns in the codebase
- Run
npm run lintbefore committing - Run
npm run formatto auto-format
# Run all tests
npm run test
# Run with coverage
npm run test:coverage
# Run in watch mode
npm run test:watch
# Run specific test file
npx vitest run tests/unit/schemas.test.tsCreate src/validators/<category>/my-validator.ts:
import { Validator, TestResult, ValidationContext, TestCategory, Severity } from '../../types/domain.js';
import { now } from '../../utils/index.js';
export const myValidator: Validator = {
name: 'my-validator',
category: TestCategory.MY_CATEGORY,
severity: Severity.WARNING,
async validate(context: ValidationContext): Promise<TestResult> {
const start = performance.now();
const errors: string[] = [];
try {
// Validation logic here
} catch (error) {
errors.push(`Validation failed: ${(error as Error).message}`);
}
if (errors.length === 0) {
return {
validator: this.name,
category: this.category,
passed: true,
severity: Severity.INFO,
message: 'Validation passed',
durationMs: Math.round(performance.now() - start),
timestamp: now(),
};
}
return {
validator: this.name,
category: this.category,
passed: false,
severity: this.severity,
message: `Validation failed with ${errors.length} error(s)`,
remediation: 'Fix the issues described above.',
details: { errors },
durationMs: Math.round(performance.now() - start),
timestamp: now(),
};
},
};Add to src/validators/<category>/index.ts:
export { myValidator } from './my-validator.js';Create tests/unit/my-validator.test.ts:
import { describe, expect, it } from 'vitest';
import { myValidator } from '../../src/validators/<category>/my-validator.js';
describe('myValidator', () => {
it('passes when conditions are met', async () => {
const context = createMockContext();
const result = await myValidator.validate(context);
expect(result.passed).toBe(true);
});
it('fails when conditions are not met', async () => {
// Test implementation
});
});mcp-contract-kit/
├── src/
│ ├── cli.ts # CLI entry point
│ ├── index.ts # Library entry point
│ ├── runner.ts # Test runner orchestrator
│ ├── types/ # Type definitions and schemas
│ ├── validators/ # Test validators
│ │ ├── registry/ # Registry compliance
│ │ ├── protocol/ # Protocol conformance
│ │ ├── routing/ # Routing contract
│ │ ├── security/ # Security validation
│ │ └── performance/ # Performance validation
│ ├── reporters/ # Output formatters
│ ├── mcp-client/ # MCP test client
│ └── observability/ # Logging, tracing, metrics
├── tests/
│ ├── unit/ # Unit tests
│ ├── integration/ # Integration tests
│ ├── e2e/ # End-to-end tests
│ └── fixtures/ # Test fixtures
├── skills/ # Skill definitions
├── docs/ # Documentation
└── scripts/ # Utility scripts
Use conventional commits:
feat: add new validatorfix: resolve bug in rate-limit validatordocs: update VALIDATORS.mdtest: add tests for concurrency validatorrefactor: simplify error handling
- Create a feature branch:
git checkout -b feat/my-feature - Make your changes
- Add tests for your changes
- Ensure all tests pass:
npm run test - Ensure coverage is maintained:
npm run test:coverage - Run lint and format:
npm run lint && npm run format - Push and create PR
- Address review feedback
When reporting issues, include:
- Node.js version
- Operating system
- mcp-contract-kit version
- Steps to reproduce
- Expected vs actual behavior
- Error messages or logs
By contributing, you agree that your contributions will be licensed under the MIT License.