Skip to main content
Glama
DynamoDB Read-Only MCP

DynamoDB Read-Only MCP

by jjikky

DynamoDB 読み取り専用 MCP

npmバージョン 鍛冶屋のバッジ

モデルコンテキストプロトコル(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 クエリを書くためのヘルププロンプト

Related MCP server: Azure Cosmos DB MCP Server

インストールと実行

以下のRun with NPXメソッドを使用すると、インストールせずに実行できます。

Smithery経由でインストール

Smithery経由で Claude Desktop 用の DynamoDB 読み取り専用サーバーを自動的にインストールするには:

npx -y @smithery/cli install @jjikky/dynamo-readonly-mcp --client claude

インストール

  1. リポジトリをクローンします。

    git clone https://github.com/jjikky/dynamo-readonly-mcp.git
    cd dynamo-readonly-mcp
  2. 必要なパッケージをインストールします。

    npm install
  3. .envファイルを作成し、AWS 認証情報を設定します。

    AWS_ACCESS_KEY_ID=your_access_key
    AWS_SECRET_ACCESS_KEY=your_secret_key
    AWS_REGION=your_region

ビルドと実行

npm run build
npm start

Claudeデスクトップに接続

この MCP サーバーを Claude Desktop で使用するには、Claude Desktop 構成ファイルを変更する必要があります。

  1. Claude Desktop 構成ファイルを開きます。

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

    • Windows: %APPDATA%\Claude\claude_desktop_config.json

  2. 次のようにサーバー構成を追加します。

    {
      "mcpServers": {
        "dynamodb-readonly": {
          "command": "node",
          "args": ["/absolute-path/dynamo-readonly-mcp/dist/index.js"],
          "env": {
            "AWS_ACCESS_KEY_ID": "your_access_key",
            "AWS_SECRET_ACCESS_KEY": "your_secret_key",
            "AWS_REGION": "your_region"
          }
        }
      }
    }
  3. Claude Desktop を再起動します。

NPXで実行

グローバルインストールなしでnpxを使用してこのサーバーを実行することもできます。

{
  "mcpServers": {
    "dynamodb-readonly": {
      "command": "npx",
      "args": ["-y", "dynamo-readonly-mcp"],
      "env": {
        "AWS_ACCESS_KEY_ID": "your_access_key",
        "AWS_SECRET_ACCESS_KEY": "your_secret_key",
        "AWS_REGION": "your_region"
      }
    }
  }
}

使用例

クロードに次のような質問をすることができます:

  1. 「DynamoDB にはどのようなテーブルがあるのか教えていただけますか?」

  2. 「Usersテーブルの構造を説明する」

  3. 「「Users」テーブルで、グループIDが「0lxp4paxk7」であるユーザーの数を見つけます」


建築

この MCP サーバーは次の階層構造で構成されています。

  1. クライアントインターフェース(Claude Desktop) - ユーザーとLLM間のインタラクション

  2. MCPプロトコル層- 標準化されたメッセージ交換方法を提供する

  3. DynamoDB サーバー- DynamoDB と対話する関数を実装します

  4. AWS SDK - AWS DynamoDB サービスと通信します

主要な操作メカニズム

1. 初期化と接続

サーバーが起動すると、次のプロセスが実行されます。

async function main() {
  const transport = new StdioServerTransport();
  await server.connect(transport);
  console.error('DynamoDB read-only MCP server is running...');
}
  • StdioServerTransport標準入出力を介して通信チャネルを設定します。

  • server.connect(transport) MCP プロトコルを介して Claude Desktop に接続します。

  • 接続中に、サーバーはサポートされているツール、リソース、およびプロンプトに関する情報をクライアントに送信します。

2. ツール要求処理

ユーザーが Claude に「DynamoDB テーブルのリストを表示してください」のような質問をした場合:

  1. クロードはこのリクエストを分析し、 list-tablesツールを呼び出します。

  2. この要求は、MCP プロトコルを通じてサーバーに送信されます。

  3. サーバーは対応するツール ハンドラーを実行します。

server.tool('list-tables', 'Gets a list of all DynamoDB tables', {}, async () => {
  try {
    const tables = await listTables();
    return {
      content: [{ type: 'text', text: JSON.stringify(tables, null, 2) }],
    };
  } catch (error) {
    return { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] };
  }
});
  1. 結果は MCP プロトコルを通じて Claude に返されます。

  2. クロードはこの結果を自然言語に変換し、ユーザーに提示します。

3. 特定のパラメータ処理

ユーザーが「Users テーブルの構造を教えてください」と要求した場合:

  1. Claude は、このリクエストではdescribe-tableツールを使用する必要があると判断しました。

  2. Claude はパラメータを{ tableName: "Users" }として設定します。

  3. この情報は MCP サーバーに送信されます。

server.tool(
  'describe-table',
  'Gets detailed information about a DynamoDB table',
  {
    tableName: z.string().describe('Name of the table to get detailed information for'),
  },
  async ({ tableName }) => {
    // Query table information using the tableName parameter
    const tableInfo = await describeTable(tableName);
    // Return results
  }
);

ここで、 z.string()は Zod ライブラリを使用してパラメータを検証します。

4. リソースの取り扱い

リソースは、読み取り専用データを提供するもう 1 つの MCP 機能です。

server.resource('dynamodb-tables-info', 'DynamoDB table information', async () => {
  // Create and return resource data
  const tables = await listTables();
  const tablesInfo = await Promise.all(/* Query table information */);

  return {
    contents: [
      {
        uri: 'dynamodb://tables-info',
        text: JSON.stringify(tablesInfo, null, 2),
        mimeType: 'application/json',
      },
    ],
  };
});

クロードはリソースにアクセスし、それをコンテキスト情報として使用します。

5. 迅速な対応

MCP サーバーは、特定のタスクのプロンプト テンプレートを提供できます。

server.prompt(
  'dynamodb-query-help',
  'A prompt that helps write DynamoDB queries',
  {
    tableName: z.string().describe('Table name to query'),
    queryType: z.enum(['basic', 'advanced']).default('basic'),
  },
  async ({ tableName, queryType }) => {
    // Generate prompt content
    return {
      messages: [
        {
          role: 'user',
          content: { type: 'text', text: helpContent },
        },
      ],
    };
  }
);

このプロンプトは、ユーザーが「Users テーブルのクエリの記述方法を教えてください」と要求したときに使用されます。

データフローの概要

  1. ユーザーは自然言語でクロードにリクエストを送信します

  2. クロードはリクエストを分析し、適切なMCPツール/リソース/プロンプトを選択します。

  3. MCPクライアントは標準化された形式でサーバーにリクエストを送信します。

  4. サーバーはリクエストを処理し、AWS DynamoDB API を呼び出します。

  5. DynamoDBは結果を返します

  6. サーバーは結果をMCP形式に変換し、クライアントに送信します。

  7. クロードは結果を自然言語で処理し、ユーザーに提示します。

ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細については LICENSE ファイルを参照してください。

Available Tools

7 tools
count-itemsB

Count items in a DynamoDB table

Inputs: tableName (required), expressionAttributeValues, filterExpression.

describe-tableC

Get detailed information about a DynamoDB table

Inputs: tableName (required).

get-itemC

Get an item from a DynamoDB table based on a specific key

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

list-tablesB

Get a list of all DynamoDB tables

Inputs: no named parameters.

paginate-query-tableC

Paginate query results

Inputs: expressionAttributeValues (required), keyConditionExpression (required), tableName (required), projectionExpression.

query-tableC

Query items from a DynamoDB table based on conditions

Inputs: expressionAttributeValues (required), keyConditionExpression (required), tableName (required), filterExpression, +3 more.

scan-tableC

Scan items from a DynamoDB table

Inputs: tableName (required), expressionAttributeValues, filterExpression, limit, +1 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 7 tools

    Disambiguation5/5

    Every tool has a clearly distinct purpose with no ambiguity: count-items focuses on counting, describe-table on metadata, get-item on single retrieval, list-tables on table enumeration, paginate-query-table on pagination, query-table on conditional queries, and scan-table on full scans. The descriptions clearly differentiate each tool's function, making misselection unlikely.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with hyphens (e.g., count-items, describe-table, get-item). There are no deviations in style or convention, making the naming predictable and easy to understand across the entire set.

    Tool Count5/5

    With 7 tools, the count is well-scoped for a read-only DynamoDB server, covering essential operations like listing, describing, retrieving, querying, scanning, and counting. Each tool earns its place without redundancy, fitting within the typical 3-15 range for focused server purposes.

    Completeness4/5

    The tool set provides comprehensive read-only coverage for DynamoDB, including table listing, metadata retrieval, item access, queries, scans, and pagination. A minor gap exists in not supporting batch operations like batch-get-item, but agents can work around this with existing tools, and the core read workflows are well-covered.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      A server that enables interaction with PostgreSQL, MySQL, MariaDB, or SQLite databases through Claude Desktop using natural language queries.
      1
      -
    • A
      license
      B
      quality
      D
      maintenance
      A 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.
      4
      3
      MIT
    • A
      license
      C
      quality
      C
      maintenance
      A server that enables LLMs (like Claude and VSCode Copilot) to interact with Azure Cosmos DB data through natural language queries, acting as a translator between AI assistants and your database.
      3
      21 npm
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      This server provides database access capabilities to Claude, supporting SQLite, SQL Server, PostgreSQL, and MySQL databases.
      MIT