Skip to content

Commit bce133c

Browse files
author
Srihari Raman
committed
Deployed prod MCP
1 parent b576291 commit bce133c

4 files changed

Lines changed: 72 additions & 16 deletions

File tree

config.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.

config.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
# Boston CKAN MCP Server Configuration
3+
# Example: CKAN plugin for data.cityofboston.gov
4+
#
5+
# Usage: ln -sf examples/boston/config.yaml config.yaml
6+
# Then: ./scripts/deploy.sh
7+
#
8+
9+
server_name: "Boston OpenData MCP Server"
10+
description: "MCP server for Boston's CKAN open data portal"
11+
organization: "City of Boston"
12+
13+
plugins:
14+
ckan:
15+
enabled: true
16+
base_url: "https://data.boston.gov"
17+
portal_url: "https://data.boston.gov"
18+
city_name: "Boston"
19+
timeout: 120.0
20+
21+
aws:
22+
region: "us-east-1"
23+
lambda_name: "opencontext-mcp-server"
24+
lambda_memory: 512
25+
lambda_timeout: 120
26+
27+
logging:
28+
level: "INFO"
29+
format: "json"

scripts/deploy.sh

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1818
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
1919
cd "$PROJECT_ROOT"
2020

21-
echo -e "${GREEN}🚀 OpenContext Deployment${NC}"
21+
# Environment: staging (default) or prod
22+
ENVIRONMENT="${1:-staging}"
23+
if [ "$ENVIRONMENT" != "staging" ] && [ "$ENVIRONMENT" != "prod" ]; then
24+
echo -e "${RED}❌ Error: Invalid environment '${ENVIRONMENT}'${NC}"
25+
echo "Usage: $0 [staging|prod]"
26+
exit 1
27+
fi
28+
29+
echo -e "${GREEN}🚀 OpenContext Deployment [${ENVIRONMENT}]${NC}"
2230
echo "================================"
2331
echo ""
2432

@@ -172,17 +180,8 @@ print(config.get('aws', {}).get('region', 'us-east-1'))
172180
EOF
173181
)
174182

175-
LAMBDA_NAME=$(python3 << 'EOF'
176-
import yaml
177-
with open('config.yaml', 'r') as f:
178-
config = yaml.safe_load(f)
179-
lambda_name = config.get('aws', {}).get('lambda_name', '')
180-
if not lambda_name:
181-
server_name = config.get('server_name', 'my-mcp-server')
182-
lambda_name = server_name.lower().replace(' ', '-')
183-
print(lambda_name)
184-
EOF
185-
)
183+
TFVARS_FILE="terraform/aws/${ENVIRONMENT}.tfvars"
184+
LAMBDA_NAME=$(grep '^lambda_name' "$TFVARS_FILE" | sed 's/.*=\s*"\(.*\)"/\1/')
186185

187186
echo -e "${YELLOW}📦 Step 2: Packaging Lambda code...${NC}"
188187

@@ -249,10 +248,20 @@ fi
249248

250249
# Plan first - validates configuration and catches errors before any changes
251250
cd terraform/aws
251+
252+
# Select Terraform workspace: staging uses default, prod uses its own
253+
if [ "$ENVIRONMENT" = "prod" ]; then
254+
echo "Selecting Terraform workspace: boston-prod"
255+
terraform workspace select boston-prod 2>/dev/null || terraform workspace new boston-prod
256+
else
257+
echo "Selecting Terraform workspace: default"
258+
terraform workspace select default 2>/dev/null || true
259+
fi
260+
252261
echo -e "${YELLOW}📋 Planning Terraform changes...${NC}"
253262
if ! terraform plan \
254263
-out=tfplan \
255-
-var="lambda_name=$LAMBDA_NAME" \
264+
-var-file="${ENVIRONMENT}.tfvars" \
256265
-var="aws_region=$AWS_REGION" \
257266
-var="config_file=config.yaml"; then
258267
echo -e "${RED}❌ Terraform plan failed - aborting deployment${NC}"
@@ -262,8 +271,9 @@ fi
262271
# Require explicit approval before deploying
263272
echo ""
264273
echo -e "${YELLOW}⚠️ Deployment will apply the planned changes to AWS.${NC}"
265-
echo -e " Lambda: ${LAMBDA_NAME}"
266-
echo -e " Region: ${AWS_REGION}"
274+
echo -e " Environment: ${ENVIRONMENT}"
275+
echo -e " Lambda: ${LAMBDA_NAME}"
276+
echo -e " Region: ${AWS_REGION}"
267277
echo ""
268278
read -r -p "Do you want to proceed with deployment? (yes/no): " CONFIRM
269279
if [ "$CONFIRM" != "yes" ] && [ "$CONFIRM" != "y" ]; then

terraform/aws/prod.tfvars

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
lambda_name = "boston-opencontext-mcp-prod"
2+
stage_name = "prod"
3+
aws_region = "us-east-1"
4+
config_file = "config.yaml"
5+
lambda_memory = 512
6+
lambda_timeout = 120
7+
api_quota_limit = 1000
8+
api_rate_limit = 5
9+
api_burst_limit = 10

terraform/aws/staging.tfvars

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
lambda_name = "opencontext-mcp-server"
2+
stage_name = "staging"
3+
aws_region = "us-east-1"
4+
config_file = "config.yaml"
5+
lambda_memory = 512
6+
lambda_timeout = 120
7+
api_quota_limit = 1000
8+
api_rate_limit = 5
9+
api_burst_limit = 10

0 commit comments

Comments
 (0)