AWS Labs CloudFormation MCP Server
raw JSON → 1.0.19 verified Mon Apr 27 auth: no python
An AWS Labs Model Context Protocol (MCP) server for performing common CloudFormation tasks and managing resources in your AWS account. Current version 1.0.19, released monthly.
pip install awslabs-cfn-mcp-server Common errors
error ModuleNotFoundError: No module named 'awslabs_cfn_mcp_server' ↓
cause Incorrect import path; the package installs as 'cfn-mcp-server' but the importable module is 'cfn_mcp_server'.
fix
Use 'from cfn_mcp_server.server import mcp_server' instead.
error botocore.exceptions.NoCredentialsError: Unable to locate credentials ↓
cause AWS credentials not set or not properly configured for the session.
fix
Set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_DEFAULT_REGION environment variables, or configure a profile via ~/.aws/credentials.
error ValueError: Region is required for AWS clients ↓
cause AWS_DEFAULT_REGION not set and no region provided to the server.
fix
Set the AWS_DEFAULT_REGION environment variable or pass region when creating the server.
Warnings
gotcha The server only reports status events if the handler runs asynchronously; blocking calls may hang the MCP connection. ↓
fix Use async handlers or ensure your tools do not block the event loop.
deprecated The 'cfn_lint' tool may be deprecated in future releases; prefer using 'cfn_nag' or direct linting via cfn-lint package. ↓
fix Use the 'cfn_nag' tool instead or call cfn-lint directly from your code.
breaking Version 1.0.15 changed the default AWS session configuration to require explicit region setting. ↓
fix Set AWS_DEFAULT_REGION environment variable or pass region in the constructor.
gotcha The MCP server uses stdio transport by default; ensure your MCP client (e.g., Claude Desktop) is configured with 'command': 'python', 'args': ['-m', 'cfn_mcp_server']. ↓
fix Configure the client with the correct command and arguments.
Imports
- mcp_server wrong
from awslabs_cfn_mcp_server import mcp_servercorrectfrom cfn_mcp_server.server import mcp_server
Quickstart
import os
from cfn_mcp_server.server import mcp_server
# Set AWS credentials via environment variables
os.environ['AWS_ACCESS_KEY_ID'] = os.environ.get('AWS_ACCESS_KEY_ID', '')
os.environ['AWS_SECRET_ACCESS_KEY'] = os.environ.get('AWS_SECRET_ACCESS_KEY', '')
os.environ['AWS_DEFAULT_REGION'] = os.environ.get('AWS_DEFAULT_REGION', 'us-east-1')
if __name__ == '__main__':
mcp_server.run()