Skip to content

Commit bb451b6

Browse files
authored
Merge pull request #78 from microsoft/adilei-custom-mcp
Adilei custom mcp
2 parents d552286 + 3f89aec commit bb451b6

File tree

5 files changed

+317
-56
lines changed

5 files changed

+317
-56
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
dist
3+
.git
4+
.gitignore
5+
*.md
6+
.env
7+
.vscode
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Build output
5+
dist/
6+
7+
# Environment variables
8+
.env
9+
.env.local
10+
11+
# Logs
12+
*.log
13+
npm-debug.log*
14+
15+
# OS files
16+
.DS_Store
17+
Thumbs.db
18+
19+
# IDE
20+
.vscode/
21+
.idea/
22+
*.swp
23+
*.swo
24+
*~
25+
26+
# TypeScript
27+
*.tsbuildinfo
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM node:22-alpine
2+
3+
WORKDIR /app
4+
5+
# Copy package files
6+
COPY package*.json ./
7+
COPY tsconfig.json ./
8+
9+
# Install dependencies
10+
RUN npm ci
11+
12+
# Copy source code
13+
COPY src ./src
14+
15+
# Build TypeScript
16+
RUN npm run build
17+
18+
# Remove dev dependencies
19+
RUN npm prune --production
20+
21+
# Expose port
22+
EXPOSE 3000
23+
24+
# Start the server
25+
CMD ["node", "dist/index.js"]
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
#!/bin/bash
2+
3+
# Azure Deployment Script for Adventurers Guild MCP Server
4+
# This script deploys the MCP server to Azure Container Apps
5+
6+
set -e # Exit on any error
7+
8+
# Color codes for output
9+
RED='\033[0;31m'
10+
GREEN='\033[0;32m'
11+
YELLOW='\033[1;33m'
12+
NC='\033[0m' # No Color
13+
14+
echo -e "${GREEN}⚔️ Adventurers Guild MCP - Azure Deployment${NC}"
15+
echo ""
16+
17+
# Configuration
18+
RESOURCE_GROUP="rg-adventurers-guild-lab"
19+
LOCATION="eastus"
20+
CONTAINER_APP_ENV="env-adventurers-guild"
21+
CONTAINER_APP_NAME="adventurers-guild-mcp"
22+
ACR_NAME="acradventurersguild$RANDOM"
23+
24+
echo -e "${YELLOW}📋 Configuration:${NC}"
25+
echo " Resource Group: $RESOURCE_GROUP"
26+
echo " Location: $LOCATION"
27+
echo " ACR Name: $ACR_NAME"
28+
echo ""
29+
30+
# Step 1: Register required resource providers
31+
echo -e "${YELLOW}🔧 Step 1: Registering Azure resource providers...${NC}"
32+
33+
echo " Registering Microsoft.ContainerRegistry..."
34+
az provider register --namespace Microsoft.ContainerRegistry
35+
36+
echo " Registering Microsoft.App..."
37+
az provider register --namespace Microsoft.App
38+
39+
echo " Registering Microsoft.OperationalInsights..."
40+
az provider register --namespace Microsoft.OperationalInsights
41+
42+
# Wait for registration
43+
echo ""
44+
echo -e "${YELLOW}⏳ Waiting for resource providers to register (this may take 2-5 minutes)...${NC}"
45+
46+
for provider in "Microsoft.ContainerRegistry" "Microsoft.App" "Microsoft.OperationalInsights"; do
47+
echo " Waiting for $provider..."
48+
while [ "$(az provider show --namespace $provider --query registrationState -o tsv)" != "Registered" ]; do
49+
sleep 15
50+
echo " Still registering $provider..."
51+
done
52+
echo -e " ${GREEN}${NC} $provider registered"
53+
done
54+
55+
echo ""
56+
echo -e "${GREEN}✓ All resource providers registered${NC}"
57+
echo ""
58+
59+
# Step 2: Create resource group
60+
echo -e "${YELLOW}🏗️ Step 2: Creating resource group...${NC}"
61+
az group create \
62+
--name $RESOURCE_GROUP \
63+
--location $LOCATION \
64+
--output none
65+
66+
echo -e "${GREEN}✓ Resource group created${NC}"
67+
echo ""
68+
69+
# Step 3: Create Azure Container Registry
70+
echo -e "${YELLOW}📦 Step 3: Creating Azure Container Registry...${NC}"
71+
az acr create \
72+
--resource-group $RESOURCE_GROUP \
73+
--name $ACR_NAME \
74+
--sku Basic \
75+
--admin-enabled true \
76+
--output none
77+
78+
echo -e "${GREEN}✓ ACR created${NC}"
79+
echo ""
80+
81+
# Step 4: Build and push container image
82+
echo -e "${YELLOW}🔨 Step 4: Building and pushing container image...${NC}"
83+
az acr build \
84+
--registry $ACR_NAME \
85+
--image adventurers-guild-mcp:latest \
86+
--file Dockerfile \
87+
.
88+
89+
echo -e "${GREEN}✓ Image built and pushed${NC}"
90+
echo ""
91+
92+
# Step 5: Get ACR credentials
93+
echo -e "${YELLOW}🔑 Step 5: Retrieving ACR credentials...${NC}"
94+
ACR_USERNAME=$(az acr credential show --name $ACR_NAME --query username -o tsv)
95+
ACR_PASSWORD=$(az acr credential show --name $ACR_NAME --query "passwords[0].value" -o tsv)
96+
ACR_LOGIN_SERVER=$(az acr show --name $ACR_NAME --query loginServer -o tsv)
97+
98+
echo -e "${GREEN}✓ Credentials retrieved${NC}"
99+
echo ""
100+
101+
# Step 6: Create Container Apps environment
102+
echo -e "${YELLOW}🌍 Step 6: Creating Container Apps environment...${NC}"
103+
az containerapp env create \
104+
--name $CONTAINER_APP_ENV \
105+
--resource-group $RESOURCE_GROUP \
106+
--location $LOCATION \
107+
--output none
108+
109+
echo -e "${GREEN}✓ Environment created${NC}"
110+
echo ""
111+
112+
# Step 7: Deploy Container App
113+
echo -e "${YELLOW}🚀 Step 7: Deploying Container App...${NC}"
114+
az containerapp create \
115+
--name $CONTAINER_APP_NAME \
116+
--resource-group $RESOURCE_GROUP \
117+
--environment $CONTAINER_APP_ENV \
118+
--image "$ACR_LOGIN_SERVER/adventurers-guild-mcp:latest" \
119+
--target-port 3000 \
120+
--ingress external \
121+
--registry-server $ACR_LOGIN_SERVER \
122+
--registry-username $ACR_USERNAME \
123+
--registry-password $ACR_PASSWORD \
124+
--cpu 0.25 \
125+
--memory 0.5Gi \
126+
--min-replicas 0 \
127+
--max-replicas 1 \
128+
--output none
129+
130+
echo -e "${GREEN}✓ Container App deployed${NC}"
131+
echo ""
132+
133+
# Step 8: Get the public URL
134+
echo -e "${YELLOW}🔗 Step 8: Getting public URL...${NC}"
135+
FQDN=$(az containerapp show \
136+
--name $CONTAINER_APP_NAME \
137+
--resource-group $RESOURCE_GROUP \
138+
--query properties.configuration.ingress.fqdn -o tsv)
139+
140+
echo ""
141+
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
142+
echo -e "${GREEN}✅ Deployment Complete!${NC}"
143+
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
144+
echo ""
145+
echo -e "${GREEN}🌐 MCP Server URL:${NC} https://$FQDN/mcp"
146+
echo ""
147+
echo -e "${YELLOW}📝 Test your deployment:${NC}"
148+
echo ""
149+
echo " curl https://$FQDN/mcp \\"
150+
echo " -H 'Content-Type: application/json' \\"
151+
echo " -H 'Accept: application/json' \\"
152+
echo " -d '{\"jsonrpc\":\"2.0\",\"id\":\"1\",\"method\":\"tools/list\"}'"
153+
echo ""
154+
echo -e "${YELLOW}🧹 To delete all resources later:${NC}"
155+
echo " az group delete --name $RESOURCE_GROUP --yes --no-wait"
156+
echo ""

0 commit comments

Comments
 (0)