|
| 1 | +# AI Testing MCP Server |
| 2 | + |
| 3 | +An AI-powered testing automation MCP server for Claude Code that provides TestSprite-like functionality. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +### Core Testing Tools |
| 8 | +- **Code Analysis**: Analyze project structure and identify testable components |
| 9 | +- **Test Generation**: AI-powered unit, integration, and E2E test generation |
| 10 | +- **Test Execution**: Run tests with framework auto-detection |
| 11 | +- **Results Analysis**: Intelligent test result analysis with fix suggestions |
| 12 | +- **Framework Setup**: Initialize testing frameworks in projects |
| 13 | + |
| 14 | +### Supported Languages & Frameworks |
| 15 | +- **JavaScript/TypeScript**: Jest, Mocha, Vitest |
| 16 | +- **Python**: Pytest |
| 17 | +- **Go**: Built-in testing |
| 18 | +- **Frameworks**: React, Vue, Express, FastAPI, Flask |
| 19 | + |
| 20 | +## Installation |
| 21 | + |
| 22 | +1. Clone or create the project: |
| 23 | +```bash |
| 24 | +git clone <repo> ai-testing-mcp |
| 25 | +cd ai-testing-mcp |
| 26 | +``` |
| 27 | + |
| 28 | +2. Install dependencies: |
| 29 | +```bash |
| 30 | +npm install |
| 31 | +``` |
| 32 | + |
| 33 | +3. Build the project: |
| 34 | +```bash |
| 35 | +npm run build |
| 36 | +``` |
| 37 | + |
| 38 | +## Configuration |
| 39 | + |
| 40 | +### For Claude Code |
| 41 | +Add to your Claude Code MCP configuration: |
| 42 | + |
| 43 | +```json |
| 44 | +{ |
| 45 | + "mcpServers": { |
| 46 | + "ai-testing": { |
| 47 | + "command": "node", |
| 48 | + "args": ["dist/index.js"], |
| 49 | + "cwd": "/absolute/path/to/ai-testing-mcp" |
| 50 | + } |
| 51 | + } |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +## Usage |
| 56 | + |
| 57 | +Once configured, you can use these tools in Claude Code: |
| 58 | + |
| 59 | +### 1. Analyze Codebase |
| 60 | +``` |
| 61 | +Use the analyze_codebase tool on my project at /path/to/project |
| 62 | +``` |
| 63 | + |
| 64 | +### 2. Generate Unit Tests |
| 65 | +``` |
| 66 | +Generate unit tests for src/utils.js using Jest framework |
| 67 | +``` |
| 68 | + |
| 69 | +### 3. Run Tests |
| 70 | +``` |
| 71 | +Run all tests in my project with coverage |
| 72 | +``` |
| 73 | + |
| 74 | +### 4. Analyze Test Results |
| 75 | +``` |
| 76 | +Analyze these test failures and suggest fixes: [paste test output] |
| 77 | +``` |
| 78 | + |
| 79 | +## Available Tools |
| 80 | + |
| 81 | +### `analyze_codebase` |
| 82 | +- **Purpose**: Scan project structure, detect languages/frameworks, find API endpoints |
| 83 | +- **Input**: `projectPath` - Path to project directory |
| 84 | +- **Output**: JSON with language, framework, API endpoints, testable components |
| 85 | + |
| 86 | +### `generate_unit_tests` |
| 87 | +- **Purpose**: Create unit tests for functions/components |
| 88 | +- **Input**: |
| 89 | + - `filePath` - File to test |
| 90 | + - `functionName` - Specific function (optional) |
| 91 | + - `testFramework` - Framework to use |
| 92 | +- **Output**: Generated test code |
| 93 | + |
| 94 | +### `generate_integration_tests` |
| 95 | +- **Purpose**: Create API endpoint tests |
| 96 | +- **Input**: |
| 97 | + - `projectPath` - Project directory |
| 98 | + - `apiSpec` - API documentation (optional) |
| 99 | +- **Output**: Integration test code |
| 100 | + |
| 101 | +### `run_tests` |
| 102 | +- **Purpose**: Execute tests with auto-detection |
| 103 | +- **Input**: |
| 104 | + - `projectPath` - Project directory |
| 105 | + - `testPattern` - Specific tests to run (optional) |
| 106 | + - `framework` - Force specific framework (optional) |
| 107 | +- **Output**: Test results with coverage |
| 108 | + |
| 109 | +### `analyze_test_results` |
| 110 | +- **Purpose**: Analyze test output and provide insights |
| 111 | +- **Input**: `testOutput` - Raw test results |
| 112 | +- **Output**: Analysis with suggestions |
| 113 | + |
| 114 | +### `suggest_fixes` |
| 115 | +- **Purpose**: Generate fix suggestions for failing tests |
| 116 | +- **Input**: |
| 117 | + - `failureOutput` - Test failure output |
| 118 | + - `sourceCode` - Source code (optional) |
| 119 | + - `testCode` - Test code (optional) |
| 120 | +- **Output**: Suggested fixes |
| 121 | + |
| 122 | +### `setup_testing_framework` |
| 123 | +- **Purpose**: Initialize testing in a project |
| 124 | +- **Input**: |
| 125 | + - `projectPath` - Project directory |
| 126 | + - `framework` - Testing framework |
| 127 | + - `language` - Programming language |
| 128 | +- **Output**: Setup instructions/files |
| 129 | + |
| 130 | +## Example Workflow |
| 131 | + |
| 132 | +1. **Analyze your project**: |
| 133 | + ``` |
| 134 | + Use analyze_codebase on ./my-app |
| 135 | + ``` |
| 136 | + |
| 137 | +2. **Generate tests for a component**: |
| 138 | + ``` |
| 139 | + Generate unit tests for src/components/Button.jsx using Jest |
| 140 | + ``` |
| 141 | + |
| 142 | +3. **Run the generated tests**: |
| 143 | + ``` |
| 144 | + Run tests in ./my-app matching *Button* |
| 145 | + ``` |
| 146 | + |
| 147 | +4. **Fix any failures**: |
| 148 | + ``` |
| 149 | + Analyze these test failures and suggest fixes: [paste output] |
| 150 | + ``` |
| 151 | + |
| 152 | +## Benefits Over Manual Testing |
| 153 | + |
| 154 | +- **Speed**: Generate comprehensive test suites in seconds |
| 155 | +- **Coverage**: Automatically identifies all testable components |
| 156 | +- **Intelligence**: AI-powered test case generation with edge cases |
| 157 | +- **Integration**: Works with existing test frameworks and CI/CD |
| 158 | +- **Analysis**: Intelligent failure analysis with fix suggestions |
| 159 | + |
| 160 | +## Development |
| 161 | + |
| 162 | +### Build |
| 163 | +```bash |
| 164 | +npm run build |
| 165 | +``` |
| 166 | + |
| 167 | +### Development Mode |
| 168 | +```bash |
| 169 | +npm run dev |
| 170 | +``` |
| 171 | + |
| 172 | +### Adding New Features |
| 173 | +The server is modular - add new tools by: |
| 174 | +1. Adding tool definition to `ListToolsRequestSchema` handler |
| 175 | +2. Adding tool implementation to `CallToolRequestSchema` handler |
| 176 | +3. Creating helper methods as needed |
| 177 | + |
| 178 | +## Comparison to TestSprite |
| 179 | + |
| 180 | +| Feature | TestSprite | AI Testing MCP | |
| 181 | +|---------|------------|----------------| |
| 182 | +| Test Generation | ✅ | ✅ | |
| 183 | +| Multi-language | ✅ | ✅ | |
| 184 | +| Cloud Execution | ✅ | Local | |
| 185 | +| IDE Integration | ✅ | ✅ (via Claude Code) | |
| 186 | +| Cost | Subscription | Free | |
| 187 | +| Customization | Limited | Full source access | |
| 188 | + |
| 189 | +## License |
| 190 | + |
| 191 | +MIT |
0 commit comments