Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit46a3d16

Browse files
committed
feat: mcp server for interacting with aws codepipeline
0 parents  commit46a3d16

28 files changed

+4821
-0
lines changed

‎.env.example‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
AWS_REGION=us-east-1
2+
AWS_ACCESS_KEY_ID=your_access_key_id
3+
AWS_SECRET_ACCESS_KEY=your_secret_access_key
4+
PORT=3000

‎.gitignore‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Dependency directories
2+
node_modules/
3+
jspm_packages/
4+
5+
# Build outputs
6+
dist/
7+
build/
8+
out/
9+
*.tsbuildinfo
10+
11+
# Environment variables and secrets
12+
.env
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
*.pem
18+
*.key
19+
*.cert
20+
*.crt
21+
*.p12
22+
.aws/
23+
aws-credentials.json
24+
25+
# Logs
26+
logs
27+
*.log
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
lerna-debug.log*
32+
.pnpm-debug.log*
33+
34+
# IDE specific files
35+
.idea/
36+
.vscode/
37+
*.swp
38+
*.swo
39+
.DS_Store
40+
.project
41+
.classpath
42+
.settings/
43+
*.sublime-workspace
44+
*.sublime-project
45+
46+
# Testing
47+
coverage/
48+
.nyc_output/
49+
50+
# Temporary files
51+
tmp/
52+
temp/
53+
*.tmp
54+
*.bak
55+
56+
# Misc
57+
.cache/
58+
.npm
59+
.eslintcache
60+
.stylelintcache
61+
.yarn/cache
62+
.yarn/unplugged
63+
.yarn/build-state.yml
64+
.yarn/install-state.gz
65+
.pnp.*
66+
67+
# AWS specific
68+
.aws-sam/
69+
samconfig.toml
70+
cloudformation-template-*.json
71+
72+
# MCP specific
73+
mcp_config.json

‎README.md‎

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
#AWS CodePipeline MCP Server
2+
3+
This is a Model Context Protocol (MCP) server that integrates with AWS CodePipeline, allowing you to manage your pipelines through Windsurf and Cascade. The server provides a standardized interface for interacting with AWS CodePipeline services.
4+
5+
**Author:** Cuong T Nguyen
6+
7+
##Features
8+
9+
- List all pipelines
10+
- Get pipeline state and detailed pipeline definitions
11+
- List pipeline executions
12+
- Approve or reject manual approval actions
13+
- Retry failed stages
14+
- Trigger pipeline executions
15+
- View pipeline execution logs
16+
- Stop pipeline executions
17+
- Tag pipeline resources
18+
- Create webhooks for automatic pipeline triggering
19+
- Get pipeline performance metrics
20+
21+
##Prerequisites
22+
23+
- Node.js (v14 or later)
24+
- AWS account with CodePipeline access
25+
- AWS credentials with permissions for CodePipeline, CloudWatch, and IAM (for tagging)
26+
- Windsurf IDE with Cascade AI assistant
27+
28+
##Installation
29+
30+
1. Clone this repository:
31+
32+
```bash
33+
git clone https://github.com/cuongdev/mcp-codepipeline-server.git
34+
cd mcp-codepipeline-server
35+
```
36+
37+
2. Install dependencies:
38+
39+
```bash
40+
npm install
41+
```
42+
43+
3. Create a`.env` file based on the`.env.example` template:
44+
45+
```bash
46+
cp .env.example .env
47+
```
48+
49+
4. Update the`.env` file with your AWS credentials and configuration:
50+
51+
```
52+
AWS_REGION=us-east-1
53+
AWS_ACCESS_KEY_ID=your_access_key_id
54+
AWS_SECRET_ACCESS_KEY=your_secret_access_key
55+
PORT=3000
56+
```
57+
58+
>**Note**: For security, never commit your`.env` file to version control.
59+
60+
##Usage
61+
62+
###Build the project
63+
64+
```bash
65+
npm run build
66+
```
67+
68+
###Start the server
69+
70+
```bash
71+
npm start
72+
```
73+
74+
For development with auto-restart:
75+
76+
```bash
77+
npm run dev
78+
```
79+
80+
##Integration with Windsurf
81+
82+
This MCP server is designed to work with Windsurf, allowing Cascade to interact with AWS CodePipeline through natural language requests.
83+
84+
###Setup Steps
85+
86+
1. Make sure the server is running:
87+
88+
```bash
89+
npm start
90+
```
91+
92+
2. Add the server configuration to your Windsurf MCP config file at`~/.codeium/windsurf/mcp_config.json`:
93+
94+
```json
95+
{
96+
"mcpServers": {
97+
"codepipeline": {
98+
"command":"npx",
99+
"args": [
100+
"-y",
101+
"path/to/mcp-codepipeline-server/dist/index.js"
102+
],
103+
"env": {
104+
"AWS_REGION":"us-east-1",
105+
"AWS_ACCESS_KEY_ID":"your_access_key_id",
106+
"AWS_SECRET_ACCESS_KEY":"your_secret_access_key"
107+
}
108+
}
109+
}
110+
}
111+
```
112+
113+
3. Create the directory if it doesn't exist:
114+
115+
```bash
116+
mkdir -p~/.codeium/windsurf
117+
touch~/.codeium/windsurf/mcp_config.json
118+
```
119+
120+
4. Restart Windsurf to load the new MCP server configuration
121+
122+
###Using with Cascade
123+
124+
Once configured, you can interact with AWS CodePipeline using natural language in Windsurf. For example:
125+
126+
- "List all my CodePipeline pipelines"
127+
- "Show me the current state of my 'production-deploy' pipeline"
128+
- "Trigger the 'test-build' pipeline"
129+
- "Get metrics for my 'data-processing' pipeline"
130+
- "Create a webhook for my 'frontend-deploy' pipeline"
131+
132+
Cascade will translate these requests into the appropriate MCP tool calls.
133+
134+
##MCP Tools
135+
136+
###Core Pipeline Management
137+
138+
| Tool Name| Description| Parameters|
139+
|-----------|-------------|------------|
140+
|`list_pipelines`| List all CodePipeline pipelines| None|
141+
|`get_pipeline_state`| Get the state of a specific pipeline|`pipelineName`: Name of the pipeline|
142+
|`list_pipeline_executions`| List executions for a specific pipeline|`pipelineName`: Name of the pipeline|
143+
|`trigger_pipeline`| Trigger a pipeline execution|`pipelineName`: Name of the pipeline|
144+
|`stop_pipeline_execution`| Stop a pipeline execution|`pipelineName`: Name of the pipeline<br>`executionId`: Execution ID<br>`reason`: Optional reason for stopping|
145+
146+
###Pipeline Details and Metrics
147+
148+
| Tool Name| Description| Parameters|
149+
|-----------|-------------|------------|
150+
|`get_pipeline_details`| Get the full definition of a pipeline|`pipelineName`: Name of the pipeline|
151+
|`get_pipeline_execution_logs`| Get logs for a pipeline execution|`pipelineName`: Name of the pipeline<br>`executionId`: Execution ID|
152+
|`get_pipeline_metrics`| Get performance metrics for a pipeline|`pipelineName`: Name of the pipeline<br>`period`: Optional metric period in seconds<br>`startTime`: Optional start time for metrics<br>`endTime`: Optional end time for metrics|
153+
154+
###Pipeline Actions and Integrations
155+
156+
| Tool Name| Description| Parameters|
157+
|-----------|-------------|------------|
158+
|`approve_action`| Approve or reject a manual approval action|`pipelineName`: Name of the pipeline<br>`stageName`: Name of the stage<br>`actionName`: Name of the action<br>`token`: Approval token<br>`approved`: Boolean indicating approval or rejection<br>`comments`: Optional comments|
159+
|`retry_stage`| Retry a failed stage|`pipelineName`: Name of the pipeline<br>`stageName`: Name of the stage<br>`pipelineExecutionId`: Execution ID|
160+
|`tag_pipeline_resource`| Add or update tags for a pipeline resource|`pipelineName`: Name of the pipeline<br>`tags`: Array of key-value pairs for tagging|
161+
|`create_pipeline_webhook`| Create a webhook for a pipeline|`pipelineName`: Name of the pipeline<br>`webhookName`: Name for the webhook<br>`targetAction`: Target action for the webhook<br>`authentication`: Authentication type<br>`authenticationConfiguration`: Optional auth config<br>`filters`: Optional event filters|
162+
163+
##Troubleshooting
164+
165+
###Common Issues
166+
167+
1.**Connection refused error**:
168+
- Ensure the server is running on the specified port
169+
- Check if the port is blocked by a firewall
170+
171+
2.**AWS credential errors**:
172+
- Verify your AWS credentials in the`.env` file
173+
- Ensure your IAM user has the necessary permissions
174+
175+
3.**Windsurf not detecting the MCP server**:
176+
- Check the`mcp_config.json` file format
177+
- Ensure the server URL is correct
178+
- Restart Windsurf after making changes
179+
180+
###Logs
181+
182+
The server logs information to the console. Check these logs for troubleshooting:
183+
184+
```bash
185+
# Run with more verbose logging
186+
DEBUG=* npm start
187+
```
188+
189+
##Examples
190+
191+
###Creating a Webhook for GitHub Integration
192+
193+
```json
194+
{
195+
"pipelineName":"my-pipeline",
196+
"webhookName":"github-webhook",
197+
"targetAction":"Source",
198+
"authentication":"GITHUB_HMAC",
199+
"authenticationConfiguration": {
200+
"SecretToken":"my-secret-token"
201+
},
202+
"filters": [
203+
{
204+
"jsonPath":"$.ref",
205+
"matchEquals":"refs/heads/main"
206+
}
207+
]
208+
}
209+
```
210+
211+
###Getting Pipeline Metrics
212+
213+
```json
214+
{
215+
"pipelineName":"my-pipeline",
216+
"period":86400,
217+
"startTime":"2025-03-10T00:00:00Z",
218+
"endTime":"2025-03-17T23:59:59Z"
219+
}
220+
```
221+
222+
##License
223+
224+
ISC

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp