# Infrastructure Deployment Guide
This directory contains AWS SAM templates for deploying the MCP Gateway POC.
## Prerequisites
1. AWS CLI configured with appropriate credentials
2. AWS SAM CLI installed (`pip install aws-sam-cli`)
3. Docker installed (for local testing)
## Deployment Steps
### 1. Build the Application
```bash
sam build
```
### 2. Deploy to AWS
```bash
sam deploy --guided
```
The `--guided` flag will prompt you for:
- Stack name
- AWS Region
- Parameter values
- Confirmation of IAM role creation
### 3. Deploy with Specific Parameters
```bash
sam deploy \
--stack-name mcp-gateway-poc \
--parameter-overrides Environment=dev \
--capabilities CAPABILITY_IAM \
--region us-east-1
```
## Post-Deployment
After deployment, you'll receive:
- **MCP Gateway API URL**: The endpoint for MCP requests
- **Lambda Function ARNs**: ARNs for all deployed functions
### Register Tools with Gateway
After deployment, you need to register the Lambda functions as MCP tools. You can do this by:
1. Using the configuration script:
```bash
python scripts/register_tools.py
```
2. Or manually via the gateway API (if you add a registration endpoint)
## Local Testing
### Test Locally with SAM
```bash
sam local start-api
```
This will start a local API Gateway at `http://localhost:3000`
### Test MCP Gateway Locally
```bash
python test_gateway.py
```
## Cleanup
To remove all resources:
```bash
sam delete --stack-name mcp-gateway-poc
```
## Architecture
The template creates:
- **MCP Gateway Lambda**: Main gateway function
- **Tool Lambda Functions**: Example tools (weather, calculator, data lookup)
- **API Gateway**: REST API endpoint for MCP protocol
## Customization
To add more tools:
1. Create new Lambda function in `tools/lambda_functions/`
2. Add function definition to `template.yaml`
3. Add IAM policy for gateway to invoke the function
4. Register the tool (see scripts/register_tools.py)