DynamoDB 只读 MCP
一个利用模型上下文协议 (MCP) 查询 AWS DynamoDB 数据库的服务器。该服务器允许像 Claude 这样的法学硕士 (LLM) 通过自然语言请求查询 DynamoDB 数据。
特征
该 MCP 服务器提供以下功能:
- 表管理工具:
list-tables
:查看所有 DynamoDB 表的列表describe-table
:查看特定表的详细信息
- 数据查询工具:
scan-table
:扫描表的全部或部分数据query-table
:在表中搜索符合特定条件的数据paginate-query-table
:检索符合特定条件的跨页数据get-item
:检索具有特定键的项目count-items
:计算表中的项目数
- 资源:
dynamodb-tables-info
:为所有表提供元数据的资源dynamodb-table-schema
:提供特定表的架构信息的资源
- 提示:
dynamodb-query-help
:编写 DynamoDB 查询的帮助提示
安装和执行
您可以使用下面的使用Run with NPX
方法无需安装即可运行它。
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 DynamoDB 只读服务器:
安装
- 克隆存储库:
- 安装所需的软件包:
- 创建一个
.env
文件并设置您的 AWS 凭证:
构建并运行
连接到 Claude 桌面
要将此 MCP 服务器与 Claude Desktop 一起使用,您需要修改 Claude Desktop 配置文件。
- 打开Claude桌面配置文件:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
- 添加服务器配置如下:
- 重新启动 Claude Desktop。
使用 NPX 运行
您还可以使用npx
运行此服务器,而无需全局安装:
使用示例
您可以向 Claude 询问以下问题:
- “您能告诉我 DynamoDB 中有哪些表吗?”
- “解释用户表的结构”
- “在‘用户’表中查找 groupId 为‘0lxp4paxk7’ 的用户数量”
建筑学
该MCP服务器由以下分层结构组成:
- 客户端界面(Claude Desktop) - 用户与 LLM 之间的交互
- MCP协议层-提供标准化的消息交换方法
- DynamoDB 服务器- 实现与 DynamoDB 交互的功能
- AWS SDK - 与 AWS DynamoDB 服务通信
关键运行机制
1.初始化与连接
当服务器启动时,会发生以下过程:
StdioServerTransport
通过标准输入/输出建立通信通道。server.connect(transport)
通过 MCP 协议连接到 Claude Desktop。- 在连接期间,服务器会向客户端发送有关支持的工具、资源和提示的信息。
2. 工具请求处理
当用户向 Claude 询问“显示 DynamoDB 表的列表”时:
- 克劳德分析了这个请求并调用了
list-tables
工具。 - 该请求通过MCP协议发送到服务器。
- 服务器执行相应的工具处理程序:
- 将结果通过MCP协议返回给Claude。
- Claude 将此结果处理成自然语言并呈现给用户。
3. 具体参数处理
当用户请求“告诉我用户表的结构”时:
- Claude 确定此请求应该使用
describe-table
工具。 - Claude 将参数配置为
{ tableName: "Users" }
。 - 此信息被发送到 MCP 服务器:
这里, z.string()
使用 Zod 库来验证参数。
4.资源处理
资源是另一个提供只读数据的 MCP 功能:
克劳德访问资源并将其用作上下文信息。
5. 及时处理
MCP服务器可以提供针对特定任务的提示模板:
当用户请求“向我展示如何为用户表编写查询”时使用此提示。
数据流摘要
- 用户使用自然语言向 Claude 发出请求
- Claude 分析请求并选择适当的 MCP 工具/资源/提示
- MCP 客户端以标准格式向服务器发送请求
- 服务器处理请求并调用 AWS DynamoDB API
- DynamoDB 返回结果
- 服务器将结果转换为MCP格式并发送给客户端
- Claude 将结果处理成自然语言并呈现给用户
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
该服务器使 Claude 等 LLM 能够通过自然语言请求查询 AWS DynamoDB 数据库,支持表管理、数据查询和模式分析。
Related MCP Servers
- -securityFlicense-qualityEnables LLMs to perform semantic search and document management using ChromaDB, supporting natural language queries with intuitive similarity metrics for retrieval augmented generation applications.Last updated -Python
- AsecurityAlicenseAqualityA Model Context Protocol server implementation that enables Claude to perform AWS operations on S3 and DynamoDB services through natural language commands.Last updated -23125PythonMIT License
- -securityAlicense-qualityA server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.Last updated -10TypeScriptMIT License
- AsecurityAlicenseAqualityA server that enables LLMs like Claude to interact with Azure Cosmos DB databases through natural language queries, acting as a translator between AI assistants and database systems.Last updated -42JavaScriptMIT License