Skip to main content
Glama
AWSWSA-MCP

AWSWSA-MCP

by mirecekd

Python MCP AWS Docker License MIT Tests Release

Buy Me a Beer PayPal

πŸš€ What is AWSWSA-MCP?

A small MCP server with one tool, aws_web_search, that wraps the Amazon Bedrock AgentCore Web Search API (InvokeWebSearch). Your agent gets ranked web results with a text extract, the source URL and the publication date, and the query is served from an Amazon-operated web index inside AWS.

It is meant as a complement to a basic web search such as Tavily, not a replacement. It only searches. It does not fetch whole pages, map or crawl a site, or run multi-step research. Keep Tavily (or any fetch tool) for that and add this server as a second, independent source.

Related MCP server: Web Search MCP Server

🧠 How it works?

1. Listen

  • An MCP client (Claude, pi, MCPHub, LiteLLM, any streamable-HTTP client) connects to /mcp. Optional bearer authentication protects the endpoint; /health is always open.

2. Think

  • The tool validates the request (query 1-200 characters, 1-25 results, optional domain include/exclude lists, optional date range, optional country) before anything is sent to AWS.

  • InvokeWebSearch is called with the default boto3 credential chain, so the server needs no API key of its own: an EC2 instance profile is enough.

4. Show

  • The result is a numbered markdown list with title, URL, publication date and a text extract, ending with a reminder to cite the sources (required by the AWS acceptable-use terms).

✨ Features

  • One tool, aws_web_search: query, max_results, include_domains, exclude_domains, published_after, published_before, country

  • No third-party search key: IAM only, queries stay inside AWS

  • Works with an EC2 instance profile, environment keys, session tokens, *_FILE secrets or a shared profile

  • Optional bearer token, constant-time comparison, /health for container checks

  • Small multi-arch Docker image, runs as a non-root user

  • Fast: about 0.5 s per search in our tests, results carry a publication date

πŸ› οΈ Technology Stack

Layer

Technology

Language

Python 3.13

MCP

official mcp SDK, FastMCP, streamable HTTP

AWS

boto3 (Amazon Bedrock AgentCore data plane)

Server

uvicorn / Starlette

Container

Docker, linux/amd64 and linux/arm64

πŸ—οΈ Architecture

flowchart LR
    A[Agent / MCP client] -->|POST /mcp, Bearer| B[awswsa-mcp]
    B -->|InvokeWebSearch, SigV4| C[AgentCore Web Search]
    C --> D[(Amazon web index)]
    E[Instance profile / keys] -.credentials.-> B
client --MCP--> awswsa-mcp --boto3--> bedrock-agentcore: InvokeWebSearch

πŸ“¦ Get the image

docker pull ghcr.io/mirecekd/awswsa-mcp:latest

Or build it yourself:

docker build -t awswsa-mcp .

βš™οΈ Setup

1. Allow the call in IAM

The caller needs one action on one resource, nothing else:

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": "bedrock-agentcore:InvokeWebSearch",
    "Resource": "arn:aws:bedrock-agentcore:*:aws:tool/web-search.v1"
  }]
}

Attach it to the EC2 instance role, or to the IAM user whose keys you pass in.

2. Run it

On EC2 with the policy above, no keys are needed:

docker run -d --name awswsa-mcp -p 127.0.0.1:8080:8080 \
  -e AWS_REGION=eu-west-1 \
  -e AWSWSA_BEARER_TOKEN="$(openssl rand -hex 24)" \
  ghcr.io/mirecekd/awswsa-mcp:latest

With keys instead (any of these, in this order of precedence):

# environment, including temporary session credentials
docker run ... -e AWS_ACCESS_KEY_ID=... -e AWS_SECRET_ACCESS_KEY=... -e AWS_SESSION_TOKEN=... ...

# files (Docker or Compose secrets), nothing visible in `docker inspect`
docker run ... -v ./secrets:/run/secrets:ro \
  -e AWS_ACCESS_KEY_ID_FILE=/run/secrets/access_key \
  -e AWS_SECRET_ACCESS_KEY_FILE=/run/secrets/secret_key ...

# a shared profile
docker run ... -v ./aws-config:/app/aws:ro -e AWS_CONFIG_FILE=/app/aws/config -e AWS_SHARED_CREDENTIALS_FILE=/app/aws/credentials -e AWS_PROFILE=my-profile ...

When none of them is set, boto3 falls back to the EC2 instance profile. On a plain Docker host the instance metadata endpoint must be reachable from the container (IMDSv2 hop limit of 2).

3. Connect a client

The MCP endpoint is http://<host>:8080/mcp with the header Authorization: Bearer <token>. In MCPHub add a streamable-http server with that URL and header.

πŸ”§ Configuration

Variable

Default

Meaning

AWSWSA_HOST

0.0.0.0

Listen address

AWSWSA_PORT

8080

Listen port

AWSWSA_BEARER_TOKEN

empty

When set, /mcp requires Authorization: Bearer <token>. When empty there is no authentication and a warning is logged

AWSWSA_ALLOWED_HOSTS

empty

Comma list of accepted Host headers; empty disables the DNS-rebinding check (use behind a reverse proxy)

AWS_REGION / AWS_DEFAULT_REGION

eu-west-1

Region of the Web Search API

AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN

unset

Static or temporary credentials

AWS_ACCESS_KEY_ID_FILE, AWS_SECRET_ACCESS_KEY_FILE, AWS_SESSION_TOKEN_FILE

unset

Read the value from a file when the plain variable is not set

AWS_PROFILE

unset

Shared credentials profile

πŸ§ͺ When to use it, and when not

We ran the same nine queries (English, Czech, news; five results each) through this server and through Tavily Search (default settings, no topic or date options) on 2026-12-01. It is a small, informal comparison, not a benchmark.

AWS Web Search

Tavily

Latency

about 0.5 s

about 1.6 s

Publication date in the result

41 of 45

0 of 45 in the default (general) mode

English queries

good

good

News

good, recent sources

usable, age unknown

Czech queries

weak

good

Tools

search only

search, extract, map, crawl, research

  • Use it for English queries and news, when you want the publication date, when queries must not leave AWS, or as a second source (the two returned almost completely different domains: 4 shared of about 44).

  • Do not use it for Czech or other small-language queries. It returned German, French and Dutch pages for Czech questions, with or without diacritics and with country set. Tavily returned Czech sources.

  • Do not expect page extraction, site mapping or crawling. Pair it with a fetch tool.

πŸ”’ Security

  • No default credentials in the image. The server uses what you give it, or the instance profile.

  • Least privilege: one IAM action on one resource (see Setup).

  • Secrets are never logged. The *_FILE variables keep keys out of docker inspect.

  • Set AWSWSA_BEARER_TOKEN and do not publish the port. Without a token anyone who can reach the port can spend your search quota.

  • The container runs as a non-root user.

πŸ’° Cost and limits

  • The first 5,000 queries per month are free, then about 7 USD per 1,000 queries. Check the AgentCore pricing for current numbers.

  • Default quota: 10 requests per second per Region.

  • Available Regions: us-east-1, us-east-2, us-west-2, eu-west-1, ap-southeast-2, ap-northeast-1.

  • Acceptable use: keep and show the source citation for every result you surface, and do not bulk-extract content or build a competing index.

🧭 Versioning and releases

Versions are YYYYMMDD.X, the build day and the counter of that day. A push to main runs the tests, computes the next version with scripts/release.py, tags it, creates a GitHub release and publishes ghcr.io/mirecekd/awswsa-mcp:<version> and :latest for linux/amd64 and linux/arm64. See CHANGELOG.md.

πŸ§ͺ Development

python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt -r requirements-dev.txt
ruff check .
pytest -q tests scripts
python3 scripts/privacy_scan.py --tree
bash scripts/install-hooks.sh   # refuses private files and key-like strings on commit

The tests need no network and no AWS account.

β˜• Support

Buy Me A Coffee PayPal.me

πŸ“„ License

MIT License - see the LICENSE file for details.

πŸ‘€ Author

Miroslav Dvorak - mirecekd@gmail.com

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      Provides access to LangSearch's Web Search and Semantic Rerank APIs for AI assistants. It enables web searching with advanced filtering and reranking of documents based on semantic relevance.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to perform web searches, extract webpage content, and conduct end-to-end search-and-extract operations using multiple search providers and content extraction methods.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to search the live web and extract readable page content as MCP tools, with ranked results, domain filters, and news support.
      39 npm
      MIT