这是一个 Model Context Protocol (MCP) 服务器,它与 AWS CodePipeline 集成,让您能够通过 Windsurf 和 Cascade 管理及操作管道。该服务器功能丰富,可实现管道的创建、修改、删除,还能对管道资源进行监控和管理。
该服务器可助力您高效管理和操作 AWS CodePipeline 管道。若想体验其功能,可按以下步骤进行部署和使用。
git clone https://github.com/your-organization/aws-codepipeline-mcp.git
cd aws-codepipeline-mcp
npm install
创建并编辑 .env 文件,添加以下内容:
# AWS 配置
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY
AWS_SECRET_ACCESS_KEY=YOUR_SECRET_KEY
# MCP 服务配置
MCP_PORT=3000
npm start
使用 AWS CLI 创建新的 CodePipeline 管道:
aws codepipeline create-pipeline \
--name MyFirstPipeline \
--pipeline {
"Stages": [
{
"Name": "Source",
"Actions": [
{
"Name": "GetSource",
"ActionTypeId": {
"Category": "Source",
"Owner": "ThirdParty",
"Provider": "GitHub",
"Version": "1"
},
"Configuration": {
"Owner": "your-org",
"Repo": "my-repo",
"Branch": "main"
}
}
]
},
{
"Name": "Build",
"Actions": [
{
"Name": "BuildAction",
"ActionTypeId": {
"Category": "Build",
"Owner": "AWS",
"Provider": "CodeBuild",
"Version": "1"
},
"Configuration": {
"ProjectName": "my-build-project"
}
}
]
}
],
"Artifacts": {
"Location": {
"S3Location": "my-bucket/pipeline-artifacts"
}
}
}
通过 AWS CLI 查询管道运行状态:
aws codepipeline list-pipelines --region us-east-1
aws codepipeline get-pipeline-state --name MyFirstPipeline --region us-east-1
以下是一个包含条件判断的复杂管道配置示例:
{
"Stages": [
{
"Name": "Source",
"Actions": [
{
"Name": "CheckoutCode",
"ActionTypeId": {
"Category": "Source",
"Owner": "ThirdParty",
"Provider": "GitHub",
"Version": "1"
},
"Configuration": {
"Repo": "my-repo",
"Branch": "main"
}
}
]
},
{
"Name": "Validation",
"Actions": [
{
"Name": "ValidateCode",
"ActionTypeId": {
"Category": "Build",
"Owner": "Custom",
"Provider": "MyValidator",
"Version": "1"
}
}
]
},
{
"Name": "Build",
"Actions": [
{
"Name": "BuildCode",
"ActionTypeId": {
"Category": "Build",
"Owner": "AWS",
"Provider": "CodeBuild",
"Version": "1"
}
}
]
},
{
"Name": "Deploy",
"Conditions": [
{
"Type": "StringEquals",
"Key": "ValidationResult",
"Value": "Success"
}
],
"Actions": [
{
"Name": "DeployToStage",
"ActionTypeId": {
"Category": "Deploy",
"Owner": "AWS",
"Provider": "CodeDeploy",
"Version": "1"
},
"Configuration": {
"DeploymentGroupName": "my-stage-deployment-group"
}
}
]
}
],
"Artifacts": {
"Location": {
"S3Location": "my-bucket/pipeline-artifacts"
}
}
}
为了确保管道资源的整洁,建议实施以下清理策略:
如需帮助或遇到问题,请联系我们的支持团队:support@your-provider.com。