This project contains the AWS CDK infrastructure code to deploy the quip-mcp-server-typescript project on AWS Lambda with API Gateway.
The architecture consists of the following components:
- AWS Lambda Function: Hosts the Quip MCP server using AWS Lambda Web Adapter to convert API Gateway requests to HTTP requests.
- API Gateway: Provides the HTTP endpoint for clients to interact with the MCP server.
- S3 Bucket: Stores the CSV files exported from Quip spreadsheets.
- AWS Secrets Manager: Stores sensitive information like the Quip API token.
flowchart TB
Client[Client] -->|HTTP Request| APIGW[API Gateway]
APIGW -->|Proxy Request| Lambda[Lambda Function]
Lambda -->|Adapter| WebAdapter[AWS Lambda Web Adapter]
WebAdapter -->|Forward Request| MCP[Quip MCP Server]
MCP -->|Store/Retrieve Files| S3[(S3 Bucket)]
MCP -->|Access Quip API| QuipAPI[Quip API]
Lambda -->|Get Secrets| SecretsManager[Secrets Manager]
subgraph "AWS Cloud"
APIGW
Lambda
WebAdapter
MCP
S3
SecretsManager
end
subgraph "External"
QuipAPI
Client
end
Before deploying this project, you need to have the following:
- AWS CLI installed and configured with appropriate credentials
- Node.js 20.x or later
- A Quip API token
infrastructure/
├── api-gateway-lambda/ # CDK project
│ ├── bin/
│ │ └── app.ts # CDK app entry point
│ ├── lib/
│ │ └── quip-mcp-server-stack.ts # Main CDK stack
│ ├── lambda/ # Lambda function code
│ │ ├── run.js # Lambda handler
│ │ └── package.json
│ ├── package.json
│ └── tsconfig.json
└── README.md
First, install the dependencies for the CDK project:
cd infrastructure/api-gateway-lambda
npm installIf you haven't used CDK in your AWS account before, you need to bootstrap it:
npx cdk bootstrapBefore deploying, you need to create a secret in AWS Secrets Manager with the following values:
QUIP_TOKEN: Your Quip API tokenQUIP_BASE_URL: The base URL for the Quip API (optional, defaults tohttps://platform.quip.com/)
You can create this secret manually in the AWS Console or use the AWS CLI:
aws secretsmanager create-secret \
--name quip-mcp-server/secrets \
--description "Secrets for Quip MCP Server" \
--secret-string '{"QUIP_TOKEN":"your-quip-api-token","QUIP_BASE_URL":"your-quip-base-url-if-needed"}'Deploy the CDK stack to your AWS account:
cd infrastructure/api-gateway-lambda
npx cdk deployThis command will:
- Synthesize the CloudFormation template
- Deploy the stack to your AWS account
- Output the API Gateway URL and API Key ID
After deployment, you need to retrieve the API key value from AWS Console or using the AWS CLI:
aws apigateway get-api-key \
--api-key YOUR_API_KEY_ID \
--include-valueReplace YOUR_API_KEY_ID with the API Key ID from the CDK output.
To use the deployed MCP server, you need to:
- Use the API Gateway URL from the CDK output
- Include the API key in the
X-API-Keyheader of your requests - Send POST requests to the
/mcpendpoint
Example:
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "X-API-Key: YOUR_API_KEY_VALUE" \
-d '{
"jsonrpc": "2.0",
"id": "1",
"method": "tools/call",
"params": {
"name": "quip_read_spreadsheet",
"arguments": {
"threadId": "YOUR_THREAD_ID"
}
}
}' \
https://your-api-gateway-url/mcpYou can monitor your Lambda function and API Gateway using AWS CloudWatch:
- Lambda logs are available in CloudWatch Logs
- API Gateway metrics are available in CloudWatch Metrics
- You can set up CloudWatch Alarms for error rates and latency
To remove all resources created by this CDK stack:
cd infrastructure/api-gateway-lambda
npx cdk destroyNote: This will not delete the S3 bucket contents or the Secrets Manager secret due to the retention policy. You need to delete them manually if required.
- The API Gateway is protected with an API key
- Sensitive information is stored in Secrets Manager
- The S3 bucket is encrypted with SSE-S3
- The Lambda function has minimal IAM permissions
- The Lambda function is configured with 1024MB of memory
- S3 lifecycle rules delete objects after 180 days
- Consider using provisioned concurrency for consistent performance if needed