|
| 1 | +# AWS Deployment — NetLicensing MCP Server |
| 2 | + |
| 3 | +Deploy the NetLicensing MCP server to AWS with a **public HTTPS URL** so remote |
| 4 | +AI agents (Claude, Copilot, custom apps) can connect via the |
| 5 | +`streamable-http` transport. |
| 6 | + |
| 7 | +Two deployment options are provided: |
| 8 | + |
| 9 | +| Option | Best for | Cost (idle) | Scale-to-zero | HTTPS | |
| 10 | +|---|---|---|---|---| |
| 11 | +| **ECS Fargate** | Production, full control | ~$5–15/mo (Spot) | No (min 1 task) | Via ALB + ACM cert | |
| 12 | +| **App Runner** | Simplest, low-traffic | ~$0 (scale-to-zero) | ✅ Yes | Auto-provisioned | |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +## Prerequisites |
| 17 | + |
| 18 | +- **AWS CLI v2** — [Install guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) |
| 19 | +- **AWS credentials** configured (`aws configure` or environment variables) |
| 20 | +- **Docker** (only needed if mirroring images to ECR for App Runner) |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## Option A — ECS Fargate (recommended for production) |
| 25 | + |
| 26 | +### 1. Deploy the stack |
| 27 | + |
| 28 | +```bash |
| 29 | +# HTTP only (quick test) |
| 30 | +./deploy.sh fargate |
| 31 | + |
| 32 | +# HTTPS (production) — requires an ACM certificate |
| 33 | +./deploy.sh fargate \ |
| 34 | + --certificate-arn arn:aws:acm:us-east-1:123456789:certificate/your-cert-id |
| 35 | +``` |
| 36 | + |
| 37 | +Or use CloudFormation directly: |
| 38 | + |
| 39 | +```bash |
| 40 | +aws cloudformation deploy \ |
| 41 | + --template-file deploy/aws/ecs-fargate.yaml \ |
| 42 | + --stack-name netlicensing-mcp \ |
| 43 | + --region us-east-1 \ |
| 44 | + --capabilities CAPABILITY_IAM \ |
| 45 | + --parameter-overrides \ |
| 46 | + CertificateArn=arn:aws:acm:us-east-1:123456789:certificate/your-cert-id |
| 47 | +``` |
| 48 | + |
| 49 | +### 2. Get the public URL |
| 50 | + |
| 51 | +```bash |
| 52 | +aws cloudformation describe-stacks \ |
| 53 | + --stack-name netlicensing-mcp \ |
| 54 | + --query 'Stacks[0].Outputs' \ |
| 55 | + --output table |
| 56 | +``` |
| 57 | + |
| 58 | +The `McpEndpointHttps` output is the URL to use in your MCP client config. |
| 59 | + |
| 60 | +### 3. Verify |
| 61 | + |
| 62 | +```bash |
| 63 | +curl https://your-alb-dns.us-east-1.elb.amazonaws.com/health |
| 64 | +# → {"status":"ok","server":"netlicensing-mcp"} |
| 65 | +``` |
| 66 | + |
| 67 | +### Architecture |
| 68 | + |
| 69 | +``` |
| 70 | +┌─────────────┐ HTTPS ┌────────────┐ HTTP ┌───────────────────┐ |
| 71 | +│ MCP Client │ ─────────── → │ ALB │ ─────────── → │ Fargate Task │ |
| 72 | +│ (Claude, │ │ (ACM TLS) │ │ netlicensing-mcp │ |
| 73 | +│ Copilot) │ └────────────┘ │ :8000/mcp │ |
| 74 | +└─────────────┘ └───────────────────┘ |
| 75 | +``` |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +## Option B — App Runner (simplest, scale-to-zero) |
| 80 | + |
| 81 | +> **Note:** App Runner only supports ECR and ECR Public images — not GHCR |
| 82 | +> directly. Use the `mirror` command to copy the image first. |
| 83 | +
|
| 84 | +### 1. Mirror the image to ECR |
| 85 | + |
| 86 | +```bash |
| 87 | +# Create an ECR repo (if it doesn't exist) |
| 88 | +aws ecr create-repository --repository-name netlicensing-mcp --region us-east-1 |
| 89 | + |
| 90 | +# Mirror using the helper script |
| 91 | +./deploy.sh mirror \ |
| 92 | + --ecr-repo 123456789.dkr.ecr.us-east-1.amazonaws.com/netlicensing-mcp |
| 93 | +``` |
| 94 | + |
| 95 | +### 2. Deploy |
| 96 | + |
| 97 | +```bash |
| 98 | +./deploy.sh apprunner \ |
| 99 | + --ecr-image 123456789.dkr.ecr.us-east-1.amazonaws.com/netlicensing-mcp:latest |
| 100 | +``` |
| 101 | + |
| 102 | +### 3. Get the public URL |
| 103 | + |
| 104 | +The stack output `McpEndpoint` contains the auto-provisioned HTTPS URL |
| 105 | +(e.g. `https://abc123.us-east-1.awsapprunner.com/mcp`). |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +## Connecting MCP Clients to the AWS Endpoint |
| 110 | + |
| 111 | +Once deployed, configure your MCP client to use the public URL with the |
| 112 | +`streamable-http` transport: |
| 113 | + |
| 114 | +### Claude Desktop / VS Code |
| 115 | + |
| 116 | +To securely invoke the remote MCP server for a specific vendor account, pass your NetLicensing API Key using the `apikey` query parameter: |
| 117 | + |
| 118 | +```json |
| 119 | +{ |
| 120 | + "mcpServers": { |
| 121 | + "netlicensing": { |
| 122 | + "url": "https://your-alb-dns.us-east-1.elb.amazonaws.com/mcp?apikey=YOUR_API_KEY" |
| 123 | + } |
| 124 | + } |
| 125 | +} |
| 126 | +``` |
| 127 | + |
| 128 | +### Generic streamable-http client |
| 129 | + |
| 130 | +Pass the API key dynamically per client via HTTP headers or in the URL string: |
| 131 | + |
| 132 | +```python |
| 133 | +from mcp import ClientSession |
| 134 | +from mcp.client.streamable_http import streamablehttp_client |
| 135 | + |
| 136 | +# You can pass the key in the URL: "https://your-endpoint/mcp?apikey=foo" |
| 137 | +# Or natively with headers: |
| 138 | +headers = {"X-NetLicensing-API-Key": "YOUR_API_KEY"} |
| 139 | + |
| 140 | +async with streamablehttp_client("https://your-endpoint/mcp", headers=headers) as (read, write, _): |
| 141 | + async with ClientSession(read, write) as session: |
| 142 | + await session.initialize() |
| 143 | + tools = await session.list_tools() |
| 144 | +``` |
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +## Cleanup |
| 149 | + |
| 150 | +```bash |
| 151 | +# Delete the stack and all resources |
| 152 | +./deploy.sh teardown --stack-name netlicensing-mcp |
| 153 | + |
| 154 | +# Or directly: |
| 155 | +aws cloudformation delete-stack --stack-name netlicensing-mcp --region us-east-1 |
| 156 | +``` |
0 commit comments