Skip to main content
Glama
gayatrianne

langgraph-mcp-aws-dynamodb-agent

by gayatrianne

LangGraph MCP AWS DynamoDB CRM エージェント

Galaxy Telecom — Model Context Protocol による標準化された AI ツール統合

MCP(Model Context Protocol)統合を AWS DynamoDB と組み合わせた本番グレードの AI エージェント — LangGraph エージェントを、独自のカスタム統合ではなく標準化されたツールプロトコルを介してライブ CRM データに接続します。

📄 ポートフォリオ文書(PDF) — アーキテクチャ、AWS DynamoDB のセットアップ、サンプル対話を含む完全な解説


概要

CRM データを必要とする従来の AI エージェントは、ハードコードされた統合を必要とします — 外部システムごとにカスタムコードが必要で、エージェントロジックに密結合しています。このプロジェクトは、より優れたアプローチを実証します:エージェントは実行時に Python MCP サーバーに接続し、利用可能なツールを動的に発見し、それらを呼び出して AWS DynamoDB からライブの顧客アカウントおよびチケットデータを取得します — エージェント内にハードコードされた統合ロジックは一切ありません。


Related MCP server: Agorus MCP Server

MCP とは

MCP(Model Context Protocol)は、Anthropic が導入したオープン標準であり、AI エージェントが外部ツールやデータソースに接続する方法を定義します。AI エージェントにとっての REST API に相当するもので、あらゆる統合に専用アダプターを必要とせず、相互運用性を可能にするユニバーサルコントラクトです。

主要な機能はランタイムツールディスカバリです。エージェントは起動時にどのツールが存在するかを知りません。MCP サーバーに接続して「何ができますか?」と尋ねます。サーバーはツール名、説明、入力スキーマで応答します。その後、エージェントは顧客のクエリに基づいて呼び出すツールを決定します。


アーキテクチャ

Customer CLI Input
        │
        ▼
┌─────────────────────┐
│   LangGraph Agent   │  ← ReAct pattern, Claude Haiku (Anthropic API)
│   (crm_agent.py)    │
└──────────┬──────────┘
           │ MCP protocol — stdio transport
           │ Runtime tool discovery via get_tools()
           ▼
┌─────────────────────┐
│    MCP Server       │  ← FastMCP, Python
│    (server.py)      │
│                     │
│  get_customer_      │  ← queries CustomerAccounts table
│  account()          │
│                     │
│  get_open_          │  ← queries SupportTickets table
│  tickets()          │
└──────────┬──────────┘
           │ boto3
           ▼
┌─────────────────────┐
│   AWS DynamoDB      │  ← eu-west-1
│                     │
│ GalaxyTelecom_      │
│ CustomerAccounts    │
│                     │
│ GalaxyTelecom_      │
│ SupportTickets      │
└─────────────────────┘

MCP ツール定義

ツールは @server.tool() デコレータを使用して MCP サーバーに登録されます。エージェントはこれらの関数について知識を持ちません — 実行時にプロトコルを介して定義を動的に受け取ります。

@server.tool()
def get_customer_account(customer_id: str) -> str:
    """
    Retrieve a Galaxy Telecom customer account from DynamoDB.
    Returns account details including plan, status, and balance due.
    """
    ...

@server.tool()
def get_open_tickets(customer_id: str) -> str:
    """
    Retrieve all open support tickets for a Galaxy Telecom customer.
    Returns a list of tickets with issue type, description, status and priority.
    """
    ...

DynamoDB を Salesforce や Dynamics に置き換えるには、新しい MCP サーバーの実装のみが必要です。エージェントコードは完全に変更されません — プロトコルの移植性の利点を実証しています。


AWS DynamoDB テーブル

GalaxyTelecom_CustomerAccounts

  • パーティションキー: customer_id

  • 保存データ: 名前、メール、プラン、月額料金、アカウントステータス、未払い残高、会員開始日

GalaxyTelecom_SupportTickets

  • パーティションキー: customer_id、ソートキー: ticket_id

  • 保存データ: 問題の種類、説明、ステータス、起票日、担当チーム、優先度

  • 複合キーにより、1 回のクエリで顧客の全チケットを取得可能


サンプル対話

未払いアカウント、未解決チケットあり(C001)

Customer ID : C001
Message     : Hi, I wanted to check on my account and see if there are any issues.

[MCP] Tools discovered: ['get_customer_account', 'get_open_tickets']

Response: Hi John, I can see your account is overdue with a balance of £47.50.
You have 2 open tickets — a billing query (T001, medium priority) and
broadband dropouts (T002, high priority, in progress with Technical Support)...

アクティブなアカウント、既存の技術チケットあり(C002)

Customer ID : C002
Message     : I have been having some signal issues at home, can you help?

Response: Hello Sarah! I can see you're on our EliteMax plan with no balance due.
You've already raised ticket T003 regarding weak 5G signal — an engineer
visit has been requested, marked medium priority...

無効な顧客 ID — グレースフルなエラーハンドリング

Customer ID : 99
Message     : I have been having some signal issues at home, can you help?

Response: I'm unable to locate a Galaxy Telecom account associated with
Customer ID 99. The ID may have been entered incorrectly...

技術スタック

コンポーネント

テクノロジー

エージェントオーケストレーション

LangGraph(ReAct パターン)

LLM フレームワーク

LangChain

LLM プロバイダー

Anthropic Claude Haiku API

MCP プロトコル

Model Context Protocol(FastMCP)

MCP アダプター

langchain-mcp-adapters

CRM データストア

AWS DynamoDB(eu-west-1)

AWS SDK

boto3

言語

Python 3.11+


プロジェクト構成

langgraph-mcp-aws-dynamodb-agent/
├── agent/
│   ├── __init__.py
│   └── crm_agent.py        # LangGraph ReAct agent — connects to MCP server
├── dynamo/
│   ├── __init__.py
│   └── seed_data.py        # Creates DynamoDB tables and seeds mock CRM data
├── mcp_server/
│   ├── __init__.py
│   └── server.py           # MCP server — exposes CRM tools backed by DynamoDB
├── main.py                 # Interactive CLI entry point
├── requirements.txt
├── .env.example            # Environment variable template
└── .gitignore

セットアップとインストール

前提条件

  • Python 3.11+

  • Anthropic API キー

  • CLI が設定された AWS アカウント(aws configure

  • DynamoDB の読み取り/書き込み権限を持つ IAM ユーザー

インストール

# Clone the repository
git clone https://github.com/gayatrianne/langgraph-mcp-aws-dynamodb-agent.git
cd langgraph-mcp-aws-dynamodb-agent

# Create and activate virtual environment
python -m venv venv
venv\Scripts\activate        # Windows
source venv/bin/activate     # macOS/Linux

# Install dependencies
pip install -r requirements.txt

# Configure environment variables
cp .env.example .env
# Edit .env and add your Anthropic API key

環境変数

# Anthropic
ANTHROPIC_API_KEY=your_key_here

# AWS — credentials come from AWS CLI profile (aws configure)
AWS_REGION=eu-west-1

# DynamoDB table names
CUSTOMER_TABLE=GalaxyTelecom_CustomerAccounts
TICKETS_TABLE=GalaxyTelecom_SupportTickets

# LLM Configuration
CLAUDE_MODEL=claude-haiku-4-5-20251001
CLAUDE_TEMPERATURE=0.3

DynamoDB テーブルのシード

エージェントを起動する前に一度実行します:

python dynamo/seed_data.py

これにより、eu-west-1 に両方の DynamoDB テーブルが作成され、Galaxy Telecom のモック顧客レコードとサポートチケットが投入されます。

実行

python main.py

顧客 ID(C001、C002、C003、C004)とサポートメッセージを入力します。エージェントは MCP ツールを発見し、DynamoDB にクエリを実行し、ライブ CRM データに基づいたパーソナライズされた応答を返します。


主要な設計上の決定

MCP によるランタイムツールディスカバリ エージェントは実行時に await client.get_tools() を呼び出します — MCP サーバーに問い合わせるまで、どのツールが存在するかを知りません。これがプロトコルの中核的な利点です:エージェントは実装から切り離されています。

グレースフルなエラーハンドリング 無効な顧客 ID は、MCP サーバーから構造化されたエラー JSON を返します。エージェントはこれを自然に解釈し、顧客に技術的な詳細を公開することなく、役立つ応答を返します。

MCP の移植性 DynamoDB を Salesforce、Dynamics、またはその他の CRM に置き換えるには、新しい MCP サーバーの実装のみが必要です。crm_agent.py 内の LangGraph エージェントコードは完全に変更されません — エージェントはプロトコル層によってデータソースから切り離されています。

AWS DynamoDB データモデル CustomerAccounts は単一のパーティションキー(customer_id)を使用します。SupportTickets は複合キー(customer_id + ticket_id)を使用します — これにより、1 回のクエリで顧客の全チケットを返すことができ、実際の CRM データアクセスパターンを反映しています。


実証されたスキル

  • Model Context Protocol(MCP)— 標準化された AI ツール統合

  • ランタイムツールディスカバリ — エージェントがツールを動的に発見、ハードコーディングなし

  • LangGraph エージェントオーケストレーション — 外部ツール呼び出しを伴う ReAct パターン

  • AWS DynamoDB — パーティションキーとソートキーを備えた NoSQL CRM データストア

  • boto3 — Python 用 AWS SDK

  • FastMCP — Python MCP サーバーフレームワーク

  • グレースフルなエラーハンドリング — 構造化された MCP エラー応答

  • 外部化された設定 — モデルとリージョンを環境変数で指定


著者

Gayatri Anne AI & クラウドアーキテクト | エンタープライズ IT 18 年以上

ビジネスプロセスから手作業を排除する AI 搭載自動化システムを構築。エージェントワークフロー、大規模言語モデル、クラウド統合を組み合わせ、本番対応ソリューションを提供します。

認定資格: Azure Solutions Architect Expert | Azure AI Engineer Associate | Python PCAP | TOGAF Foundation

GitHub: gayatrianne

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • MCP server exposing the Backtest360 engine API as tools for AI agents.

  • Hosted Amazon Seller Central and Amazon Ads MCP server for Claude, ChatGPT, Cursor, and agents.

  • Hosted Amazon Seller and Vendor MCP server for Claude, ChatGPT, Cursor, Codex, Gemini, Copilot.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gayatrianne/langgraph-mcp-aws-dynamodb-agent'

If you have feedback or need assistance with the MCP directory API, please join our Discord server