Content
# Strands MCP Agent
This is a Streamlit application for Strands Agents that integrates AWS Bedrock and the MCP (Model Context Protocol) server.
Reference: http://strandsagents.com
## Overview
This application allows interaction with various MCP servers through a web interface using the Claude model from AWS Bedrock. It can connect to any MCP server that supports the stdio protocol, providing access to specialized tools and data sources.
## Features
- 🤖 **Strands Agent Integration**: Leverages the Strands framework for building AI agents
- 🔌 **MCP Server Support**: Connects to any MCP server via the stdio protocol
- 🌐 **Streamlit Web Interface**: User-friendly web interface for interacting with the agent
- ⚡ **Real-Time Streaming**: Live streaming of agent responses along with visualization of tool execution
- 🛠️ **AWS Bedrock Integration**: Utilizes the Claude model from AWS Bedrock to generate intelligent responses
- 📊 **Langfuse Tracing**: Detailed tracing and observability features provided by Langfuse
## Prerequisites
- Python 3.10 or higher
- An AWS account with Bedrock access permissions
- Configured AWS credentials
- Access to the desired MCP server
## Installation
1. Clone the repository:
```bash
git clone https://github.com/yourusername/strands-mcp-agent.git
cd strands-mcp-agent
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
## Configuration
### AWS Credentials
For local development, set up your AWS credentials using one of the following methods:
1. AWS CLI configuration:
```bash
aws configure
```
2. Environment variables:
```bash
export AWS_ACCESS_KEY_ID="your-access-key-id"
export AWS_SECRET_ACCESS_KEY="your-secret-access-key"
export AWS_DEFAULT_REGION="us-west-2"
```
### Deploying to Streamlit Community Cloud
To deploy to Streamlit Community Cloud:
1. Go to the app settings in Streamlit Community Cloud
2. Navigate to the "Secrets" section
3. Add the following secrets:
```toml
[aws]
AWS_ACCESS_KEY_ID = "your-access-key-id"
AWS_SECRET_ACCESS_KEY = "your-secret-access-key"
AWS_DEFAULT_REGION = "us-west-2"
[langfuse]
LANGFUSE_PUBLIC_KEY = "your-langfuse-public-key"
LANGFUSE_SECRET_KEY = "your-langfuse-secret-key"
LANGFUSE_HOST = "https://us.cloud.langfuse.com"
```
## Usage
### Local Development
Run the application locally:
```bash
streamlit run main.py
```
### Using the Application
1. **Model ID**: Enter the Bedrock model ID (default: `us.anthropic.claude-3-7-sonnet-20250219-v1:0`)
2. **MCP Server**: Specify the MCP server package name for uvx (e.g., `awslabs.aws-documentation-mcp-server@latest`)
3. **Question**: Input your query
4. Click "Ask" to submit
The agent will perform the following:
- Connect to the specified MCP server
- Process the query using the selected Bedrock model
- Stream the response in real-time
- Display tool execution as it occurs
## Supported MCP Servers
This application can connect to any MCP server that supports the stdio protocol. Examples include:
- `awslabs.aws-documentation-mcp-server@latest` - AWS documentation search
- `mcp-server-filesystem@latest` - Filesystem operations
- `mcp-server-github@latest` - GitHub repository operations
## Deploying to Streamlit Community Cloud
1. Push your code to GitHub
2. Visit [share.streamlit.io](https://share.streamlit.io)
3. Click "New app"
4. Connect your GitHub repository
5. Deployment settings:
- Repository: `yourusername/strands-mcp-agent`
- Branch: `main`
- Main file path: `main.py`
6. Add AWS secrets in the app settings (refer to the configuration section)
7. Click "Deploy"
## Observability and Tracing
This application is integrated with Langfuse, allowing you to trace all agent activities. You can view the following information on the Langfuse dashboard:
- Agent execution traces
- Model input and output
- Tool execution history
- Latency and performance metrics
- Cost tracking
### Langfuse Setup
1. Create an account at [Langfuse](https://langfuse.com)
2. Create a project and obtain your API key
3. Add Langfuse credentials to Streamlit secrets (refer to the configuration section above)
## Security Considerations
- Do not commit AWS credentials to the repository
- Use Streamlit secrets for sensitive information
- Grant only the necessary permissions to the AWS IAM user for Bedrock
- Verify MCP server permissions before deployment
- Protect Langfuse credentials similarly
## Troubleshooting
### Common Issues
1. **AWS Credentials Error**: Ensure that AWS credentials are set up correctly
2. **Bedrock Access Denied**: Check if your AWS account has access to the specified Bedrock model
3. **MCP Server Connection Failure**: Verify that the MCP server package name is correct and accessible
### Debug Mode
To enable additional logging for debugging, run Streamlit with:
```bash
streamlit run main.py --logger.level=debug
```
## Contributing
Contributions are welcome! Feel free to submit a pull request.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Acknowledgments
- [Strands](https://github.com/yourusername/strands) - Agent framework
- [MCP](https://modelcontextprotocol.io) - Model Context Protocol
- [AWS Bedrock](https://aws.amazon.com/bedrock/) - Managed AI service
- [Streamlit](https://streamlit.io) - Web app framework
Connection Info
You Might Also Like
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
servers
Model Context Protocol Servers
Time
A Model Context Protocol server for time and timezone conversions.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
Sequential Thinking
A structured MCP server for dynamic problem-solving and reflective thinking.
git
A Model Context Protocol server for Git automation and interaction.