AgentCore MCP Reverse Connector
Deploys a minimal MCP-compatible Python tool server on Amazon EKS that establishes an outbound WebSocket connection to an AgentCore Gateway. It exposes two tools (get_system_info and echo_data) for tool discovery and invocation through the MCP protocol.
README
AgentCore MCP Reverse Connector on Amazon EKS
This project deploys a minimal MCP-compatible Python tool server on Amazon EKS. The pod opens an outbound secure WebSocket connection to AGENTCORE_GATEWAY_ENDPOINT and authenticates with AGENTCORE_AUTH_TOKEN.
The connector implements the MCP JSON-RPC methods required for tool discovery and invocation:
initializetools/listtools/callping
It exposes two tools:
get_system_infoecho_data
Architecture Note
Amazon Bedrock AgentCore Gateway documentation describes Gateway as an MCP endpoint for agents and as a service that can invoke configured targets such as Lambda, OpenAPI, Smithy, and remote MCP server endpoints. A reverse dial-out WebSocket connector requires your AgentCore Gateway endpoint, relay, or fronting service to support a persistent outbound WebSocket contract.
This implementation assumes that contract exists and that the gateway sends MCP JSON-RPC request messages over the WebSocket. If your Gateway is configured for a standard MCP server target instead, expose this server through a normal MCP HTTP/SSE endpoint or put it behind an internal/external load balancer and register that endpoint with AgentCore.
Project Tree
agentcore-mcp-eks/
├── .dockerignore
├── .gitignore
├── Dockerfile
├── Makefile
├── README.md
├── k8s/
│ ├── base/
│ │ ├── configmap.yaml
│ │ ├── deployment.yaml
│ │ ├── hpa.yaml
│ │ ├── kustomization.yaml
│ │ ├── namespace.yaml
│ │ ├── networkpolicy.yaml
│ │ ├── pdb.yaml
│ │ ├── service.yaml
│ │ └── serviceaccount.yaml
│ └── examples/
│ └── secret.example.yaml
├── requirements.txt
└── src/
├── pyproject.toml
└── agentcore_mcp_server/
├── __init__.py
├── __main__.py
├── config.py
├── connector.py
├── health.py
├── protocol.py
└── tools.py
Prerequisites
- An existing Amazon EKS cluster with worker nodes that can egress to the AgentCore Gateway endpoint over TCP 443.
awsCLI configured for the target AWS account.kubectlconfigured for the EKS cluster.- Docker or another OCI-compatible image builder.
- Terraform or your preferred IaC workflow if you still need to create EKS.
- A container registry, for example Amazon ECR or GitHub Container Registry.
- Kubernetes Metrics Server if you want the HPA to scale on CPU metrics.
- Known values for:
AGENTCORE_GATEWAY_ENDPOINTAGENTCORE_AUTH_TOKEN
Build and Publish
Set your image name:
cd agentcore-mcp-eks
export IMAGE="123456789012.dkr.ecr.us-east-1.amazonaws.com/agentcore-mcp-server"
export TAG="0.1.0"
Build and push:
docker build -t "${IMAGE}:${TAG}" .
docker push "${IMAGE}:${TAG}"
Update the Deployment image in k8s/base/deployment.yaml or use Kustomize:
kubectl kustomize k8s/base
Configure Kubernetes
Create the namespace first so the Secret can be created safely:
kubectl apply -f k8s/base/namespace.yaml
Create the auth token secret without storing a real token in Git:
kubectl -n mcp-system create secret generic agentcore-mcp-secret \
--from-literal=AGENTCORE_AUTH_TOKEN='replace-with-real-token'
Set the gateway endpoint by editing k8s/base/configmap.yaml:
data:
AGENTCORE_GATEWAY_ENDPOINT: "wss://gateway.example.com/mcp/reverse"
MCP_SERVER_NAME: "eks-agentcore-mcp"
If you want to use the example Secret manifest instead, copy k8s/examples/secret.example.yaml, replace the placeholder, and apply it from a secure private location.
Deploy
Apply the manifests:
kubectl apply -k k8s/base
Check rollout:
kubectl -n mcp-system rollout status deployment/agentcore-mcp-server
kubectl -n mcp-system get pods -l app.kubernetes.io/name=agentcore-mcp-server
Tail logs:
kubectl -n mcp-system logs deployment/agentcore-mcp-server -f
Operational Checks
Port-forward the internal service for health checks:
kubectl -n mcp-system port-forward svc/agentcore-mcp-server 8080:8080
curl -fsS http://127.0.0.1:8080/healthz
curl -fsS http://127.0.0.1:8080/readyz
Expected behavior:
/healthzreturns200when the process is running./readyzreturns200only after the WebSocket connection to the gateway is established.
Troubleshooting Gateway Connectivity
Check pod environment wiring without printing the token:
kubectl -n mcp-system describe pod -l app.kubernetes.io/name=agentcore-mcp-server
Look for connector log messages:
kubectl -n mcp-system logs deployment/agentcore-mcp-server --tail=200
Common issues:
AGENTCORE_GATEWAY_ENDPOINT is required: the ConfigMap is missing or the key is misspelled.AGENTCORE_AUTH_TOKEN is required: the Secret is missing or the key is misspelled.- Repeated connect failures: verify the endpoint starts with
wss://, DNS resolves from inside the cluster, and node security groups/NACLs permit egress to TCP 443. - Authentication failures: rotate the Secret and restart the Deployment with
kubectl -n mcp-system rollout restart deployment/agentcore-mcp-server. - Readiness never becomes healthy: confirm the gateway supports the reverse WebSocket connector contract and accepts MCP JSON-RPC messages over the socket.
- NetworkPolicy blocks traffic: start by applying the Deployment without
networkpolicy.yaml, confirm connectivity, then reapply and tighten egress for your CNI.
Run an in-cluster DNS/connectivity test:
kubectl -n mcp-system run netcheck --rm -it --restart=Never \
--image=curlimages/curl:8.10.1 -- sh
Then inside the shell:
nslookup gateway.example.com
curl -vk https://gateway.example.com/
Security Notes
- Do not commit real tokens. Use Kubernetes Secrets, External Secrets Operator, AWS Secrets Manager, or Sealed Secrets.
- The container runs as a non-root user with a read-only root filesystem and dropped Linux capabilities.
- The default Service is
ClusterIP; there is no public inbound endpoint because the server dials out. - The example NetworkPolicy allows DNS and outbound HTTPS. For strict FQDN egress controls, use a CNI that supports FQDN policies such as Cilium or Calico Enterprise and restrict access to the exact AgentCore Gateway hostname.
- Tool input schemas are fully inlined and do not use JSON Schema
$refor$defs.
References
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。