@gc-mcp/codeimpact
Version:
MCP Server for Code Impact Analysis - provides intelligent analysis of code changes and their impact across microservices architecture
159 lines (109 loc) • 3.94 kB
Markdown
# Code Impact Analysis MCP Server
The Code Impact Analysis MCP Server automatically analyzes code changes and their impact across the microservices architecture, saving 30-60 minutes of manual dependency analysis per change. This server provides intelligent analysis of how code changes propagate through the system and suggests optimal testing and deployment strategies.
## Features
- **Intelligent Change Classification**: Automatically classifies code changes by type and impact scope
- **Dependency Analysis**: Builds comprehensive dependency graphs across services
- **Impact Calculation**: Calculates the impact of changes on affected services
- **Breaking Change Detection**: Identifies potential breaking changes
- **Test Strategy Recommendations**: Suggests optimal testing strategies
- **Deployment Order Optimization**: Recommends optimal deployment sequences
## Installation
```bash
npm install @gc-mcp/code-impact-analysis
```
## Usage
### As MCP Server
```bash
# Start the MCP server
npx mcp-code-impact start
# Or use the runner script
./run-mcp-server.sh
```
### As CLI Tool
```bash
# Analyze specific files
npx mcp-code-impact analyze -f src/api/user.ts src/services/auth.ts
# Set analysis depth
npx mcp-code-impact analyze -f src/api/user.ts -d comprehensive
# Output in different format
npx mcp-code-impact analyze -f src/api/user.ts -o yaml
```
## Configuration
Set the following environment variables:
```bash
# Analysis Configuration
IMPACT_ANALYSIS_DEPTH=deep
BREAKING_CHANGE_THRESHOLD=medium
TEST_RECOMMENDATION_CONFIDENCE=0.8
# Service Discovery
SERVICE_DISCOVERY_PATH=./platform
SHARED_LIBRARIES_PATH=./libs
# Caching
ENABLE_ANALYSIS_CACHE=true
CACHE_TTL_MINUTES=60
# Logging
LOG_LEVEL=info
```
## MCP Tools
### analyze_code_impact
Analyze the impact of code changes across the microservices architecture.
**Parameters:**
- `changed_files` (required): List of changed file paths
- `change_context` (optional): Context about the changes (branch, commit message, etc.)
- `analysis_depth` (optional): Depth of analysis (shallow, deep, comprehensive)
- `include_dependencies` (optional): Include indirect dependencies
- `focus_areas` (optional): Focus on specific areas (api, database, etc.)
### find_affected_services
Find all services affected by specific code changes.
**Parameters:**
- `changes` (required): Array of change objects
- `include_dependencies` (optional): Include indirect dependencies
- `impact_threshold` (optional): Minimum impact level to include
### suggest_test_strategy
Suggest optimal testing strategy based on code impact analysis.
**Parameters:**
- `impact_analysis` (required): Result from analyze_code_impact
- `test_constraints` (optional): Test execution constraints
- `team_preferences` (optional): Team-specific preferences
### detect_breaking_changes
Detect potential breaking changes in code modifications.
**Parameters:**
- `changes` (required): Array of change objects
- `api_schemas` (optional): Current API schemas
- `database_schemas` (optional): Current database schemas
- `interface_contracts` (optional): Service interface contracts
### recommend_deployment_order
Recommend optimal deployment order based on service dependencies.
**Parameters:**
- `services` (required): Services to be deployed
- `deployment_strategy` (optional): Deployment strategy (rolling, blue_green, canary, recreate)
- `risk_tolerance` (optional): Risk tolerance level
- `rollback_requirements` (optional): Consider rollback requirements
## Development
```bash
# Install dependencies
npm install
# Build the project
npm run build
# Run in development mode
npm run dev
# Run tests
npm test
# Lint code
npm run lint
# Fix linting issues
npm run lint:fix
```
## Docker
```bash
# Build Docker image
npm run docker:build
# Run with Docker
npm run docker:run
# Stop Docker container
npm run docker:stop
# View Docker logs
npm run docker:logs
```
## License
MIT