mcp-server-amazon-bedrock
by: zxkane
Model Context Procotol(MCP) server for using Amazon Bedrock Nova Canvas to generate images
📌Overview
Purpose: To provide a Model Control Protocol (MCP) server that facilitates high-quality AI image generation through Amazon Bedrock's Nova Canvas model.
Overview: The Amazon Bedrock MCP Server enables users to generate high-quality images from text descriptions, leveraging advanced features to refine and control the image output. This server is designed for integration with Amazon’s services and requires specific AWS configurations.
Key Features:
-
High-Quality Image Generation: Utilizes Amazon’s Nova Canvas model to create detailed images from textual prompts, enhancing user creativity.
-
Advanced Control with Negative Prompts: Allows users to specify elements to exclude from the image, enabling fine-tuning of the composition and aesthetic.
-
Flexible Configuration Options: Users can adjust image dimensions and quality, offering versatility based on project requirements.
-
Deterministic Image Generation: Supports seed control for reproducibility of generated images, ensuring consistent outputs across multiple generations.
-
Robust Input Validation and Error Handling: Enhances reliability by managing potential errors effectively during the image generation process.
Amazon Bedrock MCP Server
A Model Control Protocol (MCP) server that integrates with Amazon Bedrock's Nova Canvas model for AI image generation.
Features
- High-quality image generation from text descriptions using Amazon's Nova Canvas model.
- Advanced control through negative prompts to refine image composition.
- Flexible configuration options for image dimensions and quality.
- Deterministic image generation with seed control.
- Robust input validation and error handling.
Prerequisites
- Active AWS account with Amazon Bedrock and Nova Canvas model access.
- Properly configured AWS credentials with required permissions.
- Node.js version 18 or later.
Installation
AWS Credentials Configuration
Configure AWS credentials with appropriate Amazon Bedrock permissions using one of the following methods:
-
Environment Variables:
export AWS_ACCESS_KEY_ID=your_access_key export AWS_SECRET_ACCESS_KEY=your_secret_key export AWS_REGION=us-east-1 # or your preferred region
-
AWS Credentials File (
~/.aws/credentials
):[the_profile_name] aws_access_key_id = your_access_key aws_secret_access_key = your_secret_key
Set the active profile:
export AWS_PROFILE=the_profile_name
-
IAM Role (when deployed on AWS infrastructure).
Claude Desktop Integration
To integrate with Claude Desktop, add the configuration to your settings file:
For MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
For Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"amazon-bedrock": {
"command": "npx",
"args": [
"-y",
"@zxkane/mcp-server-amazon-bedrock"
],
"env": {
"AWS_PROFILE": "your_profile_name",
"AWS_ACCESS_KEY_ID": "your_access_key",
"AWS_SECRET_ACCESS_KEY": "your_secret_key",
"AWS_REGION": "us-east-1"
}
}
}
}
Available Tools
generate_image
Uses Amazon Bedrock's Nova Canvas model to create images from text descriptions.
Parameters
prompt
(required): Descriptive text for the desired image (1-1024 characters).negativePrompt
(optional): Elements to exclude from the image (1-1024 characters).width
(optional): Image width in pixels (default: 1024).height
(optional): Image height in pixels (default: 1024).quality
(optional): Image quality level - "standard" or "premium" (default: "standard").cfg_scale
(optional): Prompt adherence strength (1.1-10, default: 6.5).seed
(optional): Generation seed for reproducibility (0-858993459, default: 12).numberOfImages
(optional): Batch size for generation (1-5, default: 1).
Example Implementation
const result = await callTool('generate_image', {
prompt: "A serene mountain landscape at sunset",
negativePrompt: "people, buildings, vehicles",
quality: "premium",
cfg_scale: 8,
numberOfImages: 2
});
Prompt Guidelines
For optimal results, avoid negative phrasing in the main prompt. Instead, use the negativePrompt
parameter.
Development
To set up and run the server locally:
git clone https://github.com/zxkane/mcp-server-amazon-bedrock.git
cd mcp-server-amazon-bedrock
npm install
npm run build
Performance Considerations
Generation time is influenced by resolution, batch size, and quality settings. Higher values may lead to timeouts.
License
This project is licensed under the MIT License.