# Contributing to Token Optimizer MCP Thank you for your interest in contributing to Token Optimizer MCP! This document provides guidelines and information for contributors. ## Table of Contents - [Getting Started](#getting-started) - [Development Guidelines](#development-guidelines) - [Testing Requirements](#testing-requirements) - [Pull Request Process](#pull-request-process) - [Release Process](#release-process) ## Getting Started ### Prerequisites - **Node.js**: Version 20.x or higher - **npm**: Version 8.x or higher - **Git**: Latest stable version - **TypeScript**: 5.9+ (installed via npm) ### Initial Setup 1. **Fork and Clone** ```bash git clone https://github.com/YOUR_USERNAME/token-optimizer-mcp.git cd token-optimizer-mcp ``` 2. **Install Dependencies** ```bash npm install ``` 3. **Build the Project** ```bash npm run build ``` 4. **Verify Installation** ```bash npm test ``` ### Development Workflow 1. **Create a Feature Branch** ```bash git checkout -b feat/your-feature-name # or git checkout -b fix/your-bug-fix ``` 2. **Make Changes** - Write your code following our coding standards - Add tests for new functionality - Update documentation as needed 3. **Build and Test** ```bash npm run build npm test npm run lint ``` 4. **Commit Your Changes** ```bash git add . git commit -m "feat: add new feature" ``` 5. **Push and Create PR** ```bash git push origin feat/your-feature-name ``` ## Development Guidelines ### Code Style We use **ESLint** and **Prettier** to maintain consistent code style. - **Run linter**: `npm run lint` - **Auto-fix issues**: `npm run lint:fix` - **Format code**: `npm run format` - **Check formatting**: `npm run format:check` ### TypeScript Conventions 1. **Type Safety** - Always provide explicit types for function parameters and return values - Avoid using `any` - use `unknown` or proper types instead - Use TypeScript's strict mode features 2. **File Organization** - One primary export per file - Group related types and interfaces together - Use barrel exports (`index.ts`) for clean imports 3. **Naming Conventions** - **Files**: kebab-case (e.g., `smart-cache.ts`) - **Classes**: PascalCase (e.g., `CacheEngine`) - **Functions**: camelCase (e.g., `getCachedData`) - **Constants**: UPPER_SNAKE_CASE (e.g., `MAX_CACHE_SIZE`) - **Interfaces/Types**: PascalCase (e.g., `CacheOptions`) 4. **Error Handling** - Always handle errors explicitly - Use custom error classes for specific error types - Provide meaningful error messages ### Commit Message Format We follow **Conventional Commits** specification: ``` ():