This is the AWS DynamoDB MCP Server - an official AWS Labs Model Context Protocol (MCP) server that provides DynamoDB expert design guidance and data modeling assistance. The project is built with Python 3.10+ and uses uv for dependency management.
Current Version: See version in pyproject.toml
Project URLs:
- Homepage: https://awslabs.github.io/mcp/
- Documentation: https://awslabs.github.io/mcp/servers/dynamodb-mcp-server/
- Repository: https://github.com/awslabs/mcp.git
- Changelog: https://github.com/awslabs/mcp/blob/main/src/dynamodb-mcp-server/CHANGELOG.md
Package Information:
- PyPI Package:
awslabs.dynamodb-mcp-server - License: Apache-2.0
- Install
uvfrom Astral - Install Python:
uv python install 3.10 - Set up AWS credentials with access to AWS services
# Install dependencies
uv sync
# Install development dependencies
uv sync --group dev
# Activate virtual environment
source .venv/bin/activate
# Run the MCP server
uv run awslabs.dynamodb-mcp-server
# Run with uvx (production-like)
uvx awslabs.dynamodb-mcp-server@latest# Build Docker image
docker build -t awslabs/dynamodb-mcp-server .
# Run Docker container
docker run --rm --interactive --env FASTMCP_LOG_LEVEL=ERROR awslabs/dynamodb-mcp-server:latest
# Docker healthcheck
# The container includes a healthcheck script at /app/docker-healthcheck.sh# Format code
uv run ruff format
# Lint code
uv run ruff check
# Fix linting issues automatically
uv run ruff check --fix
# Type checking
uv run pyright
# Run all quality checks
uv run ruff check && uv run pyright- Formatter: Ruff (see pyproject.toml for complete configuration)
- Type Checker: Pyright (configured in pyproject.toml)
- Complete style rules and exceptions are defined in pyproject.toml
# Install pre-commit hooks (if .pre-commit-config.yaml exists)
uv run pre-commit install
# Run pre-commit on all files
uv run pre-commit run --all-filesNote: This project includes pre-commit as a dev dependency but does not have a .pre-commit-config.yaml file configured.
# Run all tests
uv run pytest
# Run tests with coverage
uv run pytest --cov=awslabs --cov-report=html
# Run specific test file
uv run pytest tests/test_dynamodb_server.py
# Run with verbose output
uv run pytest -v
# Run specific test function
uv run pytest tests/test_dynamodb_server.py::test_function_name
# Run tests by marker
uv run pytest -m integration # Run integration tests
uv run pytest -m "not live" # Skip live tests (default behavior)
uv run pytest -m unit # Run unit tests onlyThe project uses pytest markers to categorize tests (configured in pyproject.toml):
- integration: Integration tests (slower, end-to-end)
- live: Live API calls (skipped by default)
- asyncio: Async tests (auto-mode enabled)
- unit: Unit tests (fast, isolated)
- file_generation: File generation tests
- slow: Comprehensive/slow tests
- python: Python language-specific tests
- snapshot: Snapshot tests for generated code consistency
Default Test Behavior: Tests marked with integration or live are excluded by default (configured via pytest addopts: -m 'not integration and not live')
- Property-based tests: Using
hypothesisfor comprehensive input validation - Comprehensive test coverage: Unit and integration tests
- Async test support: pytest-asyncio with auto mode
- Mocking support: Using
motofor AWS service mocking - Coverage exclusions: Pragma comments and main blocks are excluded
tests/test_dynamodb_server.py- Main MCP server teststests/test_common.py- Common utilities teststests/test_markdown_formatter.py- Markdown formatting teststests/test_model_validation_utils.py- DynamoDB validation teststests/db_analyzer/- Database analyzer teststests/cdk_generator/- CDK code generation teststests/repo_generation_tool/- Data access layer generation teststests/conftest.py- Shared pytest fixtures and configuration
- Tests use
pytestwithasyncio_mode = "auto"(configured in pyproject.toml) - MySQL integration tests use environment variable fixtures (mysql_env_setup)
- Coverage reports exclude pragma comments and main blocks (configured in pyproject.toml)
- Coverage source:
awslabsdirectory - Coverage omits:
awslabs/dynamodb_mcp_server/repo_generation_tool/languages/python/base_repository.py
awslabs/dynamodb_mcp_server/server.py- Main MCP server implementation with FastMCPawslabs/dynamodb_mcp_server/common.py- Shared utilities and typesawslabs/dynamodb_mcp_server/model_validation_utils.py- DynamoDB Local validationawslabs/dynamodb_mcp_server/markdown_formatter.py- Output formattingawslabs/dynamodb_mcp_server/__init__.py- Package initialization with version info
awslabs/dynamodb_mcp_server/prompts/- Expert prompts and guidancedynamodb_architect.md- Main data modeling expert promptdynamodb_schema_generator.md- Schema generation guidancejson_generation_guide.md- JSON specification guidetransform_model_validation_result.md- Validation result formattingusage_data_generator.md- Test data generation instructionsdal_implementation/- Data access layer implementation templatesnext_steps/- Post-modeling guidance
awslabs/dynamodb_mcp_server/db_analyzer/- Database analysis tools (MySQL, PostgreSQL, SQL Server, Oracle)base_plugin.py- Base analyzer plugin interfacemysql.py- MySQL analyzer implementationpostgresql.py- PostgreSQL analyzer implementationsqlserver.py- SQL Server analyzer implementationplugin_registry.py- Plugin discovery and registrationanalyzer_utils.py- Common analyzer utilities
awslabs/dynamodb_mcp_server/cdk_generator/- CDK infrastructure code generationgenerator.py- CDK app generatormodels.py- CDK generation models
awslabs/dynamodb_mcp_server/repo_generation_tool/- Data access layer code generationcore/- Core validation and parsing logiclanguages/- Language-specific code generatorscodegen.py- Main code generation orchestration
tests/- Test suite with unit and integration tests
The DynamoDB MCP server provides 7 tools for data modeling, validation, and code generation:
-
dynamodb_data_modeling - Interactive data model design with expert guidance. Retrieves the complete DynamoDB Data Modeling Expert prompt with enterprise-level design patterns, cost optimization strategies, and multi-table design philosophy.
-
dynamodb_data_model_validation - Automated validation using DynamoDB Local. Validates your DynamoDB data model by loading dynamodb_data_model.json, setting up DynamoDB Local, creating tables with test data, and executing all defined access patterns.
-
source_db_analyzer - Extract schema and patterns from existing databases. Analyzes existing MySQL/PostgreSQL/SQL Server/Oracle databases to extract schema structure and access patterns from Performance Schema.
-
generate_resources - Generates various resources from the DynamoDB data model JSON file. Currently supports CDK infrastructure code generation for deploying DynamoDB tables.
-
dynamodb_data_model_schema_converter - Converts your data model (dynamodb_data_model.md) into a structured schema.json file representing your DynamoDB tables, indexes, entities, fields, and access patterns. Automatically validates the schema with up to 8 iterations.
-
dynamodb_data_model_schema_validator - Validates schema.json files for code generation compatibility. Checks field types, operations, GSI mappings, pattern IDs, and provides detailed error messages with fix suggestions.
-
generate_data_access_layer - Generates type-safe Python code from schema.json including entity classes with field validation, repository classes with CRUD operations, fully implemented access patterns, and optional usage examples.
When using the MCP tools, the following files are typically generated:
dynamodb_requirements.md- Requirements gathering outputdynamodb_data_model.md- Human-readable data model designdynamodb_data_model.json- Machine-readable model specificationdynamodb_model_validation.json- Validation resultsvalidation_result.md- Validation summaryschema.json- Structured schema for code generationgenerated_dal/- Generated data access layer codedatabase_analysis_YYYYMMDD_HHMMSS/- Database analysis results
- Make changes following code style guidelines
- Add/update tests for new functionality
- Run quality checks:
uv run ruff check && uv run pyright - Run test suite:
uv run pytest - Commit with conventional commit format (commitizen is configured)
- Submit pull request or create code review
Follow Conventional Commits:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Types: feat, fix, docs, style, refactor, perf, test, chore, ci
Examples:
feat(cdk): add support for point-in-time recoveryfix(validation): handle empty access pattern listsdocs: update AGENTS.md with new tool descriptions
- Version is managed in
pyproject.tomlandawslabs/dynamodb_mcp_server/__init__.py - Both files must be updated:
pyproject.tomlfor packaging/distribution,__init__.pyfor runtime version checking - Check
pyproject.tomlfor current version number - CHANGELOG.md exists and commitizen is configured to update it
- Version format follows Semantic Versioning
- Set
FASTMCP_LOG_LEVEL=DEBUGfor verbose logging - Available levels: DEBUG, INFO, WARNING, ERROR
- Project uses
logurufor structured logging (see pyproject.toml for version) - Logs include timestamps, levels, and contextual information
- Issue: Container runtime not found
- Solution: Ensure Docker, Podman, Finch, or nerdctl is installed and running
- Alternative: Install Java 17+ and set JAVA_HOME environment variable
- Issue: Connection timeout or permission denied
- Solution: Verify AWS credentials, check Security Group rules, ensure RDS Data API is enabled
- Debug: Set
FASTMCP_LOG_LEVEL=DEBUGto see detailed connection logs
- Issue: Schema validation fails
- Solution: Run
dynamodb_data_model_schema_validatorto get detailed error messages - Common fixes: Check field types, ensure GSI names match, verify pattern IDs are unique
- DynamoDB Local validation requires container runtime (Docker/Podman/Finch/nerdctl) or Java 17+
- MySQL analyzer result sets are limited by
MYSQL_MAX_QUERY_RESULTSenvironment variable (default: 500, defined indb_analyzer/mysql.py) - Schema validation can take up to 8 iterations for complex models
- Code generation is optimized for schemas with up to 50 entities
- MySQL analyzer has built-in read-only mode by default (DEFAULT_READONLY = True)
- Schema validation blocks path traversal attempts
- All database operations use parameterized queries to prevent SQL injection
- Secrets are retrieved from AWS Secrets Manager, never hardcoded
- AWS credentials follow standard AWS SDK credential chain
- Use least-privilege IAM roles for AWS operations
- Rotate database credentials regularly in Secrets Manager
- Review generated code before deploying to production
- Run validation tests against DynamoDB Local, not production tables
- Use read-only replicas for source database analysis when possible
- Minimum: Python 3.10
- Tested: Python 3.10, 3.11, 3.12, 3.13
- Docker production build: Python 3.13 (as specified in Dockerfile)
- Recommended: Python 3.12+ for best performance
- See pyproject.toml for complete list of production and development dependencies
- FastMCP framework is used for MCP server implementation
- Compatible with MCP clients: Kiro CLI, Cursor, VS Code, Claude Desktop
- AWS SDK follows standard credential chain (env vars, config files, IAM roles)
- Database analyzers support AWS RDS Data API and direct connections
- Build backend: Hatchling
- Package name: awslabs.dynamodb-mcp-server
- License: Apache-2.0 (see LICENSE and NOTICE files)
- Entry point: awslabs.dynamodb-mcp-server (maps to awslabs.dynamodb_mcp_server.server:main)
# Build with uv
uv build
# Install in editable mode for development
uv pip install -e .- Published to PyPI as
awslabs.dynamodb-mcp-server - Version updates require changes to both
pyproject.toml(for packaging) and__init__.py(for runtime) - Changelog maintained in CHANGELOG.md following Keep a Changelog format
- Supports installation via
uvxfor latest version
- Direct references allowed via
allow-direct-references = true - Packages list:
["awslabs"]- includes entire awslabs namespace - Excludes:
.venv,__pycache__,node_modules,dist,build, etc.
- Model Context Protocol Specification
- FastMCP Documentation
- DynamoDB Best Practices
- AWS SDK for Python (Boto3)
- Report issues on GitHub
- Refer to official documentation at AWS Labs MCP
- Review CHANGELOG.md for version history and breaking changes