DynamoDB MCP server

Integrates with Amazon DynamoDB to enable natural language-based table management, capacity adjustment, and data operations while maintaining safeguards against accidental deletions.
Back to servers
Provider
Iman Kamyabi
Release date
Jan 08, 2025
Language
TypeScript
Stats
8 stars

The DynamoDB MCP Server provides a Model Context Protocol interface for managing Amazon DynamoDB resources, allowing you to control tables, indexes, capacity, and perform data operations through natural language interactions with Claude.

Installation

Prerequisites

  • Node.js installed on your system
  • AWS account with access credentials
  • npm package manager

Setup Steps

  1. Install dependencies:

    npm install
    
  2. Configure AWS credentials as environment variables:

    export AWS_ACCESS_KEY_ID="your_access_key"
    export AWS_SECRET_ACCESS_KEY="your_secret_key"
    export AWS_REGION="your_region"
    
  3. Build the server:

    npm run build
    
  4. Start the server:

    npm start
    

Docker Setup

You can also run the server using Docker:

docker build -t mcp/dynamodb-mcp-server -f Dockerfile .
docker run -i --rm -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_REGION -e AWS_SESSION_TOKEN mcp/dynamodb-mcp-server

Configuration

Setting up AWS Credentials

  1. Obtain AWS access key ID, secret access key, and region from the AWS Management Console
  2. If using temporary credentials (e.g., IAM role), also obtain a session token
  3. Ensure these credentials have appropriate permissions for DynamoDB operations

Integration with Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "dynamodb": {
      "command": "docker",
      "args": [ "run", "-i", "--rm", "-e", "AWS_ACCESS_KEY_ID", "-e", "AWS_SECRET_ACCESS_KEY", "-e", "AWS_REGION", "-e", "AWS_SESSION_TOKEN", "mcp/dynamodb-mcp-server" ],
      "env": {
        "AWS_ACCESS_KEY_ID": "your_access_key",
        "AWS_SECRET_ACCESS_KEY": "your_secret_key",
        "AWS_REGION": "your_region",
        "AWS_SESSION_TOKEN": "your_session_token"  
      }
    }
  }
}

Available Operations

Table Management

Create Table

Creates a new DynamoDB table with specified configuration.

Example request:

{
  "tableName": "Users",
  "partitionKey": "userId",
  "partitionKeyType": "S",
  "readCapacity": 5,
  "writeCapacity": 5
}

List Tables

Lists all DynamoDB tables in the account.

Example request:

{
  "limit": 10
}

Describe Table

Gets detailed information about a DynamoDB table.

Example request:

{
  "tableName": "Users"
}

Index Management

Create Global Secondary Index (GSI)

Creates a global secondary index on a table.

Example request:

{
  "tableName": "Users",
  "indexName": "EmailIndex",
  "partitionKey": "email",
  "partitionKeyType": "S",
  "projectionType": "ALL",
  "readCapacity": 5,
  "writeCapacity": 5
}

Update GSI Capacity

Updates the provisioned capacity of a global secondary index.

Example request:

{
  "tableName": "Users",
  "indexName": "EmailIndex",
  "readCapacity": 10,
  "writeCapacity": 10
}

Create Local Secondary Index (LSI)

Creates a local secondary index on a table (must be done during table creation).

Example request:

{
  "tableName": "Users",
  "indexName": "CreatedAtIndex",
  "partitionKey": "userId",
  "partitionKeyType": "S",
  "sortKey": "createdAt",
  "sortKeyType": "N",
  "projectionType": "ALL"
}

Capacity Management

Update Table Capacity

Updates the provisioned capacity of a table.

Example request:

{
  "tableName": "Users",
  "readCapacity": 10,
  "writeCapacity": 10
}

Data Operations

Put Item

Inserts or replaces an item in a table.

Example request:

{
  "tableName": "Users",
  "item": {
    "userId": "123",
    "name": "John Doe",
    "email": "[email protected]"
  }
}

Get Item

Retrieves an item from a table by its primary key.

Example request:

{
  "tableName": "Users",
  "key": {
    "userId": "123"
  }
}

Update Item

Updates specific attributes of an item in a table.

Example request:

{
  "tableName": "Users",
  "key": {
    "userId": "123"
  },
  "updateExpression": "SET #n = :name",
  "expressionAttributeNames": {
    "#n": "name"
  },
  "expressionAttributeValues": {
    ":name": "Jane Doe"
  }
}

Query Table

Queries a table using key conditions and optional filters.

Example request:

{
  "tableName": "Users",
  "keyConditionExpression": "userId = :id",
  "expressionAttributeValues": {
    ":id": "123"
  }
}

Scan Table

Scans an entire table with optional filters.

Example request:

{
  "tableName": "Users",
  "filterExpression": "age > :minAge",
  "expressionAttributeValues": {
    ":minAge": 21
  }
}

Example Questions for Claude

You can ask Claude natural language questions to interact with your DynamoDB database:

Table Management Examples

  • "Create a new DynamoDB table called 'Products' with a partition key 'productId' (string) and sort key 'timestamp' (number)"
  • "List all DynamoDB tables in my account"
  • "What's the current configuration of the Users table?"
  • "Add a global secondary index on the email field of the Users table"

Data Operation Examples

  • "Insert a new user with ID '123', name 'John Doe', and email '[email protected]'"
  • "Get the user with ID '123'"
  • "Update the email address for user '123' to '[email protected]'"
  • "Find all orders placed by user '123'"
  • "List all users who are over 21 years old"

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later