9.3 KiB
Test Projects for Code Index MCP
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.
Project Structure
test/
├── sample-projects/
│ ├── python/
│ │ └── user_management/ # Python user management system
│ ├── java/
│ │ └── user-management/ # Java Spring Boot user management
│ ├── go/
│ │ └── user-management/ # Go Gin user management API
│ ├── javascript/
│ │ └── user-management/ # Node.js Express user management
│ ├── typescript/
│ │ └── user-management/ # TypeScript Express user management
│ └── objective-c/ # Objective-C test files
└── README.md # This file
Sample Projects Overview
Each sample project implements a comprehensive user management system with the following core features:
Common Features Across All Projects
- User Registration & Authentication: Secure user registration with password hashing
- Role-Based Access Control (RBAC): Admin, User, and Guest roles with permissions
- CRUD Operations: Complete Create, Read, Update, Delete functionality
- Search & Filtering: Full-text search and role/status-based filtering
- Pagination: Efficient pagination for large datasets
- Input Validation: Comprehensive validation and sanitization
- Error Handling: Structured error handling with custom error classes
- Logging: Structured logging for debugging and monitoring
- Security: Password hashing, rate limiting, and security headers
- Data Export: User data export functionality
- Statistics: User analytics and statistics
Language-Specific Implementation Details
Python Project (python/user_management/)
- Framework: Flask-based web application
- Database: SQLAlchemy ORM with SQLite
- Authentication: JWT tokens with BCrypt password hashing
- Structure: Clean package structure with models, services, and utilities
- Features: CLI interface, comprehensive validation, and export functionality
Key Files:
models/person.py- Base Person modelmodels/user.py- User model with authenticationservices/user_manager.py- Business logic layerservices/auth_service.py- Authentication serviceutils/- Validation, exceptions, and helper utilitiescli.py- Command-line interface
Java Project (java/user-management/)
- Framework: Spring Boot with Spring Data JPA
- Database: H2 in-memory database with JPA
- Authentication: JWT tokens with BCrypt
- Structure: Maven project with standard Java package structure
- Features: REST API, validation annotations, and comprehensive testing
Key Files:
model/User.java- JPA entity with validationservice/UserService.java- Business logic servicecontroller/UserController.java- REST API endpointsutil/- Validation, exceptions, and utilitiesApplication.java- Spring Boot application entry point
Go Project (go/user-management/)
- Framework: Gin web framework with GORM
- Database: SQLite with GORM ORM
- Authentication: JWT tokens with BCrypt
- Structure: Clean Go module structure with internal packages
- Features: High-performance API, middleware, and concurrent processing
Key Files:
internal/models/user.go- User model with GORMinternal/services/user_service.go- Business logicpkg/api/handlers/user_handler.go- HTTP handlerspkg/middleware/- Authentication and validation middlewarecmd/server/main.go- Application entry point
JavaScript Project (javascript/user-management/)
- Framework: Express.js with Mongoose
- Database: MongoDB with Mongoose ODM
- Authentication: JWT tokens with BCrypt
- Structure: Modern Node.js project with ES6+ features
- Features: Async/await, middleware, and comprehensive error handling
Key Files:
src/models/User.js- Mongoose model with validationsrc/services/UserService.js- Business logic servicesrc/routes/userRoutes.js- Express routessrc/middleware/- Authentication and validation middlewaresrc/server.js- Express application setup
TypeScript Project (typescript/user-management/)
- Framework: Express.js with Mongoose (TypeScript)
- Database: MongoDB with Mongoose ODM
- Authentication: JWT tokens with BCrypt
- Structure: Type-safe Node.js project with comprehensive interfaces
- Features: Full type safety, interfaces, and advanced TypeScript features
Key Files:
src/types/User.ts- TypeScript interfaces and typessrc/models/User.ts- Mongoose model with TypeScriptsrc/services/UserService.ts- Typed business logic servicesrc/routes/userRoutes.ts- Typed Express routessrc/server.ts- TypeScript Express application
Objective-C Project (objective-c/)
- Framework: Foundation classes
- Features: Classes, properties, methods, protocols
- Structure: Traditional .h/.m file structure
Key Files:
Person.h/.m- Person class with propertiesUserManager.h/.m- User management functionalitymain.m- Application entry point
Testing the Code Index MCP
These projects are designed to test various aspects of the Code Index MCP:
File Analysis Capabilities
- Language Detection: Automatic detection of programming languages
- Syntax Parsing: Parsing of different syntax structures
- Import/Dependency Analysis: Understanding of module dependencies
- Code Structure: Recognition of classes, functions, and interfaces
Search and Navigation
- Symbol Search: Finding functions, classes, and variables
- Cross-Reference: Finding usage of symbols across files
- Fuzzy Search: Approximate matching for typos and partial queries
- Pattern Matching: Regular expression and pattern-based searches
Code Intelligence
- Function Signatures: Understanding of function parameters and return types
- Variable Types: Type inference and tracking
- Scope Analysis: Understanding of variable and function scope
- Documentation: Parsing of comments and documentation
Performance Testing
- Large Codebases: Testing with realistic project sizes
- Complex Structures: Nested packages and deep directory structures
- Multiple File Types: Mixed file types within projects
- Concurrent Access: Multiple simultaneous search operations
Running the Projects
Each project includes comprehensive setup instructions in its respective README.md file. General steps:
- Navigate to the project directory
- Install dependencies using the appropriate package manager
- Set up environment variables (see .env.example files)
- Run the application using the provided scripts
- Test the API endpoints using the provided examples
Quick Start Examples
# Python project
cd test/sample-projects/python/user_management
pip install -r requirements.txt
python cli.py
# Java project
cd test/sample-projects/java/user-management
mvn spring-boot:run
# Go project
cd test/sample-projects/go/user-management
go run cmd/server/main.go
# JavaScript project
cd test/sample-projects/javascript/user-management
npm install
npm run dev
# TypeScript project
cd test/sample-projects/typescript/user-management
npm install
npm run dev
MCP Server Testing
To test the Code Index MCP server with these projects:
- Set Project Path: Use the
set_project_pathtool to point to a project directory - Index Files: The server will automatically index all files in the project
- Search Testing: Test various search queries and patterns
- Analysis Testing: Use the analysis tools to examine code structure
- Performance Testing: Measure response times and resource usage
Example MCP Commands
# Set project path
set_project_path /path/to/test/sample-projects/python/user_management
# Search for user-related functions
search_code_advanced "def create_user" --file-pattern "*.py"
# Find all authentication-related code
search_code_advanced "auth" --fuzzy true
# Get file summary
get_file_summary models/user.py
# Find TypeScript interfaces
search_code_advanced "interface.*User" --regex true --file-pattern "*.ts"
Contributing
When adding new test projects:
- Follow the established patterns and structure
- Implement all core features consistently
- Include comprehensive documentation
- Add appropriate test cases
- Update this README with project details
Security Considerations
All test projects include:
- Secure password hashing (BCrypt)
- Input validation and sanitization
- Rate limiting and security headers
- JWT token-based authentication
- Environment variable configuration
- Proper error handling without information disclosure
Future Enhancements
Potential additions to the test suite:
- Rust Project: Systems programming language example
- C++ Project: Complex C++ codebase with templates
- C# Project: .NET Core application
- PHP Project: Laravel-based web application
- Ruby Project: Rails application
- Swift Project: iOS application structure
- Kotlin Project: Android/JVM application