This is a demo of Anthropic's open source MCP used with Amazon Bedrock Converse API. This combination allows for the MCP to be used with any of the many models supported by the Converse API.
- Python 3.8+
- AWS account with Bedrock access
- AWS credentials configured locally
- SQLite database (Follow the instructions in the MCP Quick Start Guide to set this up.)
- Clone the repository:
git clone <repository-url>
cd <project-directory>
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install required packages:
pip install -r requirements.txt
- Ensure AWS credentials are properly configured in
~/.aws/credentials
or via environment variables:
export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_DEFAULT_REGION=us-west-2
- The default configuration uses:
- Model: anthropic.claude-3-5-sonnet-20241022-v2:0
- Region: us-west-2
- SQLite database path: ~/test.db
app.py
: Main application entry point and interactive loopconverse_agent.py
: Core agent implementation with Bedrock integrationconverse_tools.py
: Tool management and execution systemmcp_client.py
: MCP (Model Control Protocol) client implementation
- Start the application:
python app.py
- Enter prompts when prompted. The agent will:
- Process your input
- Execute any necessary tools
- Provide responses
- Maintain conversation context
- Exit the application by typing 'quit', 'exit', 'q', or using Ctrl+C
The main agent class that:
- Manages conversation flow
- Integrates with Bedrock
- Handles tool execution
- Processes responses
Reference:
startLine: 3
endLine: 109
Manages tool registration and execution:
- Tool registration with schemas
- Name sanitization
- Tool execution handling
Reference:
startLine: 5
endLine: 76
Handles communication with the MCP server:
- Tool discovery
- Tool execution
- Server connection management
Reference:
startLine: 6
endLine: 48
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.