About AWS Bedrock MCP Client and Server
This Spring Boot application connects Amazon Bedrock models with MCP tools through a REST API. It is intended for applications that need tool-using model queries and can be deployed as an AWS Lambda function behind API Gateway.
Key features
- 01REST API for Amazon Bedrock queries
- 02MCP tools for calculations and weather
- 03Web page retrieval and Markdown conversion
- 04Multi-tool handling for complex queries
- 05AWS Lambda deployment behind API Gateway
Use cases
- 01Ask Bedrock to calculate values using tools
- 02Retrieve weather for a location
- 03Summarize a web page through a model query
MCP support
The application includes an MCP client and server: the client uses MCP tools while interacting with Amazon Bedrock, and the server provides calculation, weather, and web page retrieval tools.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEAWS Bedrock MCP Client and Server
A Spring Boot application that serves as a client for the Model Context Protocol (MCP), enabling interaction with Amazon Bedrock AI models with tool-using capabilities.
Application Overview
This application provides a REST API for:
- Communicating with Amazon Bedrock models
- Using MCP tools for calculations, weather information, and web page retrieval
- Handling complex AI queries that might require multiple tools
- The application runs as an AWS Lambda function behind API Gateway, making it serverless and scalable.
Prerequisites
- Java 21 or later
- Maven 3.8+
- AWS CLI configured with appropriate credentials
- AWS CDK installed (npm install -g aws-cdk)
- Weather API key from https://www.weatherapi.com/my/
Environment Setup
Clone the Repository
git clone https://github.com/sverze/aws-bedrock-mcp-client-server
cd aws-bedrock-mcp-client-server
Configure AWS
You will credentials that has priviledges to the following services
- Lambda
- API Gateway
- Bedrock
- Bedrock Model Anthropic Sonnet 4.0
To configure local credentials run the following command:
aws configure
###Building the Application
The project follows a multi-module Maven structure. To build all modules run this from the parent directory:
mvn clean package install -DWEATHER_API_KEY=<your_api_key_here>
This will build all modules in the correct order:
- aws-bedrock-mcp-server
- aws-bedrock-mcp-client
- aws-bedrock-mcp-client-server-cdk
Deploying to AWS
The AWS deployment is managed using AWS CDK. To deploy the application, run the following commands:
cd aws-bedrock-mcp-client-server-cdk
cdk bootstrap
cdk deploy --context WEATHER_API_KEY=<your_api_key_here>
After deployment completes, CDK will output the API Gateway URL in the terminal. You will need this URL to interact with the API and perform the tests below.
Testing the API
Once deployed, you can test the API endpoints using curl or a tool like Postman:
-
Test the Hello World endpoint
curl https://<your-api-id>.execute-api.<region>.amazonaws.com/prod/helloExpected response: Hello World from MCP Client!
-
List available tools
curl https://<your-api-id>.execute-api.<region>.amazonaws.com/prod/tools -
Perform a calculation
curl -X POST "https://<your-api-id>.execute-api.<region>.amazonaws.com/prod/calculate?operation=add&a=5&b=3" -
Get weather information
curl -X POST "https://<your-api-id>.execute-api.<region>.amazonaws.com/prod/weather?location=New%20York&format=celsius" -
Convert a web page to markdown
curl -X POST "https://<your-api-id>.execute-api.<region>.amazonaws.com/prod/webpage?url=https://example.com" -
Make a complex query - The Weather
curl -X POST "https://<your-api-id>.execute-api.<region>.amazonaws.com/prod/query?query=What%20is%20the%20weather%20in%20London%20and%20calculate%2045%20divided%20by%209" -
Make a complex query - Summarise a Webpage
curl -X POST "https://<your-api-id>.execute-api.<region>.amazonaws.com/prod/query?query=Summarise%20the%20following%20webpage%20https://example.com"
Monitoring and Logs
View application logs in CloudWatch Logs:
- Navigate to AWS CloudWatch console
- Check the /aws/lambda/McpClientServerFunction log group
Clean Up
To remove all deployed resources:
cd aws-bedrock-mcp-client-server-cdk
cdk destroy
Architecture
This application implements a serverless architecture:
- API Gateway serves as the HTTP endpoint
- AWS Lambda runs the Spring Boot application
- Amazon Bedrock provides the AI model capabilities
- MCP Server provides tool implementations
- The AWS CDK stack creates and configures all the necessary AWS resources, including IAM roles with appropriate permissions for accessing Amazon Bedrock.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.