|
| 1 | +# Test Projects for Code Index MCP |
| 2 | + |
| 3 | +This directory contains comprehensive test projects designed to validate and demonstrate the capabilities of the Code Index MCP server. Each project represents a realistic, enterprise-level codebase that showcases different programming languages, frameworks, and architectural patterns. |
| 4 | + |
| 5 | +## Project Structure |
| 6 | + |
| 7 | +``` |
| 8 | +test/ |
| 9 | +├── sample-projects/ |
| 10 | +│ ├── python/ |
| 11 | +│ │ └── user_management/ # Python user management system |
| 12 | +│ ├── java/ |
| 13 | +│ │ └── user-management/ # Java Spring Boot user management |
| 14 | +│ ├── go/ |
| 15 | +│ │ └── user-management/ # Go Gin user management API |
| 16 | +│ ├── javascript/ |
| 17 | +│ │ └── user-management/ # Node.js Express user management |
| 18 | +│ ├── typescript/ |
| 19 | +│ │ └── user-management/ # TypeScript Express user management |
| 20 | +│ └── objective-c/ # Objective-C test files |
| 21 | +└── README.md # This file |
| 22 | +``` |
| 23 | + |
| 24 | +## Sample Projects Overview |
| 25 | + |
| 26 | +Each sample project implements a comprehensive user management system with the following core features: |
| 27 | + |
| 28 | +### Common Features Across All Projects |
| 29 | +- **User Registration & Authentication**: Secure user registration with password hashing |
| 30 | +- **Role-Based Access Control (RBAC)**: Admin, User, and Guest roles with permissions |
| 31 | +- **CRUD Operations**: Complete Create, Read, Update, Delete functionality |
| 32 | +- **Search & Filtering**: Full-text search and role/status-based filtering |
| 33 | +- **Pagination**: Efficient pagination for large datasets |
| 34 | +- **Input Validation**: Comprehensive validation and sanitization |
| 35 | +- **Error Handling**: Structured error handling with custom error classes |
| 36 | +- **Logging**: Structured logging for debugging and monitoring |
| 37 | +- **Security**: Password hashing, rate limiting, and security headers |
| 38 | +- **Data Export**: User data export functionality |
| 39 | +- **Statistics**: User analytics and statistics |
| 40 | + |
| 41 | +### Language-Specific Implementation Details |
| 42 | + |
| 43 | +#### Python Project (`python/user_management/`) |
| 44 | +- **Framework**: Flask-based web application |
| 45 | +- **Database**: SQLAlchemy ORM with SQLite |
| 46 | +- **Authentication**: JWT tokens with BCrypt password hashing |
| 47 | +- **Structure**: Clean package structure with models, services, and utilities |
| 48 | +- **Features**: CLI interface, comprehensive validation, and export functionality |
| 49 | + |
| 50 | +**Key Files:** |
| 51 | +- `models/person.py` - Base Person model |
| 52 | +- `models/user.py` - User model with authentication |
| 53 | +- `services/user_manager.py` - Business logic layer |
| 54 | +- `services/auth_service.py` - Authentication service |
| 55 | +- `utils/` - Validation, exceptions, and helper utilities |
| 56 | +- `cli.py` - Command-line interface |
| 57 | + |
| 58 | +#### Java Project (`java/user-management/`) |
| 59 | +- **Framework**: Spring Boot with Spring Data JPA |
| 60 | +- **Database**: H2 in-memory database with JPA |
| 61 | +- **Authentication**: JWT tokens with BCrypt |
| 62 | +- **Structure**: Maven project with standard Java package structure |
| 63 | +- **Features**: REST API, validation annotations, and comprehensive testing |
| 64 | + |
| 65 | +**Key Files:** |
| 66 | +- `model/User.java` - JPA entity with validation |
| 67 | +- `service/UserService.java` - Business logic service |
| 68 | +- `controller/UserController.java` - REST API endpoints |
| 69 | +- `util/` - Validation, exceptions, and utilities |
| 70 | +- `Application.java` - Spring Boot application entry point |
| 71 | + |
| 72 | +#### Go Project (`go/user-management/`) |
| 73 | +- **Framework**: Gin web framework with GORM |
| 74 | +- **Database**: SQLite with GORM ORM |
| 75 | +- **Authentication**: JWT tokens with BCrypt |
| 76 | +- **Structure**: Clean Go module structure with internal packages |
| 77 | +- **Features**: High-performance API, middleware, and concurrent processing |
| 78 | + |
| 79 | +**Key Files:** |
| 80 | +- `internal/models/user.go` - User model with GORM |
| 81 | +- `internal/services/user_service.go` - Business logic |
| 82 | +- `pkg/api/handlers/user_handler.go` - HTTP handlers |
| 83 | +- `pkg/middleware/` - Authentication and validation middleware |
| 84 | +- `cmd/server/main.go` - Application entry point |
| 85 | + |
| 86 | +#### JavaScript Project (`javascript/user-management/`) |
| 87 | +- **Framework**: Express.js with Mongoose |
| 88 | +- **Database**: MongoDB with Mongoose ODM |
| 89 | +- **Authentication**: JWT tokens with BCrypt |
| 90 | +- **Structure**: Modern Node.js project with ES6+ features |
| 91 | +- **Features**: Async/await, middleware, and comprehensive error handling |
| 92 | + |
| 93 | +**Key Files:** |
| 94 | +- `src/models/User.js` - Mongoose model with validation |
| 95 | +- `src/services/UserService.js` - Business logic service |
| 96 | +- `src/routes/userRoutes.js` - Express routes |
| 97 | +- `src/middleware/` - Authentication and validation middleware |
| 98 | +- `src/server.js` - Express application setup |
| 99 | + |
| 100 | +#### TypeScript Project (`typescript/user-management/`) |
| 101 | +- **Framework**: Express.js with Mongoose (TypeScript) |
| 102 | +- **Database**: MongoDB with Mongoose ODM |
| 103 | +- **Authentication**: JWT tokens with BCrypt |
| 104 | +- **Structure**: Type-safe Node.js project with comprehensive interfaces |
| 105 | +- **Features**: Full type safety, interfaces, and advanced TypeScript features |
| 106 | + |
| 107 | +**Key Files:** |
| 108 | +- `src/types/User.ts` - TypeScript interfaces and types |
| 109 | +- `src/models/User.ts` - Mongoose model with TypeScript |
| 110 | +- `src/services/UserService.ts` - Typed business logic service |
| 111 | +- `src/routes/userRoutes.ts` - Typed Express routes |
| 112 | +- `src/server.ts` - TypeScript Express application |
| 113 | + |
| 114 | +#### Objective-C Project (`objective-c/`) |
| 115 | +- **Framework**: Foundation classes |
| 116 | +- **Features**: Classes, properties, methods, protocols |
| 117 | +- **Structure**: Traditional .h/.m file structure |
| 118 | + |
| 119 | +**Key Files:** |
| 120 | +- `Person.h/.m` - Person class with properties |
| 121 | +- `UserManager.h/.m` - User management functionality |
| 122 | +- `main.m` - Application entry point |
| 123 | + |
| 124 | +## Testing the Code Index MCP |
| 125 | + |
| 126 | +These projects are designed to test various aspects of the Code Index MCP: |
| 127 | + |
| 128 | +### File Analysis Capabilities |
| 129 | +- **Language Detection**: Automatic detection of programming languages |
| 130 | +- **Syntax Parsing**: Parsing of different syntax structures |
| 131 | +- **Import/Dependency Analysis**: Understanding of module dependencies |
| 132 | +- **Code Structure**: Recognition of classes, functions, and interfaces |
| 133 | + |
| 134 | +### Search and Navigation |
| 135 | +- **Symbol Search**: Finding functions, classes, and variables |
| 136 | +- **Cross-Reference**: Finding usage of symbols across files |
| 137 | +- **Fuzzy Search**: Approximate matching for typos and partial queries |
| 138 | +- **Pattern Matching**: Regular expression and pattern-based searches |
| 139 | + |
| 140 | +### Code Intelligence |
| 141 | +- **Function Signatures**: Understanding of function parameters and return types |
| 142 | +- **Variable Types**: Type inference and tracking |
| 143 | +- **Scope Analysis**: Understanding of variable and function scope |
| 144 | +- **Documentation**: Parsing of comments and documentation |
| 145 | + |
| 146 | +### Performance Testing |
| 147 | +- **Large Codebases**: Testing with realistic project sizes |
| 148 | +- **Complex Structures**: Nested packages and deep directory structures |
| 149 | +- **Multiple File Types**: Mixed file types within projects |
| 150 | +- **Concurrent Access**: Multiple simultaneous search operations |
| 151 | + |
| 152 | +## Running the Projects |
| 153 | + |
| 154 | +Each project includes comprehensive setup instructions in its respective README.md file. General steps: |
| 155 | + |
| 156 | +1. Navigate to the project directory |
| 157 | +2. Install dependencies using the appropriate package manager |
| 158 | +3. Set up environment variables (see .env.example files) |
| 159 | +4. Run the application using the provided scripts |
| 160 | +5. Test the API endpoints using the provided examples |
| 161 | + |
| 162 | +### Quick Start Examples |
| 163 | + |
| 164 | +```bash |
| 165 | +# Python project |
| 166 | +cd test/sample-projects/python/user_management |
| 167 | +pip install -r requirements.txt |
| 168 | +python cli.py |
| 169 | + |
| 170 | +# Java project |
| 171 | +cd test/sample-projects/java/user-management |
| 172 | +mvn spring-boot:run |
| 173 | + |
| 174 | +# Go project |
| 175 | +cd test/sample-projects/go/user-management |
| 176 | +go run cmd/server/main.go |
| 177 | + |
| 178 | +# JavaScript project |
| 179 | +cd test/sample-projects/javascript/user-management |
| 180 | +npm install |
| 181 | +npm run dev |
| 182 | + |
| 183 | +# TypeScript project |
| 184 | +cd test/sample-projects/typescript/user-management |
| 185 | +npm install |
| 186 | +npm run dev |
| 187 | +``` |
| 188 | + |
| 189 | +## MCP Server Testing |
| 190 | + |
| 191 | +To test the Code Index MCP server with these projects: |
| 192 | + |
| 193 | +1. **Set Project Path**: Use the `set_project_path` tool to point to a project directory |
| 194 | +2. **Index Files**: The server will automatically index all files in the project |
| 195 | +3. **Search Testing**: Test various search queries and patterns |
| 196 | +4. **Analysis Testing**: Use the analysis tools to examine code structure |
| 197 | +5. **Performance Testing**: Measure response times and resource usage |
| 198 | + |
| 199 | +### Example MCP Commands |
| 200 | + |
| 201 | +```bash |
| 202 | +# Set project path |
| 203 | +set_project_path /path/to/test/sample-projects/python/user_management |
| 204 | + |
| 205 | +# Search for user-related functions |
| 206 | +search_code_advanced "def create_user" --file-pattern "*.py" |
| 207 | + |
| 208 | +# Find all authentication-related code |
| 209 | +search_code_advanced "auth" --fuzzy true |
| 210 | + |
| 211 | +# Get file summary |
| 212 | +get_file_summary models/user.py |
| 213 | + |
| 214 | +# Find TypeScript interfaces |
| 215 | +search_code_advanced "interface.*User" --regex true --file-pattern "*.ts" |
| 216 | +``` |
| 217 | + |
| 218 | +## Contributing |
| 219 | + |
| 220 | +When adding new test projects: |
| 221 | + |
| 222 | +1. Follow the established patterns and structure |
| 223 | +2. Implement all core features consistently |
| 224 | +3. Include comprehensive documentation |
| 225 | +4. Add appropriate test cases |
| 226 | +5. Update this README with project details |
| 227 | + |
| 228 | +## Security Considerations |
| 229 | + |
| 230 | +All test projects include: |
| 231 | +- Secure password hashing (BCrypt) |
| 232 | +- Input validation and sanitization |
| 233 | +- Rate limiting and security headers |
| 234 | +- JWT token-based authentication |
| 235 | +- Environment variable configuration |
| 236 | +- Proper error handling without information disclosure |
| 237 | + |
| 238 | +## Future Enhancements |
| 239 | + |
| 240 | +Potential additions to the test suite: |
| 241 | +- **Rust Project**: Systems programming language example |
| 242 | +- **C++ Project**: Complex C++ codebase with templates |
| 243 | +- **C# Project**: .NET Core application |
| 244 | +- **PHP Project**: Laravel-based web application |
| 245 | +- **Ruby Project**: Rails application |
| 246 | +- **Swift Project**: iOS application structure |
| 247 | +- **Kotlin Project**: Android/JVM application |
0 commit comments