Skip to content

Commit 84b7130

Browse files
cicd MCP server
1 parent 49214a3 commit 84b7130

File tree

28 files changed

+5146
-0
lines changed

28 files changed

+5146
-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: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
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+
## Demo
7+
8+
![CICD MCP Server Demo](./demo-cicd-mcp-server.mp4)
9+
10+
## Features
11+
12+
- **22 Comprehensive CI/CD Tools**: 7+ tools each for CodePipeline, CodeBuild, and CodeDeploy
13+
- **Security First**: Read-only mode by default with comprehensive validation
14+
- **Automatic IAM Management**: Creates and manages service roles with AWS managed policies
15+
- **Rich Data Retrieval**: CloudWatch logs, deployment details, and execution history
16+
- **Pagination Support**: Efficient handling of large result sets
17+
- **Advanced Features**: Source overrides, environment variables, multi-platform support
18+
- **Robust Error Handling**: Detailed error messages with actionable guidance
19+
20+
## Prerequisites
21+
22+
- **Python 3.10+** installed
23+
- **AWS CLI configured** with appropriate credentials
24+
- **Required AWS permissions** for CI/CD services
25+
26+
## Quick Setup
27+
28+
### Option 1: Automated Installation (Recommended)
29+
30+
```bash
31+
# Clone and install with automatic MCP configuration
32+
git clone <repository-url>
33+
cd aws-cicd-mcp-server
34+
./install.sh
35+
```
36+
37+
The install script will:
38+
- Install the package and dependencies
39+
- Verify installation works
40+
- Check AWS credentials
41+
- Automatically add MCP configuration to `~/.aws/amazonq/mcp.json`
42+
43+
### Option 2: Manual MCP Configuration
44+
45+
If you prefer to manually add the MCP server configuration, add this to your `~/.aws/amazonq/mcp.json`:
46+
47+
```json
48+
{
49+
"mcpServers": {
50+
"aws-cicd-mcp-server": {
51+
"command": "python3",
52+
"args": [
53+
"-m",
54+
"awslabs.aws_cicd_mcp_server.server_fixed"
55+
],
56+
"cwd": "/absolute/path/to/aws-cicd-mcp-server",
57+
"env": {
58+
"AWS_PROFILE": "default",
59+
"AWS_REGION": "us-west-2", # change to your region
60+
"CICD_READ_ONLY_MODE": "false", # keep false for write operations
61+
"FASTMCP_LOG_LEVEL": "DEBUG", # can be ERROR, INFO, DEBUG
62+
"PYTHONPATH": "/absolute/path/to/aws-cicd-mcp-server"
63+
},
64+
"autoApprove": [],
65+
"disabled": false
66+
}
67+
}
68+
}
69+
```
70+
71+
**Note**: Replace `/absolute/path/to/aws-cicd-mcp-server` with your actual path.
72+
73+
## Environment Variables
74+
75+
| Variable | Description | Default |
76+
|----------|-------------|---------|
77+
| `AWS_PROFILE` | AWS credentials profile | default |
78+
| `AWS_REGION` | AWS region | us-west-2 |
79+
| `CICD_READ_ONLY_MODE` | Enable read-only mode | false |
80+
| `FASTMCP_LOG_LEVEL` | Logging level (ERROR/INFO/DEBUG) | DEBUG |
81+
82+
## Available Tools
83+
84+
### CodeBuild (7 tools)
85+
- `list_projects` - List all projects with pagination
86+
- `get_project_details` - Get detailed project info with build history
87+
- `start_build` - Start builds with environment overrides
88+
- `get_build_logs` - Retrieve CloudWatch logs with error analysis
89+
- `create_project` - Create projects with auto IAM role
90+
- `update_project` - Update configuration with change tracking
91+
- `delete_project` - Safe deletion with running build checks
92+
93+
### CodePipeline (7 tools)
94+
- `list_pipelines` - List pipelines with execution status
95+
- `get_pipeline_details` - Get configuration with stage details
96+
- `start_pipeline_execution` - Start with source overrides
97+
- `get_pipeline_execution_history` - Detailed execution history
98+
- `create_pipeline` - Create multi-stage pipelines
99+
- `update_pipeline` - Update configuration
100+
- `delete_pipeline` - Safe deletion with execution checks
101+
102+
### CodeDeploy (8 tools)
103+
- `list_applications` - List applications with platform details
104+
- `get_application_details` - Get info with deployment groups
105+
- `create_deployment` - Multi-revision deployments with rollback
106+
- `get_deployment_status` - Detailed progress with instance details
107+
- `list_deployment_groups` - Groups with configuration
108+
- `create_application` - Multi-platform creation (EC2/Lambda/ECS)
109+
- `create_deployment_group` - Advanced targeting with ASG/ALB
110+
- `delete_application` - Safe deletion with dependency checks
111+
112+
## Verification
113+
114+
Test the server responds to MCP protocol:
115+
116+
```bash
117+
python3 -m awslabs.aws_cicd_mcp_server.server_fixed
118+
```
119+
120+
## Troubleshooting
121+
122+
### Installation Issues
123+
```bash
124+
# Reinstall dependencies
125+
cd /path/to/aws-cicd-mcp-server
126+
pip install -e .
127+
```
128+
129+
### Server Won't Start
130+
```bash
131+
# Check logs with debug mode
132+
FASTMCP_LOG_LEVEL=DEBUG python3 -m awslabs.aws_cicd_mcp_server.server_fixed
133+
```
134+
135+
### AWS Credentials Issues
136+
```bash
137+
# Verify credentials
138+
aws sts get-caller-identity
139+
140+
# Check region
141+
aws configure get region
142+
```
143+
144+
## Sample Usage Examples
145+
146+
147+
### CodeBuild
148+
149+
- Use aws-cicd-mcp-server and List all CodeBuild projects in my AWS account
150+
- Show me detailed information about the CodeBuild project named "SampleProject”
151+
- Create a new CodeBuild project called "test-project” with GitHub source from https://github.com/aws-samples/automated-devops-ai-toolkit
152+
- Update the CodeBuild project "test-project" to use BUILD_GENERAL1_MEDIUM compute type
153+
- Delete the CodeBuild project named "test-project"
154+
- Start a build for the CodeBuild project "test-project" using the main branch
155+
- Get the build logs for build "test-project"
156+
157+
### CodePipeline
158+
159+
- List all CodePipeline pipelines in my account
160+
- Show me detailed configuration of the pipeline named "test-pipeline"
161+
- Create a new CodePipeline called "test-pipeline" with CodeCommit source from "test-sample-project-repo"
162+
- Update the pipeline "test-pipeline" to use a different S3 bucket for artifacts
163+
- Delete the CodePipeline named "test-pipeline"
164+
- Start execution of the pipeline "test-pipeline"
165+
- Show me the execution history for pipeline "my-pipeline"
166+
167+
### CodeDeploy
168+
169+
- List all CodeDeploy applications in my account
170+
- Show me details of the CodeDeploy application "DevAppDeployment"
171+
- Create a new CodeDeploy application called "DevAppDeployment” for EC2/On-premises
172+
- Delete the CodeDeploy application "DevAppDeployment”
173+
- List all deployment groups for the application "DevAppDeployment"
174+
- Create a deployment group "production" for application "DevAppDeployment” targeting EC2 instances with tag Environment=prod
175+
- 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"
176+
- Check the status of deployment ID "d-KHXYMIF2F"
177+
178+
## Security Best Practices
179+
180+
1. **Use Read-Only Mode** for exploration and testing
181+
2. **Create Minimal IAM Roles** with only required permissions
182+
3. **Use AWS Managed Policies** when possible
183+
4. **Regularly Rotate** AWS access keys
184+
5. **Monitor CloudTrail** for CI/CD API activity
185+
186+
## Contributing
187+
188+
See the main repository [CONTRIBUTING.md](../../CONTRIBUTING.md) for contribution guidelines.
189+
190+
## License
191+
192+
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)