AgentCore MCP Server

AgentCore MCP Server

A stateless MCP server sample for the 2026-07-28 protocol, deployable to Amazon Bedrock AgentCore Runtime and probed via SigV4-signed requests.

Category
Visit Server

README

AgentCore MCP 2026-07-28 sample

A minimal, reproducible sample for exercising the MCP 2026-07-28 (stateless) protocol on Amazon Bedrock AgentCore — both a Runtime-hosted MCP server and a SigV4 probe you can point at a Gateway or a Runtime.

MCP 2026-07-28 makes the protocol stateless: no initialize handshake, no protocol-level Mcp-Session-Id, every request self-contained. The two artifacts here let you see that end to end.

Contents

File What it is
server.py A stateless MCP server built on the mcp Python SDK v2 (MCPServer), ready to deploy to AgentCore Runtime.
requirements.txt Runtime dependencies (mcp>=2.0.0).
mcp_probe.py A tiny SigV4-signed MCP client for probing an AgentCore Gateway /mcp endpoint or a Runtime /invocations endpoint with IAM auth.

Tested with mcp==2.0.0 (LATEST_PROTOCOL_VERSION == "2026-07-28"), bedrock-agentcore==1.19.0, bedrock-agentcore-starter-toolkit==0.3.11, Python 3.13, in us-east-1. Pin your mcp version — a different major version changes the server API (see note below).

The server

server.py uses the v2 high-level API. Note that mcp v2 removed FastMCP — the class is now MCPServer (mcp.server.mcpserver). It serves a stateless streamable-HTTP app at 0.0.0.0:8000/mcp, which is what AgentCore Runtime expects.

Key choices:

  • stateless_http=True — the 2026-07-28 model and the recommended AgentCore default.
  • enable_dns_rebinding_protection=False — the AgentCore front door forwards a non-localhost Host header, so the v2 default host validation must be relaxed for the container.

Run locally

python -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt
python server.py            # serves http://0.0.0.0:8000/mcp

Compare the two protocol shapes locally:

# old protocol -> SSE, no envelope
curl -s http://localhost:8000/mcp \
  -H 'Content-Type: application/json' -H 'Accept: application/json,text/event-stream' \
  -H 'MCP-Protocol-Version: 2025-03-26' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

# 2026-07-28 stateless -> plain JSON with resultType/cacheScope envelope
curl -s http://localhost:8000/mcp \
  -H 'Content-Type: application/json' -H 'Accept: application/json,text/event-stream' \
  -H 'MCP-Protocol-Version: 2026-07-28' -H 'Mcp-Method: tools/list' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{"_meta":{
        "io.modelcontextprotocol/protocolVersion":"2026-07-28",
        "io.modelcontextprotocol/clientInfo":{"name":"local","version":"1.0"},
        "io.modelcontextprotocol/clientCapabilities":{}}}}'

Deploy to AgentCore Runtime

Using the starter toolkit's direct_code_deploy (no local container build; IAM inbound auth is the default when you omit a JWT authorizer):

pip install bedrock-agentcore-starter-toolkit
agentcore configure -e server.py -n <agent-name> --protocol MCP \
  -r us-east-1 -rf requirements.txt --non-interactive
agentcore deploy

There is no MCP-version flag on a Runtime — the runtime declares only serverProtocol: MCP. Which MCP versions the server speaks is decided entirely by the mcp SDK version in your requirements.txt.

The probe

mcp_probe.py SigV4-signs a POST (default service bedrock-agentcore) so you can hit IAM-auth AgentCore endpoints with your own credentials — no Cognito/OAuth setup.

pip install boto3

# Point at a Gateway MCP endpoint or a Runtime /invocations URL:
URL="https://<gateway-id>.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp"

# 2026-07-28 stateless tools/list
python mcp_probe.py --url "$URL" --proto 2026-07-28 --mcp-method tools/list --method tools/list \
  --meta '{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{"name":"probe","version":"1.0"},"io.modelcontextprotocol/clientCapabilities":{}}'

# tools/call
python mcp_probe.py --url "$URL" --proto 2026-07-28 --mcp-method tools/call --mcp-name add_numbers \
  --method tools/call --name add_numbers --arguments '{"a":2,"b":40}' \
  --meta '{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{"name":"probe","version":"1.0"},"io.modelcontextprotocol/clientCapabilities":{}}'

For a Runtime, use the data-plane URL with the URL-escaped runtime ARN:

https://bedrock-agentcore.us-east-1.amazonaws.com/runtimes/<URL-ESCAPED-ARN>/invocations?qualifier=DEFAULT

Gotchas this sample demonstrates

  • A stateless 2026-07-28 request must carry protocolVersion, clientInfo, and clientCapabilities inside _meta on every call — omit any and you get -32602. A real client SDK does this for you; hand-rolling from an abbreviated example fails.
  • mcp v2 dropped FastMCP → use MCPServer. (Pin mcp>=1.28,<2 if you must keep FastMCP.)
  • v2 DNS-rebinding protection blocks the non-localhost Host behind AgentCore → disable it for the container.
  • On the wire: old protocol responds via SSE with no envelope; 2026-07-28 responds with plain JSON carrying resultType / cacheScope (and structuredContent / ttlMs where applicable).

Prerequisites

  • Python 3.10+ (3.13 tested)
  • AWS credentials in your environment with permission to deploy/invoke AgentCore
  • For probing: an AgentCore Gateway or Runtime configured with IAM (SigV4) inbound auth

References

License

MIT-0. See LICENSE.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured