Skip to content

Commit c949204

Browse files
authored
Merge pull request #92 from pmvrak/main
Feature: AWS CICD MCP Server
2 parents 49214a3 + aac528a commit c949204

File tree

28 files changed

+5142
-0
lines changed

28 files changed

+5142
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
MIT No Attribution
2+
3+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so.
10+
11+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
13+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
15+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
# AWS CI/CD MCP Server
2+
3+
A comprehensive Model Context Protocol (MCP) server for AWS CI/CD services (CodePipeline, CodeBuild, CodeDeploy) with 22 specialized tools, automatic IAM management, and production-ready security features.
4+
5+
6+
## Features
7+
8+
- **22 Comprehensive CI/CD Tools**: 7+ tools each for CodePipeline, CodeBuild, and CodeDeploy
9+
- **Security First**: Read-only mode by default with comprehensive validation
10+
- **Automatic IAM Management**: Creates and manages service roles with AWS managed policies
11+
- **Rich Data Retrieval**: CloudWatch logs, deployment details, and execution history
12+
- **Pagination Support**: Efficient handling of large result sets
13+
- **Advanced Features**: Source overrides, environment variables, multi-platform support
14+
- **Robust Error Handling**: Detailed error messages with actionable guidance
15+
16+
## Prerequisites
17+
18+
- **Python 3.10+** installed
19+
- **AWS CLI configured** with appropriate credentials
20+
- **Required AWS permissions** for CI/CD services
21+
22+
## Quick Setup
23+
24+
### Option 1: Automated Installation (Recommended)
25+
26+
```bash
27+
# Clone and install with automatic MCP configuration
28+
git clone <repository-url>
29+
cd aws-cicd-mcp-server
30+
./install.sh
31+
```
32+
33+
The install script will:
34+
- Install the package and dependencies
35+
- Verify installation works
36+
- Check AWS credentials
37+
- Automatically add MCP configuration to `~/.aws/amazonq/mcp.json`
38+
39+
### Option 2: Manual MCP Configuration
40+
41+
If you prefer to manually add the MCP server configuration, add this to your `~/.aws/amazonq/mcp.json`:
42+
43+
```json
44+
{
45+
"mcpServers": {
46+
"aws-cicd-mcp-server": {
47+
"command": "python3",
48+
"args": [
49+
"-m",
50+
"awslabs.aws_cicd_mcp_server.server_fixed"
51+
],
52+
"cwd": "/absolute/path/to/aws-cicd-mcp-server",
53+
"env": {
54+
"AWS_PROFILE": "default",
55+
"AWS_REGION": "us-west-2", # change to your region
56+
"CICD_READ_ONLY_MODE": "false", # keep false for write operations
57+
"FASTMCP_LOG_LEVEL": "DEBUG", # can be ERROR, INFO, DEBUG
58+
"PYTHONPATH": "/absolute/path/to/aws-cicd-mcp-server"
59+
},
60+
"autoApprove": [],
61+
"disabled": false
62+
}
63+
}
64+
}
65+
```
66+
67+
**Note**: Replace `/absolute/path/to/aws-cicd-mcp-server` with your actual path.
68+
69+
## Environment Variables
70+
71+
| Variable | Description | Default |
72+
|----------|-------------|---------|
73+
| `AWS_PROFILE` | AWS credentials profile | default |
74+
| `AWS_REGION` | AWS region | us-west-2 |
75+
| `CICD_READ_ONLY_MODE` | Enable read-only mode | false |
76+
| `FASTMCP_LOG_LEVEL` | Logging level (ERROR/INFO/DEBUG) | DEBUG |
77+
78+
## Available Tools
79+
80+
### CodeBuild (7 tools)
81+
- `list_projects` - List all projects with pagination
82+
- `get_project_details` - Get detailed project info with build history
83+
- `start_build` - Start builds with environment overrides
84+
- `get_build_logs` - Retrieve CloudWatch logs with error analysis
85+
- `create_project` - Create projects with auto IAM role
86+
- `update_project` - Update configuration with change tracking
87+
- `delete_project` - Safe deletion with running build checks
88+
89+
### CodePipeline (7 tools)
90+
- `list_pipelines` - List pipelines with execution status
91+
- `get_pipeline_details` - Get configuration with stage details
92+
- `start_pipeline_execution` - Start with source overrides
93+
- `get_pipeline_execution_history` - Detailed execution history
94+
- `create_pipeline` - Create multi-stage pipelines
95+
- `update_pipeline` - Update configuration
96+
- `delete_pipeline` - Safe deletion with execution checks
97+
98+
### CodeDeploy (8 tools)
99+
- `list_applications` - List applications with platform details
100+
- `get_application_details` - Get info with deployment groups
101+
- `create_deployment` - Multi-revision deployments with rollback
102+
- `get_deployment_status` - Detailed progress with instance details
103+
- `list_deployment_groups` - Groups with configuration
104+
- `create_application` - Multi-platform creation (EC2/Lambda/ECS)
105+
- `create_deployment_group` - Advanced targeting with ASG/ALB
106+
- `delete_application` - Safe deletion with dependency checks
107+
108+
## Verification
109+
110+
Test the server responds to MCP protocol:
111+
112+
```bash
113+
python3 -m awslabs.aws_cicd_mcp_server.server_fixed
114+
```
115+
116+
## Troubleshooting
117+
118+
### Installation Issues
119+
```bash
120+
# Reinstall dependencies
121+
cd /path/to/aws-cicd-mcp-server
122+
pip install -e .
123+
```
124+
125+
### Server Won't Start
126+
```bash
127+
# Check logs with debug mode
128+
FASTMCP_LOG_LEVEL=DEBUG python3 -m awslabs.aws_cicd_mcp_server.server_fixed
129+
```
130+
131+
### AWS Credentials Issues
132+
```bash
133+
# Verify credentials
134+
aws sts get-caller-identity
135+
136+
# Check region
137+
aws configure get region
138+
```
139+
140+
## Sample Usage Examples
141+
142+
143+
### CodeBuild
144+
145+
- Use aws-cicd-mcp-server and List all CodeBuild projects in my AWS account
146+
- Show me detailed information about the CodeBuild project named "SampleProject”
147+
- Create a new CodeBuild project called "test-project” with GitHub source from https://github.com/aws-samples/automated-devops-ai-toolkit
148+
- Update the CodeBuild project "test-project" to use BUILD_GENERAL1_MEDIUM compute type
149+
- Delete the CodeBuild project named "test-project"
150+
- Start a build for the CodeBuild project "test-project" using the main branch
151+
- Get the build logs for build "test-project"
152+
153+
### CodePipeline
154+
155+
- List all CodePipeline pipelines in my account
156+
- Show me detailed configuration of the pipeline named "test-pipeline"
157+
- Create a new CodePipeline called "test-pipeline" with CodeCommit source from "test-sample-project-repo"
158+
- Update the pipeline "test-pipeline" to use a different S3 bucket for artifacts
159+
- Delete the CodePipeline named "test-pipeline"
160+
- Start execution of the pipeline "test-pipeline"
161+
- Show me the execution history for pipeline "my-pipeline"
162+
163+
### CodeDeploy
164+
165+
- List all CodeDeploy applications in my account
166+
- Show me details of the CodeDeploy application "DevAppDeployment"
167+
- Create a new CodeDeploy application called "DevAppDeployment” for EC2/On-premises
168+
- Delete the CodeDeploy application "DevAppDeployment”
169+
- List all deployment groups for the application "DevAppDeployment"
170+
- Create a deployment group "production" for application "DevAppDeployment” targeting EC2 instances with tag Environment=prod
171+
- Create a deployment for application "DevAppDeployment” using deployment group "production" with S3 revision from bucket (create bucket first) and then assign the key "app.zip"
172+
- Check the status of deployment ID "d-KHXYMIF2F"
173+
174+
## Security Best Practices
175+
176+
1. **Use Read-Only Mode** for exploration and testing
177+
2. **Create Minimal IAM Roles** with only required permissions
178+
3. **Use AWS Managed Policies** when possible
179+
4. **Regularly Rotate** AWS access keys
180+
5. **Monitor CloudTrail** for CI/CD API activity
181+
182+
## Contributing
183+
184+
See the main repository [CONTRIBUTING.md](../../CONTRIBUTING.md) for contribution guidelines.
185+
186+
## License
187+
188+
This library is licensed under the MIT-0 License. See the LICENSE file.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
share/python-wheels/
20+
*.egg-info/
21+
.installed.cfg
22+
*.egg
23+
MANIFEST
24+
25+
# Virtual environments
26+
.venv
27+
env/
28+
venv/
29+
ENV/
30+
31+
# IDE
32+
.idea/
33+
.vscode/
34+
*.swp
35+
*.swo
36+
37+
# Testing
38+
.tox/
39+
.coverage
40+
.coverage.*
41+
htmlcov/
42+
.pytest_cache/
43+
44+
# Ruff
45+
.ruff_cache/
46+
47+
# Build
48+
*.manifest
49+
*.spec
50+
.pybuilder/
51+
target/
52+
53+
# Environments
54+
.env
55+
.env.local
56+
.env.*.local
57+
58+
# PyPI
59+
.pypirc
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
include README.md
2+
include LICENSE
3+
include NOTICE
4+
include requirements.txt
5+
recursive-include awslabs *.py
6+
recursive-exclude * __pycache__
7+
recursive-exclude * *.pyc
8+
recursive-exclude * *.pyo

implementation/implement-aws-cicd-mcp/aws-cicd-mcp-server/awslabs/__init__.py

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""AWS CI/CD MCP Server package."""
2+
3+
__version__ = "0.1.0"

implementation/implement-aws-cicd-mcp/aws-cicd-mcp-server/awslabs/aws_cicd_mcp_server/core/__init__.py

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)