aws-bedrock -client
AWS API/lambda hosting MCP client server that queries bedrock LLM using MCP hosted tools
claude mcp add --transport stdio sverze-aws-bedrock-mcp-client-server java -jar aws-bedrock-mcp-server/target/aws-bedrock-mcp-server.jar \ --env WEATHER_API_KEY="<your_weather_api_key>" \ --env SPRING_PROFILES_ACTIVE="default"
How to use
This MCP server exposes a REST API implemented with Spring Boot to interact with Amazon Bedrock AI models and to utilize MCP tools for calculations, weather lookups, and web page retrieval. The API includes endpoints for basic health checks, listing available tools, performing calculations, obtaining weather information, converting web pages to markdown, and handling complex queries that may involve multiple tools. Typical interactions involve sending HTTP requests to the deployed API Gateway/Lambda (or directly to the Spring Boot service when running locally) and receiving structured results that incorporate tool outputs and reasoning steps when applicable. Endpoints such as /tools, /calculate, /weather, /webpage, and /query enable you to explore capabilities like arithmetic, weather data retrieval, and page summarization, with the MCP layer coordinating tool usage across Bedrock and related services.
How to install
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/
Installation steps:
-
Clone the repository and navigate into it: git clone https://github.com/sverze/aws-bedrock-mcp-client-server cd aws-bedrock-mcp-client-server
-
Build the multi-module project and provide your Weather API key: mvn clean package install -DWEATHER_API_KEY=<your_api_key_here>
This will build modules such as aws-bedrock-mcp-server, aws-bedrock-mcp-client, and aws-bedrock-mcp-client-server-cdk in the correct order.
-
Deploy to AWS using CDK: cd aws-bedrock-mcp-client-server-cdk cdk bootstrap cdk deploy --context WEATHER_API_KEY=<your_api_key_here>
-
After deployment, retrieve the API Gateway URL from the CDK output and use it to interact with the API endpoints. You can also run the application locally if desired by starting the Spring Boot jar generated in the build step.
Additional notes
Tips and considerations:
- Ensure your AWS credentials have permissions for Lambda, API Gateway, and Bedrock access.
- Set the WEATHER_API_KEY environment variable either during deployment or in the runtime environment to enable weather-related tooling.
- The server is designed to be deployed as a serverless component via AWS CDK, but you can also run locally for development by starting the Spring Boot JAR produced by Maven.
- When testing, endpoints include /hello, /tools, /calculate, /weather, /webpage, and /query. Complex queries may chain multiple tools (e.g., Weather + Calculations) to satisfy user intent.
- Monitor logs in CloudWatch under /aws/lambda/McpClientServerFunction if using the Lambda deployment path.
- If you modify environment variables, rebuild and redeploy to apply changes.