Skip to content

Commit 0bb22ac

Browse files
committed
chore: Fix build scripts in pipeline
1 parent 3a3c5a5 commit 0bb22ac

File tree

2 files changed

+19
-45
lines changed

2 files changed

+19
-45
lines changed

pipeline/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ cdk bootstrap aws://ACCOUNT-ID/us-east-2
2626
### Deploy the pipeline
2727

2828
```bash
29+
npm install
2930
npm run build
3031
npm run deploy
3132
```

pipeline/src/pipeline-stack.ts

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ export class McpServersPipelineStack extends cdk.Stack {
4444
// Source artifact
4545
const sourceOutput = new codepipeline.Artifact("SourceOutput");
4646

47-
// Build artifacts for different components
48-
const pythonLibOutput = new codepipeline.Artifact("PythonLibOutput");
49-
const typescriptLibOutput = new codepipeline.Artifact(
50-
"TypescriptLibOutput"
51-
);
52-
5347
// IAM role for CodeBuild projects
5448
const codeBuildRole = new iam.Role(this, "CodeBuildRole", {
5549
assumedBy: new iam.ServicePrincipal("codebuild.amazonaws.com"),
@@ -209,13 +203,11 @@ export class McpServersPipelineStack extends cdk.Stack {
209203
actionName: "BuildPythonLib",
210204
project: pythonLibBuild,
211205
input: sourceOutput,
212-
outputs: [pythonLibOutput],
213206
}),
214207
new codepipeline_actions.CodeBuildAction({
215208
actionName: "BuildTypescriptLib",
216209
project: typescriptLibBuild,
217210
input: sourceOutput,
218-
outputs: [typescriptLibOutput],
219211
}),
220212
],
221213
},
@@ -234,12 +226,7 @@ export class McpServersPipelineStack extends cdk.Stack {
234226
{
235227
stageName: "DeployMcpServers",
236228
actions: [
237-
...this.createServerDeployActions(
238-
serverBuilds,
239-
sourceOutput,
240-
typescriptLibOutput,
241-
pythonLibOutput
242-
),
229+
...this.createServerDeployActions(serverBuilds, sourceOutput),
243230
],
244231
},
245232
],
@@ -307,23 +294,19 @@ export class McpServersPipelineStack extends cdk.Stack {
307294
'export PATH="$HOME/.local/bin:$PATH"',
308295
],
309296
},
310-
pre_build: {
297+
build: {
311298
commands: [
312-
// Create virtual environment in the server directory
313-
`cd $CODEBUILD_SRC_DIR/examples/servers/${serverName}`,
299+
// Build library
300+
"cd $CODEBUILD_SRC_DIR/src/python",
314301
"uv venv",
315302
". .venv/bin/activate",
316-
// Install the Python library from the pre-built artifact
317-
"uv pip install $CODEBUILD_SRC_DIR_PythonLibOutput",
318-
// Install server requirements
319-
"uv pip install -r requirements.txt",
320-
],
321-
},
322-
build: {
323-
commands: [
303+
"uv sync --frozen --all-extras --dev",
304+
305+
// Build server example
324306
`cd $CODEBUILD_SRC_DIR/examples/servers/${serverName}`,
325-
'export PATH="$HOME/.local/bin:$PATH"',
326-
". .venv/bin/activate",
307+
"uv pip install -r requirements.txt",
308+
309+
// Deploy server example
327310
'cdk deploy --app "python3 cdk_stack.py" --require-approval never',
328311
],
329312
},
@@ -343,22 +326,21 @@ export class McpServersPipelineStack extends cdk.Stack {
343326
},
344327
commands: ["npm install -g aws-cdk"],
345328
},
346-
pre_build: {
329+
build: {
347330
commands: [
348-
// First, build and link the TypeScript library from the built artifact
349-
"cd $CODEBUILD_SRC_DIR_TypescriptLibOutput",
331+
// Build library
332+
"cd $CODEBUILD_SRC_DIR/src/typescript",
350333
"npm ci",
351334
"npm run build",
352335
"npm link",
353-
// Then install and link in the server directory
336+
337+
// Build server example
354338
`cd $CODEBUILD_SRC_DIR/examples/servers/${serverName}`,
355339
"npm ci",
356340
"npm link @aws/run-mcp-servers-with-aws-lambda",
357341
"npm run build",
358-
],
359-
},
360-
build: {
361-
commands: [
342+
343+
// Deploy server example
362344
`cdk deploy --app "node lib/${serverName}-mcp-server.js" --require-approval never`,
363345
],
364346
},
@@ -368,20 +350,11 @@ export class McpServersPipelineStack extends cdk.Stack {
368350

369351
private createServerDeployActions(
370352
serverBuilds: { [key: string]: codebuild.Project },
371-
sourceOutput: codepipeline.Artifact,
372-
typescriptLibOutput: codepipeline.Artifact,
373-
pythonLibOutput: codepipeline.Artifact
353+
sourceOutput: codepipeline.Artifact
374354
): codepipeline_actions.CodeBuildAction[] {
375355
return this.servers.map((server) => {
376356
const inputs = [sourceOutput];
377357

378-
// Add library artifacts as inputs based on server language
379-
if (server.language === "typescript") {
380-
inputs.push(typescriptLibOutput);
381-
} else if (server.language === "python") {
382-
inputs.push(pythonLibOutput);
383-
}
384-
385358
return new codepipeline_actions.CodeBuildAction({
386359
actionName: `Deploy${server.name
387360
.split("-")

0 commit comments

Comments
 (0)