Skip to main content
Glama
DynamoDB MCP Server

DynamoDB MCP Server

by imankamyabi

DynamoDB MCP 服务器

用于管理 Amazon DynamoDB 资源的模型上下文协议服务器。此服务器提供用于表管理、容量管理和数据操作的工具。

作者

伊曼·卡米亚比 ( ikmyb@icloud.com )

Related MCP server: mcp-server-duckdb

特征

表管理

  • 使用可自定义的配置创建新的 DynamoDB 表

  • 列出现有表

  • 获取表的详细信息

  • 配置表设置

指数管理

  • 创建和管理全局二级索引 (GSI)

  • 更新 GSI 容量

  • 创建本地二级索引 (LSI)

容量管理

  • 更新预配置的读/写容量单位

  • 管理表吞吐量设置

数据操作

  • 插入或替换表中的项目

  • 按主键检索项目

  • 更新特定项目属性

  • 带条件的查询表

  • 使用过滤器扫描表格

注意:不支持删除操作,以防止意外数据丢失。

设置

  1. 安装依赖项:

npm install
  1. 将 AWS 凭证配置为环境变量:

export AWS_ACCESS_KEY_ID="your_access_key"
export AWS_SECRET_ACCESS_KEY="your_secret_key"
export AWS_REGION="your_region"
  1. 构建服务器:

npm run build
  1. 启动服务器:

npm start

工具

创建表

使用指定的配置创建一个新的 DynamoDB 表。

参数:

  • tableName :要创建的表的名称

  • partitionKey :分区键的名称

  • partitionKeyType :分区键的类型(S=字符串,N=数字,B=二进制)

  • sortKey :(可选)排序键的名称

  • sortKeyType :(可选)排序键的类型

  • readCapacity :预配置的读取容量单位

  • writeCapacity :预配置的写入容量单位

例子:

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

列表表

列出账户中的所有 DynamoDB 表。

参数:

  • limit :(可选)返回的最大表数

  • exclusiveStartTableName :(可选)分页起始表的名称

例子:

{
  "limit": 10
}

描述表

获取有关 DynamoDB 表的详细信息。

参数:

  • tableName :要描述的表的名称

例子:

{
  "tableName": "Users"
}

创建_gsi

在表上创建全局二级索引。

参数:

  • tableName :表的名称

  • indexName : 新索引的名称

  • partitionKey :索引的分区键

  • partitionKeyType :分区键的类型

  • sortKey :(可选)索引的排序键

  • sortKeyType :(可选)排序键的类型

  • projectionType :投影类型(ALL、KEYS_ONLY、INCLUDE)

  • nonKeyAttributes :(可选)项目的非关键属性

  • readCapacity :预配置的读取容量单位

  • writeCapacity :预配置的写入容量单位

例子:

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

更新_gsi

更新全局二级索引的预配置容量。

参数:

  • tableName :表的名称

  • indexName :要更新的索引的名称

  • readCapacity :新的读取容量单位

  • writeCapacity :新的写入容量单位

例子:

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

创建lsi

在表上创建本地二级索引(必须在表创建期间完成)。

参数:

  • tableName :表的名称

  • indexName : 新索引的名称

  • partitionKey :表的分区键

  • partitionKeyType :分区键的类型

  • sortKey :索引的排序键

  • sortKeyType :排序键的类型

  • projectionType :投影类型(ALL、KEYS_ONLY、INCLUDE)

  • nonKeyAttributes :(可选)项目的非关键属性

  • readCapacity :(可选)预配置的读取容量单位

  • writeCapacity :(可选)预配置的写入容量单位

例子:

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

更新容量

更新表的预配置容量。

参数:

  • tableName :表的名称

  • readCapacity :新的读取容量单位

  • writeCapacity :新的写入容量单位

例子:

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

放置物品

在表中插入或替换项目。

参数:

  • tableName :表的名称

  • item :要放入表中的项目(作为 JSON 对象)

例子:

{
  "tableName": "Users",
  "item": {
    "userId": "123",
    "name": "John Doe",
    "email": "john@example.com"
  }
}

获取项目

通过主键从表中检索项目。

参数:

  • tableName :表的名称

  • key :要检索的项目的主键

例子:

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

更新项目

更新表中项目的特定属性。

参数:

  • tableName :表的名称

  • key :要更新的项目的主键

  • updateExpression :更新表达式

  • expressionAttributeNames :属性名称映射

  • expressionAttributeValues :更新表达式的值

  • conditionExpression :(可选)更新条件

  • returnValues :(可选)返回什么值

例子:

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

查询表

使用关键条件和可选过滤器查询表。

参数:

  • tableName :表的名称

  • keyConditionExpression :关键条件表达式

  • expressionAttributeValues :关键条件表达式的值

  • expressionAttributeNames :(可选)属性名称映射

  • filterExpression :(可选)结果的过滤表达式

  • limit :(可选)返回的最大项目数

例子:

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

扫描表

使用可选过滤器扫描整个表。

参数:

  • tableName :表的名称

  • filterExpression :(可选)过滤表达式

  • expressionAttributeValues :(可选)过滤表达式的值

  • expressionAttributeNames :(可选)属性名称映射

  • limit :(可选)返回的最大项目数

例子:

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

示例问题

以下是您在使用此 DynamoDB MCP 服务器时可以向 Claude 询问的一些示例问题:

表管理

  • “创建一个名为‘Products’的新 DynamoDB 表,其分区键为‘productId’(字符串),排序键为‘timestamp’(数字)”

  • “列出我的账户中的所有 DynamoDB 表”

  • “用户表的当前配置是什么?”

  • “在用户表的电子邮件字段上添加全局二级索引”

容量管理

  • “将用户表容量更新为 20 个读取单元和 15 个写入单元”

  • “扩大用户表上的 EmailIndex GSI 容量”

  • “订单表的当前配置容量是多少?”

数据操作

  • “插入一个新用户,ID 为‘123’,名称为‘John Doe’,电子邮件为‘ john@example.com ’”

  • “获取 ID 为‘123’的用户”

  • “将用户‘123’的电子邮件地址更新为‘ john.doe@example.com ’”

  • “查找用户‘123’下的所有订单”

  • “列出所有超过 21 岁的用户”

  • “查询 EmailIndex 来查找电子邮件为‘ john@example.com ’的用户”

配置

设置AWS凭证

  1. 从 AWS 管理控制台获取 AWS 访问密钥 ID、秘密访问密钥和区域。

  2. 如果使用临时凭证(例如 IAM 角色),还可以获取会话令牌。

  3. 确保这些凭证具有 DynamoDB 操作的适当权限。

与 Claude Desktop 一起使用

将其添加到您的claude_desktop_config.json中:

Docker(推荐)

{
  "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"  
      }
    }
  }
}

建筑

Docker:

docker build -t mcp/dynamodb-mcp-server -f Dockerfile .

发展

要在开发模式下运行并自动重新加载:

npm run dev

执照

此 MCP 服务器采用 MIT 许可证。这意味着您可以自由使用、修改和分发该软件,但须遵守 MIT 许可证的条款和条件。更多详情,请参阅项目仓库中的 LICENSE 文件。

Available Tools

12 tools
create_gsiC

Creates a global secondary index on a table

Inputs: indexName (required), partitionKey (required), partitionKeyType (required), projectionType (required), +6 more.

create_lsiC

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

Inputs: indexName (required), partitionKey (required), partitionKeyType (required), projectionType (required), +6 more.

create_tableC

Creates a new DynamoDB table with specified configuration

Inputs: partitionKey (required), partitionKeyType (required), readCapacity (required), tableName (required), +3 more.

describe_tableC

Gets detailed information about a DynamoDB table

Inputs: tableName (required).

get_itemC

Retrieves an item from a table by its primary key

Inputs: key (required), tableName (required).

list_tablesC

Lists all DynamoDB tables in the account

Inputs: exclusiveStartTableName, limit.

put_itemC

Inserts or replaces an item in a table

Inputs: item (required), tableName (required).

query_tableC

Queries a table using key conditions and optional filters

Inputs: expressionAttributeValues (required), keyConditionExpression (required), tableName (required), expressionAttributeNames, +2 more.

scan_tableC

Scans an entire table with optional filters

Inputs: tableName (required), expressionAttributeNames, expressionAttributeValues, filterExpression, +1 more.

update_capacityC

Updates the provisioned capacity of a table

Inputs: readCapacity (required), tableName (required), writeCapacity (required).

update_gsiC

Updates the provisioned capacity of a global secondary index

Inputs: indexName (required), readCapacity (required), tableName (required), writeCapacity (required).

update_itemC

Updates specific attributes of an item in a table

Inputs: expressionAttributeNames (required), expressionAttributeValues (required), key (required), tableName (required), +3 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 12 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose targeting specific DynamoDB operations with no overlap. For example, create_table vs. describe_table vs. update_item are all unambiguous in their functions, and even similar-sounding tools like query_table and scan_table are clearly differentiated in their descriptions.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern with snake_case throughout, such as create_table, describe_table, and update_item. The naming is predictable and readable, making it easy for agents to understand the action and target resource.

    Tool Count5/5

    With 12 tools, this server is well-scoped for DynamoDB operations, covering core CRUD, indexing, capacity management, and table lifecycle. Each tool earns its place without being overwhelming or insufficient for the domain.

    Completeness4/5

    The tool set provides strong coverage of DynamoDB's key operations, including table management, item CRUD, indexing, and capacity updates. A minor gap is the lack of tools for deleting tables or indexes, which could limit full lifecycle management, but core workflows are well-supported.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers