Claude on AWS Bedrock MCP Server
Open-source reference architecture and Model Context Protocol (MCP) server for governing Anthropic Claude models on AWS Bedrock (converse, apply_guardrail, and Knowledge Bases retrieve), paired with a deterministic citation-grounded RAG evaluation CLI (bedrock-rag-eval).
Architecture
flowchart LR
Client["MCP Host (Claude Desktop / IDE / Agent)"] --> Server["MCPServer (stdio)"]
Server --> Guard["GuardrailEnforcer (PII Redaction + Injection Block)"]
Guard --> Budget["BudgetLedger (Pre-flight Decimal USD Cap)"]
Budget --> Gateway["BedrockGateway (Retries + Bounded Pagination)"]
Gateway -->|BEDROCK_MODE=sandbox| Sandbox["Deterministic Finance/Compliance KB Sandbox"]
Gateway -->|BEDROCK_MODE=live| AWS["AWS Bedrock Runtime & Agent Runtime"]
Gateway --> Eval["FaithfulnessEvaluator (Citation & Overlap Gate)"]
Server --> Audit["AuditLogger (Bounded Deque + SHA-256 JSON)"]
Capabilities
- Exact AWS Bedrock Contracts: Typed protocols for
bedrock-runtime(converse,apply_guardrail) andbedrock-agent-runtime(retrieve) with boundednextTokenpagination (BEDROCK_MAX_PAGES), cyclic cursor detection, and exponential backoff onThrottlingException,ServiceUnavailableException, andModelTimeoutException. - Pre-Flight
DecimalUSD Cost Control: Computes worst-case call spend usingdecimal.Decimalacross Claude Opus 4, Sonnet 4, 3.7/3.5 Sonnet, and 3.5/3 Haiku (includingus.,eu.,apac., andglobal.inference profiles), failing closed withBedrockBudgetErrorbefore calling AWS ifBEDROCK_MAX_SESSION_USDwould be exceeded. - Dual-Layer Guardrails & PII Redaction: Recursively masks AWS access keys (
AKIA.../ASIA...), IBANs, SSNs, CNICs, emails, and phone numbers; blocks prompt-injection signatures locally; and optionally delegatesINPUTandOUTPUTchecks to AWS Bedrock Guardrails. - Bounded Zero-PII Audit Log: Stores SHA-256 parameter digests and
Decimalcost totals in acollections.deque(maxlen=1000)and emits structured JSON telemetry tostderrwithout logging raw prompts. - Citation-Grounded RAG Evaluation: Verifies
[cite:CHUNK_ID]references against retrieved chunks, rejects hallucinated citations, measures claim-level token grounding, and exposes a CI exit-code gate viabedrock-rag-eval.
Exposed MCP Tools
| Tool Name | Purpose | Key Controls |
|---|---|---|
bedrock_retrieve_knowledge |
Paginated Knowledge Base retrieval | BEDROCK_MAX_PAGES cap, cyclic cursor check, chunk PII redaction |
bedrock_converse_claude |
Governed Claude on Bedrock invocation | Prompt-injection block, pre-flight Decimal budget gate, output redaction |
bedrock_grounded_rag |
Retrieve -> cite -> Claude -> score pipeline | Inline [cite:CHUNK_ID] prompting + automatic EvalReport |
bedrock_evaluate_rag_response |
Standalone citation & faithfulness scorer | Flags hallucinated citations and unsupported claims |
bedrock_get_budget_status |
Live FinOps & audit snapshot | Returns Decimal USD totals and bounded SHA-256 audit history |
Quickstart (30-Second Zero-Credential Sandbox)
Run the server and RAG evaluation suite locally with zero AWS credentials:
pip install claude-bedrock-mcp-server
bedrock-rag-eval --dataset examples/golden_eval_set.jsonl
claude-bedrock-mcp-server
For live AWS Bedrock execution, install the [aws] extra and configure environment variables:
pip install "claude-bedrock-mcp-server[aws]"
export BEDROCK_MODE=live
export AWS_REGION=us-east-1
export BEDROCK_KNOWLEDGE_BASE_ID=YOUR10CHARID
export BEDROCK_MODEL_ID=us.anthropic.claude-sonnet-4-20250514-v1:0
export BEDROCK_MAX_SESSION_USD=5.00
claude-bedrock-mcp-server
MCP Client Configuration (claude_desktop_config.json)
{
"mcpServers": {
"claude-bedrock": {
"command": "claude-bedrock-mcp-server",
"env": {
"BEDROCK_MODE": "sandbox",
"BEDROCK_MAX_SESSION_USD": "5.00"
}
}
}
}
CI RAG Evaluation Gate (bedrock-rag-eval)
Run the golden JSONL dataset in CI pipelines to fail builds (exit 1) on citation hallucinations or faithfulness regressions:
bedrock-rag-eval \
--dataset examples/golden_eval_set.jsonl \
--min-faithfulness 0.70 \
--min-coverage 0.80 \
--json
Each JSONL row supports either precomputed evaluation (answer + chunks) or end-to-end RAG execution (query), with expected_pass (true/false) to keep both positive grounding cases and negative hallucination traps under regression control.
AWS Bedrock Native Agents & Knowledge Bases vs. Governed MCP Middleware
AWS provides managed Amazon Bedrock Agents and Bedrock Knowledge Bases (RetrieveAndGenerate) out of the box. Choose the right layer for your architecture:
| Dimension | Native AWS Bedrock Agents / RetrieveAndGenerate |
Governed MCP Middleware (claude-bedrock-mcp-server) |
|---|---|---|
| Best fit | AWS-native workflows orchestrated wholly inside Bedrock console/SDKs | IDE assistants, Claude Desktop, and multi-system MCP hosts needing portable tools |
| Cost governance | Account-level AWS Budgets & CloudWatch alarms (reactive) | Synchronous pre-flight Decimal session USD cap failing closed before API calls |
| PII & secret masking | Managed Bedrock Guardrails regex/PII filters | Deterministic local redaction (AWS keys, IBAN, CNIC, SSN) + optional AWS Guardrails |
| RAG verification | Managed citations without built-in CI regression exit gates | Deterministic FaithfulnessEvaluator + bedrock-rag-eval CLI gate for pull requests |
| Local dev / CI | Requires live AWS IAM credentials and provisioned KB/OpenSearch resources | Zero-credential deterministic sandbox mode for 30-second local and CI verification |
If your workloads live entirely inside AWS Step Functions or Bedrock Agents and only need AWS-native IAM and Guardrails, use the managed AWS services directly. Use this middleware when MCP clients invoke Claude on Bedrock across developer workstations or regulated enterprise pipelines that require pre-flight Decimal budget caps, local secret redaction, and automated CI faithfulness gates.
Architecture Decisions & Security
- ADR-001: Protocol-Typed AWS Bedrock Gateway and Lazy boto3 Loading
- ADR-002: Pre-Flight Decimal FinOps Budget Caps and Bounded Audit Logging
- ADR-003: Deterministic Citation-Grounded RAG Faithfulness Gate
- Security Policy | Contributing Guide | Changelog
Built by Code Ninety. Licensed under MIT.
Metadata
Release files for claude-bedrock-mcp-server 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| claude_bedrock_mcp_server-1.0.0.tar.gz | 35.0 kB | With provenance | Details for claude_bedrock_mcp_server-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| claude_bedrock_mcp_server-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for claude_bedrock_mcp_server-1.0.0-py3-none-any.whl |
Total release size: 68.7 kB
Release files / claude_bedrock_mcp_server-1.0.0.tar.gz
| Download URL | claude_bedrock_mcp_server-1.0.0.tar.gz |
|---|---|
| Size | 35.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d2fac8e9cdd4b1c73fa5d6153de736547dffcc5fcc684375fd774c0871c90e6
|
|
BLAKE2b-256 checksum How to use checksums |
83cf1d6f5f5bcdc1d251248c7a83f054c638e0c2be83bef573cab77bb83aa1ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.
Transparency logRelease files / claude_bedrock_mcp_server-1.0.0-py3-none-any.whl
| Download URL | claude_bedrock_mcp_server-1.0.0-py3-none-any.whl |
|---|---|
| Size | 33.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2bcc3829dcaa27565d46aff188340ff48ce84e466a87f7d18feffe6a4d2ea869
|
|
BLAKE2b-256 checksum How to use checksums |
741ec53d3a9d48dd4c55ec24acba1110ac2e3532f38f800c191a44449f399222
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.
Transparency logSecurity for claude-bedrock-mcp-server 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for claude_bedrock_mcp_server-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.