Skip to main content

Claude on AWS Bedrock MCP Server

CI License: MIT Python 3.10+

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) and bedrock-agent-runtime (retrieve) with botocore.config.Config timeout/single-attempt settings, bounded nextToken pagination (BEDROCK_MAX_PAGES), cyclic cursor detection, and jittered exponential backoff on ThrottlingException, ServiceUnavailableException, and ModelTimeoutException.
  • Atomic Decimal USD Session Budget Reservations: Reserves worst-case call spend (including system_prompt tokens) under lock via reserve_budget() -> reconcile_reservation() / release_reservation() across Claude Opus 4, Sonnet 4, 3.7/3.5 Sonnet, and 3.5/3 Haiku (including us., eu., apac., and global. inference profiles), preventing concurrent TOCTOU budget overshoots.
  • Single-Pass Guardrails & Deterministic Redaction: Masks AWS access keys (AKIA... / ASIA...), Bearer/JWT tokens, Luhn-validated credit card PANs, IBANs, SSNs, CNICs, emails, and phone numbers; blocks direct and indirect Knowledge Base prompt injections (scan_untrusted_context()); and passes guardrailConfig inline to converse() (raising BedrockGuardrailError on guardrail_intervened).
  • Bounded Zero-PII Audit Log: Stores SHA-256 parameter digests, eval_failed outcomes, and Decimal cost totals in a collections.deque(maxlen=1000) and emits structured JSON telemetry to stderr without logging raw prompts.
  • Citation, Polarity & Numeric RAG Evaluation: Verifies [cite:CHUNK_ID] references against retrieved chunks, catches hallucinated citations, negation-polarity flips (negation_mismatch), and unsupported numbers/percentages (unsupported_number), and exposes a CI exit-code gate via bedrock-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

Built by Code Ninety. Licensed under MIT.

Metadata

Release files for claude-bedrock-mcp-server 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for claude-bedrock-mcp-server 1.1.1
File Size Uploaded Provenance Actions
claude_bedrock_mcp_server-1.1.1.tar.gz 44.1 kB With provenance Details for claude_bedrock_mcp_server-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for claude-bedrock-mcp-server 1.1.1
File Interpreter ABI Platform Actions
claude_bedrock_mcp_server-1.1.1-py3-none-any.whl Python 3 none any Details for claude_bedrock_mcp_server-1.1.1-py3-none-any.whl

Total release size: 82.0 kB

Release files / claude_bedrock_mcp_server-1.1.1.tar.gz

Download URL claude_bedrock_mcp_server-1.1.1.tar.gz
Size 44.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0097729b4e2e5b26802ec3a6dd6134d37a738312048d70c607b7652cebdcce7f
BLAKE2b-256 checksum
How to use checksums
3782cf0b9317d7a46446552a699adf1e9a61fe551f78bca121abd347c8375321
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 log

Release files / claude_bedrock_mcp_server-1.1.1-py3-none-any.whl

Download URL claude_bedrock_mcp_server-1.1.1-py3-none-any.whl
Size 37.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e7108f84645c779a41b75f3c8b9789d0a2a68a737ffdfe76cc633cad65c3090
BLAKE2b-256 checksum
How to use checksums
76f04f2505241efe95f82a23aa209533d5c051ec90484cb76d9d3360361b96e3
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 log

Security for claude-bedrock-mcp-server 1.1.1

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.

Select from 2 files

Attestation for claude_bedrock_mcp_server-1.1.1.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 log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page