@miguel-carrera/aws-bedrock-mcp-server
v1.1.0
Published
MCP server for AWS Bedrock Knowledge Base — semantic search and RAG via bedrock_retrieve and bedrock_retrieve_and_generate
Downloads
31
Maintainers
Readme
aws-bedrock-mcp-server
MCP server for AWS Bedrock Knowledge Base — exposes two tools for semantic search and RAG.
| Tool | Description |
|------|-------------|
| bedrock_retrieve | Semantic / hybrid search — returns raw passages from the Knowledge Base |
| bedrock_retrieve_and_generate | Full RAG pipeline — retrieves passages and generates a grounded answer |
Usage with Claude Code
claude mcp add aws-bedrock -- npx -y @miguel-carrera/aws-bedrock-mcp-serverOr add to your claude_desktop_config.json / .mcp.json:
Cognito auth (recommended):
{
"mcpServers": {
"aws-bedrock": {
"command": "npx",
"args": ["-y", "@miguel-carrera/aws-bedrock-mcp-server"],
"env": {
"BEDROCK_KNOWLEDGE_BASE_ID": "<your-kb-id>",
"AWS_REGION": "us-east-1",
"COGNITO_IDENTITY_POOL_ID": "<identity-pool-id>",
"COGNITO_USER_POOL_CLIENT_ID": "<app-client-id>",
"COGNITO_DOMAIN": "<your-domain>.auth.us-east-1.amazoncognito.com"
}
}
}
}AWS profile auth:
{
"mcpServers": {
"aws-bedrock": {
"command": "npx",
"args": ["-y", "@miguel-carrera/aws-bedrock-mcp-server"],
"env": {
"BEDROCK_KNOWLEDGE_BASE_ID": "<your-kb-id>",
"AWS_REGION": "us-east-1",
"AWS_PROFILE": "default"
}
}
}
}Prerequisites
- Node.js ≥ 18
For AWS profile auth: credentials configured in ~/.aws/credentials or ~/.aws/config.
For Cognito auth: a Cognito User Pool with a hosted UI and an Identity Pool. On the first run the server opens your browser to log in; credentials are cached to ~/.atlas-ai/cognito-credentials.json and reused until they expire (~1 hour).
Required IAM permissions:
{
"Effect": "Allow",
"Action": [
"bedrock:Retrieve",
"bedrock:RetrieveAndGenerate"
],
"Resource": "arn:aws:bedrock:*:*:knowledge-base/*"
}Configuration
| Environment variable | Required | Default | Description |
|---|---|---|---|
| BEDROCK_KNOWLEDGE_BASE_ID | Recommended | — | Default Knowledge Base ID; can be overridden per tool call |
| AWS_REGION | No | us-east-1 | AWS region where your Knowledge Base lives |
| Cognito auth | | | |
| COGNITO_IDENTITY_POOL_ID | Yes (Cognito) | — | Cognito Identity Pool ID — activates Cognito auth when set |
| COGNITO_USER_POOL_CLIENT_ID | Yes (Cognito) | — | Cognito User Pool app client ID |
| COGNITO_DOMAIN | Yes (Cognito) | — | Cognito hosted UI domain (e.g. xyz.auth.us-east-1.amazoncognito.com) |
| AWS profile auth | | | |
| AWS_PROFILE | No | default | AWS named profile from ~/.aws (used when COGNITO_IDENTITY_POOL_ID is not set) |
Tools
bedrock_retrieve
Search the Knowledge Base and return raw passages.
| Parameter | Type | Default | Description |
|---|---|---|---|
| query | string | — | Natural language search query (required) |
| knowledge_base_id | string | env var | Bedrock KB ID |
| number_of_results | number | 5 | Passages to return (1–100) |
| search_type | SEMANTIC | HYBRID | SEMANTIC | Search strategy |
| next_token | string | — | Pagination cursor |
| response_format | markdown | json | markdown | Output format |
bedrock_retrieve_and_generate
Retrieve passages and generate a grounded answer using a Bedrock model.
| Parameter | Type | Default | Description |
|---|---|---|---|
| query | string | — | Question to answer (required) |
| knowledge_base_id | string | env var | Bedrock KB ID |
| model_arn | string | Claude 3 Haiku | ARN of the Bedrock model for generation |
| number_of_results | number | 5 | Passages to retrieve (1–100) |
| search_type | SEMANTIC | HYBRID | SEMANTIC | Search strategy |
| session_id | string | — | Session ID for multi-turn conversations |
| system_prompt | string | — | Custom generation prompt (use $search_results$ placeholder) |
| response_format | markdown | json | markdown | Output format |
Development
npm install
npm run dev # watch mode
npm run build # compile to dist/