langgraph-mcp-aws-dynamodb-agent
MCP server for AWS DynamoDB CRM data, enabling LangGraph agents to discover and call tools to retrieve customer accounts and support tickets via the Model Context Protocol.
README
LangGraph MCP AWS DynamoDB CRM Agent
Galaxy Telecom ā Standardised AI Tool Integration via Model Context Protocol
A production-grade AI agent demonstrating MCP (Model Context Protocol) integration with AWS DynamoDB ā connecting a LangGraph agent to live CRM data via a standardised tool protocol rather than bespoke custom integrations.
š Portfolio Document (PDF) ā full write-up with architecture, AWS DynamoDB setup, and sample interactions
Overview
Traditional AI agents that need CRM data require hardcoded integrations ā custom code for every external system, tightly coupled to the agent logic. This project demonstrates a better approach: the agent connects to a Python MCP server at runtime, discovers available tools dynamically, and calls them to retrieve live customer account and ticket data from AWS DynamoDB ā with zero hardcoded integration logic in the agent.
What is MCP?
MCP (Model Context Protocol) is an open standard introduced by Anthropic that defines how AI agents connect to external tools and data sources. It is to AI agents what REST APIs are to web services ā a universal contract enabling interoperability without bespoke adapters for every integration.
The key capability is runtime tool discovery. The agent does not know which tools exist at startup. It connects to the MCP server and asks "what can you do?" The server responds with tool names, descriptions, and input schemas. The agent then decides which tools to call based on the customer query.
Architecture
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 Tool Definition
Tools are registered on the MCP server using the @server.tool() decorator.
The agent has no knowledge of these functions ā it receives their definitions
dynamically via the protocol at runtime.
@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.
"""
...
Replacing DynamoDB with Salesforce or Dynamics requires only a new MCP server implementation. The agent code remains completely unchanged ā demonstrating the portability benefit of the protocol.
AWS DynamoDB Tables
GalaxyTelecom_CustomerAccounts
- Partition key:
customer_id - Stores: name, email, plan, monthly charge, account status, balance due, member since
GalaxyTelecom_SupportTickets
- Partition key:
customer_id, Sort key:ticket_id - Stores: issue type, description, status, date raised, assigned team, priority
- Compound key enables fetching all tickets for a customer in one query
Sample Interactions
Overdue account with open tickets (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)...
Active account, existing technical ticket (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...
Invalid customer ID ā graceful error handling
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...
Tech Stack
| Component | Technology |
|---|---|
| Agent orchestration | LangGraph (ReAct pattern) |
| LLM framework | LangChain |
| LLM provider | Anthropic Claude Haiku API |
| MCP protocol | Model Context Protocol (FastMCP) |
| MCP adapter | langchain-mcp-adapters |
| CRM data store | AWS DynamoDB (eu-west-1) |
| AWS SDK | boto3 |
| Language | Python 3.11+ |
Project Structure
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
Setup and Installation
Prerequisites
- Python 3.11+
- Anthropic API key
- AWS account with CLI configured (
aws configure) - IAM user with DynamoDB read/write permissions
Installation
# 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
Environment Variables
# 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
Seed DynamoDB Tables
Run once before starting the agent:
python dynamo/seed_data.py
This creates both DynamoDB tables in eu-west-1 and seeds them with mock Galaxy Telecom customer records and support tickets.
Run
python main.py
Enter a customer ID (C001, C002, C003, C004) and a support message. The agent will discover MCP tools, query DynamoDB, and return a personalised response grounded in live CRM data.
Key Design Decisions
Runtime tool discovery via MCP
The agent calls await client.get_tools() at runtime ā it does not know
which tools exist until it asks the MCP server. This is the core protocol
benefit: the agent is decoupled from the implementation.
Graceful error handling Invalid customer IDs return a structured error JSON from the MCP server. The agent interprets this naturally and responds helpfully without exposing technical details to the customer.
MCP portability
Replacing DynamoDB with Salesforce, Dynamics, or any other CRM requires
only a new MCP server implementation. The LangGraph agent code in
crm_agent.py remains completely unchanged ā the agent is decoupled
from the data source by the protocol layer.
AWS DynamoDB data model CustomerAccounts uses a single partition key (customer_id). SupportTickets uses a compound key (customer_id + ticket_id) ā enabling a single query to return all tickets for a customer, mirroring real CRM data access patterns.
Skills Demonstrated
- Model Context Protocol (MCP) ā standardised AI tool integration
- Runtime tool discovery ā agent discovers tools dynamically, no hardcoding
- LangGraph agent orchestration ā ReAct pattern with external tool calling
- AWS DynamoDB ā NoSQL CRM data store with partition and sort keys
- boto3 ā AWS SDK for Python
- FastMCP ā Python MCP server framework
- Graceful error handling ā structured MCP error responses
- Externalised configuration ā model and region via environment variables
Author
Gayatri Anne AI & Cloud Architect | 18+ Years Enterprise IT
I build AI-powered automation systems that eliminate manual work from business processes, combining agentic workflows, large language models and cloud integration to deliver production-ready solutions.
Certifications: Azure Solutions Architect Expert | Azure AI Engineer Associate | Python PCAP | TOGAF Foundation
GitHub: gayatrianne
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.