Thank you for your interest in contributing to MCPKit! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Setup
- Project Structure
- Development Workflow
- Code Standards
- Testing
- Commit Guidelines
- Pull Request Process
- Release Process
By participating in this project, you agree to maintain a respectful and inclusive environment for everyone. Please be kind, considerate, and constructive in all interactions.
- Node.js: >= 18.0.0
- npm: >= 10.9.0
- Git: Latest stable version
-
Fork the repository on GitHub
-
Clone your fork:
git clone https://github.com/<your-username>/mcpkit.git cd mcpkit
-
Add upstream remote:
git remote add upstream https://github.com/anthropics/mcpkit.git
-
Install dependencies:
npm install
-
Build all packages:
npm run build
-
Run tests to verify setup:
npm run test
MCPKit is a Turborepo monorepo with the following structure:
mcpkit/
├── packages/
│ ├── core/ # Core decorators and server framework (@mcpkit-dev/core)
│ ├── cli/ # CLI tool for project scaffolding (@mcpkit-dev/cli)
│ └── testing/ # Testing utilities and mock clients (@mcpkit-dev/testing)
├── examples/
│ └── weather-server/ # Working example project
├── scripts/
│ └── release.sh # Automated release script
├── biome.json # Code formatting and linting config
├── tsconfig.base.json # Shared TypeScript configuration
└── turbo.json # Turborepo pipeline configuration
- @mcpkit-dev/core: The main package containing decorators, transports, and server logic
- @mcpkit-dev/cli: Depends on core for scaffolding templates
- @mcpkit-dev/testing: Testing utilities that work with core
| Script | Description |
|---|---|
npm run build |
Build all packages |
npm run dev |
Watch mode for development |
npm run test |
Run all tests |
npm run typecheck |
TypeScript type checking |
npm run lint |
Run Biome linter |
npm run lint:fix |
Fix linting issues |
npm run format |
Format code with Biome |
npm run check |
Run full Biome check (lint + format) |
npm run check:fix |
Fix all Biome issues |
npm run clean |
Remove build artifacts |
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes in the appropriate package(s)
-
Run checks locally:
npm run check # Lint and format check npm run typecheck # Type checking npm run test # Run tests
-
Build to verify:
npm run build
The project uses strict TypeScript with the following key settings:
- Target: ES2022
- Module: NodeNext
- Strict mode enabled
- Experimental decorators enabled
- No unused locals/parameters
- No unchecked indexed access
We use Biome for linting and formatting. Key style rules:
- Indentation: 2 spaces
- Line width: 100 characters
- Quotes: Single quotes
- Semicolons: Always
- Trailing commas: All (in JS/TS)
- Arrow function parentheses: Always
Run npm run check:fix to automatically fix most issues.
- Write TypeScript with proper types - avoid
anywhen possible - Use
constby default,letonly when reassignment is needed - Prefer
import typefor type-only imports - Include JSDoc comments for public APIs
- Keep functions small and focused
- Use descriptive variable and function names
- Handle errors appropriately with custom error types
import type { ToolConfig } from './types';
import { Tool } from '../decorators';
import { MCPKitError } from '../errors';
/**
* Executes a tool with the given configuration.
* @param config - The tool configuration
* @returns The execution result
* @throws {MCPKitError} When execution fails
*/
@Tool({ name: 'example' })
export const executeTool = async (config: ToolConfig): Promise<Result> => {
if (!config.name) {
throw new MCPKitError('Tool name is required');
}
return performExecution(config);
};We use Vitest for testing with the following configuration:
- Test files:
**/*.test.ts(colocated with source files) - Environment: Node.js
- Coverage provider: V8
# Run all tests
npm run test
# Run tests in watch mode (in a specific package)
cd packages/core
npm run test:watch
# Run tests with coverage
npm run test -- --coverage- Place test files alongside source files with
.test.tsextension - Write descriptive test names that explain the expected behavior
- Test both success and error cases
- Use the testing utilities from
@mcpkit-dev/testingfor MCP-specific tests
import { describe, it, expect } from 'vitest';
import { MyClass } from './my-class';
describe('MyClass', () => {
describe('myMethod', () => {
it('should return expected value when given valid input', () => {
const instance = new MyClass();
const result = instance.myMethod('valid');
expect(result).toBe('expected');
});
it('should throw error when given invalid input', () => {
const instance = new MyClass();
expect(() => instance.myMethod('')).toThrow('Invalid input');
});
});
});We follow Conventional Commits:
<type>(<scope>): <description>
[optional body]
[optional footer]
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringperf: Performance improvementstest: Adding or updating testschore: Maintenance tasksci: CI/CD changes
core: Changes to @mcpkit-dev/corecli: Changes to @mcpkit-dev/clitesting: Changes to @mcpkit-dev/testingdeps: Dependency updatesrelease: Release-related changes
feat(core): add support for streaming responses
fix(cli): resolve template generation on Windows
docs: update installation instructions
test(core): add unit tests for Tool decorator
chore(deps): update typescript to 5.7.2
-
Sync with upstream:
git fetch upstream git rebase upstream/main
-
Run the full check suite:
npm run prepublish:check
-
Update documentation if needed
-
Add tests for new functionality
- Use a clear, descriptive title following commit conventions
- Fill out the PR template completely
- Link related issues using keywords (
Fixes #123,Closes #456) - Keep PRs focused - one feature or fix per PR
- Respond to review feedback promptly
- Automated checks must pass (lint, tests, build)
- At least one maintainer approval required
- All review comments must be addressed
- Branch must be up to date with main
Releases are managed by maintainers using the release script. The process:
- Ensure clean working directory
- Run all checks and tests
- Bump version (patch/minor/major)
- Create git commit and tag
- Publish to npm
We follow Semantic Versioning:
- PATCH: Bug fixes, backwards compatible
- MINOR: New features, backwards compatible
- MAJOR: Breaking changes
All notable changes are documented in CHANGELOG.md following the Keep a Changelog format.
If you have questions about contributing:
- Check existing issues and discussions
- Open a new issue or discussion if needed
- Reach out to maintainers
Thank you for contributing to MCPKit!