home / mcp / bedrock mcp agent server

Bedrock MCP Agent Server

Agente de AWS Bedrock integrado con Model Context Protocol (MCP)

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "harold-moncaleano-bedrock-mcp-agent": {
      "command": "python",
      "args": [
        "bedrock_mcp_agent.py"
      ],
      "env": {
        "FLASK_HOST": "0.0.0.0",
        "FLASK_PORT": "5000",
        "SECRET_KEY": "bedrock-mcp-",
        "FLASK_DEBUG": "True",
        "AWS_ACCESS_KEY_ID": "YOUR_AWS_ACCESS_KEY_ID",
        "AWS_DEFAULT_REGION": "us-east-1",
        "AWS_SECRET_ACCESS_KEY": "YOUR_AWS_SECRET_ACCESS_KEY"
      }
    }
  }
}

You can run and connect to a Bedrock MCP Agent server that exposes a standardized MCP interface to AWS Bedrock models. This server provides a web frontend, a Python backend, and a REST/health API so you can interact with multiple models, manage conversations, and tune parameters like temperature and max tokens with real-time status monitoring.

How to use

You will interact with the MCP server through its web interface and REST endpoints. Start the server locally, then open the web UI to chat with AWS Bedrock models or use the REST API to programmatically send prompts, fetch responses, and query configuration details. The MCP endpoints expose model listing, chat, and health status so you can integrate Bedrock model calls into your apps with a consistent format.

How to install

Prerequisites you need before installation include Python 3.8 or higher and a modern web browser. You also need AWS credentials configured with permissions to bedrock:InvokeModel and bedrock:ListFoundationModels.

# Method A: Automated start scripts (recommended)
# Linux/macOS
git clone https://example.org/bedrock-mcp-agent.git
cd bedrock-mcp-agent
chmod +x start.sh
./start.sh

# Windows
git clone https://example.org/bedrock-mcp-agent.git
cd bedrock-mcp-agent
start.bat

If you prefer manual setup, follow these steps to clone, create a virtual environment, and install dependencies.

git clone https://example.org/bedrock-mcp-agent.git
cd bedrock-mcp-agent

python -m venv venv

# Activate the environment
# Linux/macOS:
source venv/bin/activate
# Windows:
venv\Scripts\activate

pip install -r requirements.txt

Configure your environment with your AWS credentials and desired settings, then start the backend and web server.

# Copy the example environment file and edit with your credentials
cp .env.example .env
# Edit .env to include AWS credentials and region

Additional sections

Configuration and environment variables help tailor the MCP server to your AWS Bedrock setup. You can set AWS credentials, region, and server options for the Flask backend and the MCP agent.

Security best practices include keeping credentials out of code, using environment variables or IAM roles, enabling production authentication, and serving over HTTPS in production.

If you need to troubleshoot, check AWS credential validity, verify model access in Bedrock, ensure you are using a supported region, and inspect server logs produced by the Flask app and the MCP agent.

For deployment, you can run Gunicorn in production or containerize the server with a Docker setup. The following commands show typical production usage and a minimal Dockerfile.

# Production with Gunicorn
pip install gunicorn

gunicorn -w 4 -b 0.0.0.0:5000 app:app

# Minimal Dockerfile (example)
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 5000
CMD ["python", "app.py"]

Available tools

health

Endpoint to check server and agent status, returns a healthy state with timestamp and region.

models

Endpoint to list available MCP models from Bedrock providers.

chat

Endpoint to send a message to a selected model and receive a formatted MCP response.

config

Endpoint to retrieve current server configuration and model options.

frontend

Web UI served at the root path to interact with models and review chat history.