Skip to main content
Glama

Bedrock Prompts MCP Server

by mslangford

Bedrock Prompts MCP Server

An MCP (Model Context Protocol) server for managing and invoking AWS Bedrock managed prompts.

Features

  • List Prompts: Browse all available Bedrock managed prompts

  • Get Prompt Details: View complete prompt configuration including templates, variables, and model settings

  • Invoke Prompts: Execute prompts with variable substitution and get model responses

  • Batch Invocation: Run the same prompt multiple times with different inputs in parallel

  • Streaming Responses: Get real-time streaming output from prompts (for supported models)

  • Multi-Model Support: Works with Claude, Amazon Titan, Meta Llama, Mistral AI, Cohere, and AI21 models

  • Version Management: List and access different versions of prompts

Prerequisites

  • Python 3.10 or higher

  • AWS credentials configured (via AWS CLI, environment variables, or IAM role)

  • Access to AWS Bedrock service

  • Claude Desktop (for MCP integration)

Installation

Option 1: Local Development

# Clone or download the files cd /path/to/bedrock-prompts-mcp # Install dependencies pip install -r requirements.txt # Test the server python bedrock_prompts_mcp_server.py

Option 2: Install as Package

pip install -e .

AWS Configuration

Ensure your AWS credentials are configured. The server will use the default credential chain:

# Via AWS CLI aws configure # Or set environment variables export AWS_ACCESS_KEY_ID=your_key export AWS_SECRET_ACCESS_KEY=your_secret export AWS_REGION=us-east-1

Optional environment variables:

  • AWS_REGION: AWS region for Bedrock (default: us-east-1)

  • BEDROCK_TENANT_ID: Optional tenant identifier

Claude Desktop Configuration

Add this to your Claude Desktop config file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

{ "mcpServers": { "bedrock-prompts": { "command": "python", "args": ["/absolute/path/to/bedrock_prompts_mcp_server.py"], "env": { "AWS_REGION": "us-east-1" } } } }

If you installed as a package:

{ "mcpServers": { "bedrock-prompts": { "command": "bedrock-prompts-mcp", "env": { "AWS_REGION": "us-east-1" } } } }

Usage in Claude Desktop

Once configured, you can use natural language to interact with your Bedrock prompts:

Examples

List available prompts:

Show me all my Bedrock prompts

Get prompt details:

Get the details for prompt VSWZVOISYG

Invoke a prompt:

Invoke prompt VSWZVOISYG with the question "How do you feel about the economy?"

Generate multiple responses:

Use prompt VSWZVOISYG to generate 5 different survey responses to "How do you feel about the economy?"

Batch invoke with different inputs:

Batch invoke prompt VSWZVOISYG with these questions: 1. "How do you feel about the economy?" 2. "What are your hiring plans?" 3. "How do you view inflation?"

Stream a long response:

Stream the response from prompt VSWZVOISYG with streaming enabled

Available Tools

1. list_bedrock_prompts

Lists all available Bedrock managed prompts.

Parameters:

  • max_results (optional): Number of results (1-100, default: 20)

  • next_token (optional): Pagination token

2. get_bedrock_prompt_details

Gets detailed information about a specific prompt.

Parameters:

  • prompt_identifier (required): Prompt ID or ARN

  • prompt_version (optional): Specific version (default: DRAFT)

3. invoke_bedrock_prompt

Invokes a prompt with variables and returns the model's response.

Parameters:

  • prompt_identifier (required): Prompt ID or ARN

  • prompt_variables (optional): Dict of variable substitutions

  • prompt_version (optional): Specific version (default: DRAFT)

Example variables:

{ "question": "How do you feel about the economy?", "context": "Survey for small business owners" }

4. list_bedrock_prompt_versions

Lists all versions of a specific prompt.

Parameters:

  • prompt_identifier (required): Prompt ID or ARN

  • max_results (optional): Number of results (1-100, default: 20)

5. invoke_bedrock_prompt_stream

Invokes a prompt with streaming response for real-time output.

Parameters:

  • prompt_identifier (required): Prompt ID or ARN

  • prompt_variables (optional): Dict of variable substitutions

  • prompt_version (optional): Specific version (default: DRAFT)

Returns: Full completion text plus array of streamed chunks

6. batch_invoke_bedrock_prompt

Invokes a prompt multiple times with different variable sets in parallel.

Parameters:

  • prompt_identifier (required): Prompt ID or ARN

  • variable_sets (required): Array of variable dictionaries

  • prompt_version (optional): Specific version (default: DRAFT)

  • max_workers (optional): Parallel workers (1-10, default: 5)

Example variable_sets:

[ {"question": "How do you feel about the economy?"}, {"question": "What are your hiring plans?"}, {"question": "How do you view inflation?"} ]

Returns: Aggregated results with success/failure counts and individual responses

Supported Model Types

The server automatically detects and formats requests for:

  • Anthropic Claude (claude-3, claude-3-5-sonnet, etc.)

  • Amazon Titan (titan-text-express, titan-text-lite)

  • Meta Llama (llama-2, llama-3, etc.)

  • Mistral AI (mistral-7b, mixtral-8x7b)

  • Cohere (command, command-light)

  • AI21 Labs (jurassic-2)

Each model type uses the appropriate request/response format automatically.

Troubleshooting

Server won't start

  • Check that AWS credentials are configured: aws sts get-caller-identity

  • Verify Python version: python --version (should be 3.10+)

  • Check logs in Claude Desktop: Help → Show Logs

"No credentials found" error

  • Run aws configure to set up credentials

  • Or use environment variables in the config file

Prompt invocation fails

  • Verify the prompt exists: List prompts first

  • Check that the model specified in the prompt is available in your region

  • Ensure you have permissions to invoke Bedrock models

Variable substitution not working

  • Check that variable names match exactly (case-sensitive)

  • The server supports both {{variable}} and {variable} syntax

  • View prompt details to see expected variable names

Development

Running Tests

# Test AWS connectivity python bedrock_prompts_mcp_server.py

Adding New Features

The server is structured to make it easy to add new Bedrock operations:

  1. Add a new function in the main file

  2. Register it in list_tools()

  3. Handle it in call_tool()

Security Notes

  • Never commit AWS credentials to version control

  • Use IAM roles when possible (e.g., on EC2 instances)

  • Follow least-privilege principles for IAM permissions

  • The server runs locally and doesn't expose network endpoints

Required IAM Permissions

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "bedrock:ListPrompts", "bedrock:GetPrompt", "bedrock:ListPromptVersions", "bedrock:InvokeModel" ], "Resource": "*" } ] }

License

MIT

Support

For issues or questions:

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Enables management and invocation of AWS Bedrock managed prompts with support for variable substitution, streaming responses, batch processing, and multiple AI models including Claude, Titan, Llama, and Mistral.

  1. Features
    1. Prerequisites
      1. Installation
        1. Option 1: Local Development
        2. Option 2: Install as Package
      2. AWS Configuration
        1. Claude Desktop Configuration
          1. Usage in Claude Desktop
            1. Examples
          2. Available Tools
            1. 1. list_bedrock_prompts
            2. 2. get_bedrock_prompt_details
            3. 3. invoke_bedrock_prompt
            4. 4. list_bedrock_prompt_versions
            5. 5. invoke_bedrock_prompt_stream
            6. 6. batch_invoke_bedrock_prompt
          3. Supported Model Types
            1. Troubleshooting
              1. Server won't start
              2. "No credentials found" error
              3. Prompt invocation fails
              4. Variable substitution not working
            2. Development
              1. Running Tests
              2. Adding New Features
            3. Security Notes
              1. Required IAM Permissions
                1. License
                  1. Support

                    MCP directory API

                    We provide all the information about MCP servers via our MCP API.

                    curl -X GET 'https://glama.ai/api/mcp/v1/servers/mslangford/bedrock-prompts-mcp'

                    If you have feedback or need assistance with the MCP directory API, please join our Discord server