DynamoDB MCP Server

DynamoDB MCP Server

通过模型上下文协议实现 DynamoDB 资源的管理,支持表和索引的创建、容量管理和数据操作,但不包含删除功能,以防止意外数据丢失。

数据库交互
数据与应用分析
访问服务器

Tools

create_table

Creates a new DynamoDB table with specified configuration

update_capacity

Updates the provisioned capacity of a table

put_item

Inserts or replaces an item in a table

get_item

Retrieves an item from a table by its primary key

query_table

Queries a table using key conditions and optional filters

scan_table

Scans an entire table with optional filters

describe_table

Gets detailed information about a DynamoDB table

list_tables

Lists all DynamoDB tables in the account

create_gsi

Creates a global secondary index on a table

update_gsi

Updates the provisioned capacity of a global secondary index

create_lsi

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

update_item

Updates specific attributes of an item in a table

README

DynamoDB MCP 服务器

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

作者

Iman Kamyabi (ikmyb@icloud.com)

功能

表管理

  • 创建具有可自定义配置的新 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

工具

create_table

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

参数:

  • tableName:要创建的表的名称
  • partitionKey:分区键的名称
  • partitionKeyType:分区键的类型(S=字符串,N=数字,B=二进制)
  • sortKey:(可选)排序键的名称
  • sortKeyType:(可选)排序键的类型
  • readCapacity:预配置的读取容量单位
  • writeCapacity:预配置的写入容量单位

示例:

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

list_tables

列出帐户中的所有 DynamoDB 表。

参数:

  • limit:(可选)要返回的最大表数
  • exclusiveStartTableName:(可选)分页的起始表名

示例:

{
  "limit": 10
}

describe_table

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

参数:

  • tableName:要描述的表的名称

示例:

{
  "tableName": "Users"
}

create_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
}

update_gsi

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

参数:

  • tableName:表的名称
  • indexName:要更新的索引的名称
  • readCapacity:新的读取容量单位
  • writeCapacity:新的写入容量单位

示例:

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

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

update_capacity

更新表的预配置容量。

参数:

  • tableName:表的名称
  • readCapacity:新的读取容量单位
  • writeCapacity:新的写入容量单位

示例:

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

put_item

在表中插入或替换项目。

参数:

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

示例:

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

get_item

按主键从表中检索项目。

参数:

  • tableName:表的名称
  • key:要检索的项目的主键

示例:

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

update_item

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

参数:

  • tableName:表的名称
  • key:要更新的项目的主键
  • updateExpression:更新表达式
  • expressionAttributeNames:属性名称映射
  • expressionAttributeValues:更新表达式的值
  • conditionExpression:(可选)更新的条件
  • returnValues:(可选)要返回的值

示例:

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

query_table

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

参数:

  • tableName:表的名称
  • keyConditionExpression:键条件表达式
  • expressionAttributeValues:键条件表达式的值
  • expressionAttributeNames:(可选)属性名称映射
  • filterExpression:(可选)结果的过滤器表达式
  • limit:(可选)要返回的最大项目数

示例:

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

scan_table

扫描整个表,带有可选过滤器。

参数:

  • tableName:表的名称
  • filterExpression:(可选)过滤器表达式
  • expressionAttributeValues:(可选)过滤器表达式的值
  • expressionAttributeNames:(可选)属性名称映射
  • limit:(可选)要返回的最大项目数

示例:

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

示例问题

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

表管理

  • "创建一个名为 'Products' 的新 DynamoDB 表,其中包含分区键 'productId'(字符串)和排序键 'timestamp'(数字)"
  • "列出我帐户中的所有 DynamoDB 表"
  • "Users 表的当前配置是什么?"
  • "在 Users 表的 email 字段上添加一个全局二级索引"

容量管理

  • "将 Users 表的容量更新为 20 个读取单位和 15 个写入单位"
  • "扩大 Users 表上 EmailIndex GSI 的容量"
  • "Orders 表的当前预配置容量是多少?"

数据操作

  • "插入一个新用户,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 文件。

推荐服务器

VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
AIO-MCP Server

AIO-MCP Server

🚀 集成了 AI 搜索、RAG 和多服务(GitLab/Jira/Confluence/YouTube)的一体化 MCP 服务器,旨在增强 AI 驱动的开发工作流程。来自 Folk。

精选
本地
Knowledge Graph Memory Server

Knowledge Graph Memory Server

为 Claude 实现持久性记忆,使用本地知识图谱,允许 AI 记住用户的信息,并可在自定义位置存储,跨对话保持记忆。

精选
本地
Hyperbrowser

Hyperbrowser

欢迎来到 Hyperbrowser,人工智能的互联网。Hyperbrowser 是下一代平台,旨在增强人工智能代理的能力,并实现轻松、可扩展的浏览器自动化。它专为人工智能开发者打造,消除了本地基础设施和性能瓶颈带来的麻烦,让您能够:

精选
本地
any-chat-completions-mcp

any-chat-completions-mcp

将 Claude 与任何 OpenAI SDK 兼容的聊天完成 API 集成 - OpenAI、Perplexity、Groq、xAI、PyroPrompts 等。

精选
Exa MCP Server

Exa MCP Server

一个模型上下文协议服务器,它使像 Claude 这样的人工智能助手能够以安全和受控的方式,使用 Exa AI 搜索 API 执行实时网络搜索。

精选
BigQuery MCP Server

BigQuery MCP Server

这是一个服务器,可以让你的大型语言模型(LLM,比如Claude)直接与你的BigQuery数据对话!可以把它想象成一个友好的翻译器,它位于你的AI助手和数据库之间,确保它们可以安全高效地进行交流。

精选
mcp-perplexity

mcp-perplexity

Perplexity API 的 MCP 服务器。

精选