service: shopify-agentic-mcp
provider:
name: aws
runtime: nodejs22.x
architecture: arm64
region: ${env:AWS_REGION, 'us-east-1'}
memorySize: 512
timeout: 30
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
- dynamodb:Query
- dynamodb:Scan
- dynamodb:BatchWriteItem
Resource:
- !GetAtt MandatesTable.Arn
- !Join ['/', [!GetAtt MandatesTable.Arn, 'index/*']]
- !GetAtt LedgerTable.Arn
- !GetAtt SessionsTable.Arn
environment:
SHOPIFY_API_KEY: ${env:SHOPIFY_API_KEY}
SHOPIFY_API_SECRET: ${env:SHOPIFY_API_SECRET}
SHOPIFY_STORE_DOMAIN: ${env:SHOPIFY_STORE_DOMAIN}
SHOPIFY_ACCESS_TOKEN: ${env:SHOPIFY_ACCESS_TOKEN}
SHOPIFY_STOREFRONT_TOKEN: ${env:SHOPIFY_STOREFRONT_TOKEN}
AP2_SIGNING_PRIVATE_KEY: ${env:AP2_SIGNING_PRIVATE_KEY}
GATEWAY_BASE_URL: ${env:GATEWAY_BASE_URL}
FEE_RATE: ${env:FEE_RATE, '0.005'}
FEE_WALLET_ADDRESS: ${env:FEE_WALLET_ADDRESS}
DYNAMODB_TABLE_MANDATES: ${self:service}-mandates-${sls:stage}
DYNAMODB_TABLE_LEDGER: ${self:service}-ledger-${sls:stage}
DYNAMODB_TABLE_SESSIONS: ${self:service}-sessions-${sls:stage}
LOG_LEVEL: ${env:LOG_LEVEL, 'info'}
ALLOWED_ORIGIN: ${env:ALLOWED_ORIGIN, '*'}
GATEWAY_API_KEY: ${env:GATEWAY_API_KEY, ''}
functions:
ucpGateway:
handler: dist/index.handler
events:
- httpApi:
path: /ucp/v1/{proxy+}
method: ANY
- httpApi:
path: /.well-known/ucp
method: GET
- httpApi:
path: /mcp
method: POST
- httpApi:
path: /a2a
method: POST
- httpApi:
path: /a2a
method: GET
- httpApi:
path: /.well-known/agent.json
method: GET
resources:
Resources:
MandatesTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:provider.environment.DYNAMODB_TABLE_MANDATES}
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: mandateId
AttributeType: S
- AttributeName: checkoutId
AttributeType: S
KeySchema:
- AttributeName: mandateId
KeyType: HASH
GlobalSecondaryIndexes:
- IndexName: checkoutIndex
KeySchema:
- AttributeName: checkoutId
KeyType: HASH
Projection:
ProjectionType: ALL
LedgerTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:provider.environment.DYNAMODB_TABLE_LEDGER}
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: transactionId
AttributeType: S
KeySchema:
- AttributeName: transactionId
KeyType: HASH
SessionsTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:provider.environment.DYNAMODB_TABLE_SESSIONS}
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: sessionId
AttributeType: S
KeySchema:
- AttributeName: sessionId
KeyType: HASH
TimeToLiveSpecification:
AttributeName: ttl
Enabled: true