mcp-streaming-msk-bedrock
Integrates with Amazon MSK and Bedrock Agents to enable real-time streaming of log events and AI-driven analysis.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-streaming-msk-bedrockanalyze recent log stream for error spikes and suggest remediation"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Streaming Demo — Amazon MSK + Bedrock Agents
A working demo of Streaming MCP (Model Context Protocol) on AWS — pushing real-time context to a Bedrock-powered AI agent using Amazon MSK, WebSockets, and IAM authorization.
Based on mcp-streaming-demo, adapted to use managed AWS services.
Architecture
log_simulator.py → Amazon MSK (app-logs) → streaming_mcp_server.py → bedrock_agent.py
↕ WebSocket ↕
subscribe / get_anomalies Bedrock Claude
(invoke_model)
Lambda (Action Group) ← Bedrock Agent (managed) → MSKRelated MCP server: CloudWatch Log Analyst MCP
Components
File | Description |
| Core server — MSK consumer (IAM auth) + WebSocket push |
| AI agent — subscribes to stream, invokes Bedrock for analysis |
| Produces realistic log events to MSK |
| Patches for local dev without IAM auth |
| Bedrock Agent Action Group Lambda |
| OpenAPI schema for action group |
| CloudFormation — MSK Serverless + Bedrock Agent + Lambda |
| Local Kafka for development |
Prerequisites
Python 3.9+
AWS account with Bedrock model access (Claude 3 Sonnet)
AWS CLI configured with appropriate credentials
Docker (for local development)
Quick Start (Local Dev)
# 1. Start local Kafka
docker compose up -d
# 2. Install dependencies
pip install -r requirements.txt
# 3. Start server (local mode)
MSK_BOOTSTRAP=localhost:9092 python src/streaming_mcp_server.py
# 4. Start log simulator (separate terminal)
MSK_BOOTSTRAP=localhost:9092 python src/log_simulator.py
# 5. Start Bedrock agent (separate terminal)
python src/bedrock_agent.pyDeploy to AWS
# 1. Deploy infrastructure
aws cloudformation deploy \
--template-file infra/template.yaml \
--stack-name mcp-streaming-demo \
--parameter-overrides VpcId=vpc-xxx SubnetIds=subnet-aaa,subnet-bbb \
--capabilities CAPABILITY_NAMED_IAM
# 2. Get MSK bootstrap servers
aws kafka get-bootstrap-brokers --cluster-arn <ClusterArn from outputs>
# 3. Store bootstrap in SSM (used by Lambda)
aws ssm put-parameter --name /mcp-demo/msk-bootstrap --value "<bootstrap-servers>" --type String
# 4. Run server and simulator with MSK endpoint
export MSK_BOOTSTRAP="<bootstrap-servers>"
python src/streaming_mcp_server.py
python src/log_simulator.py
python src/bedrock_agent.pyKey Differences from Original
Original | This Version |
Local Kafka (Docker) | Amazon MSK Serverless |
Custom Python agent | Bedrock Agent + direct |
No auth | IAM OAUTHBEARER (MSK) + IAM roles (Bedrock) |
Manual remediation mapping | Claude-powered root cause analysis |
docker-compose only | CloudFormation IaC |
What You'll See
Normal log traffic flowing through the agent in real-time
Every ~30 seconds, an error spike hits
The agent detects the spike (>30% error rate in sliding window)
Bedrock Claude analyzes the errors and provides root cause + remediation
Teardown
# Local
docker compose down -v
# AWS
aws cloudformation delete-stack --stack-name mcp-streaming-demoThis server cannot be deployed
Maintenance
Related MCP Connectors
LLM Observability & Orchestration Agent
LLM Orchestration Observability Agent
LLM Observability & Orchestration Agent (Langchain)
LLM Orchestration Agent (Langchain Anthropic)
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage and monitor Apache Kafka clusters through natural language, providing real-time operations, health monitoring, consumer lag analysis, and temporal trend detection for intelligent cluster management.-
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to autonomously query AWS CloudWatch Logs and perform structured root-cause analysis via natural language prompts, using MCP tools for log group listing and Insights queries.MIT
- FlicenseNot gradedqualityDmaintenanceAn intelligent AWS monitoring and incident response solution using Anthropic's Model Context Protocol (MCP). Enables users to monitor AWS resources, analyze CloudWatch logs and metrics, and automatically create Jira tickets with remediation steps.3-
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives AI agents real-time observability into Apache Kafka clusters, enabling natural language queries for broker health, consumer lag, and diagnostics.MIT