Remote MCP Server on Kubernetes (Amazon EKS)
A containerized MCP (Model Context Protocol) server using FastMCP that provides a simple calculator tool for adding two numbers. This MCP server runs on Amazon EKS. The highlevel diagram of this project below:
Files
server.py
- FastMCP server with add_numbers toolrequirements.txt
- Python dependenciesDockerfile
- Container definitionk8s-deployment.yaml
- Kubernetes deployment and LoadBalancer servicetest_mcp_client.py
- Test Remote MCP Server
Building the Container
Running Locally
The server will be available at http://localhost:8000
Push to repo
You can push this image to either Dockerhub or an ECR repo
Deploying to Amazon EKS
Prerequisites
- AWS CLI configured with appropriate permissions
- kubectl installed
- Docker installed and running
EKS Cluster
You can use an existing EKS cluster or create a new one, it's upto you. Ensure that your terminal has access to run Kubectl on it
Deployment Steps
IMPORTANT: Change the container image to the repo URI in k8s-deployment.yaml file
- Deploy MCP Server container to EKS:
- Get the LoadBalancer external IP:
Testing the MCP Server
The server provides one tool:
add_numbers(a: float, b: float) -> float
- Adds two numbers together
Testing with curl
The MCP server is currently deployed and accessible at:
Complete curl Test Workflow
Step 1: Initialize MCP Session and Get Session ID
Step 2: Send Initialization Notification (Required by MCP Protocol)
Step 3: List Available Tools (Optional)
Expected Result:
Step 4: Call the add_numbers Tool
Expected Result:
Testing with Python client
Replace the URL in the test_mcp_client.py, and execute it. This will act as MCP client and test the MCP server
Important Notes
- Session Timeout: Sessions expire after ~30-60 seconds due to FastMCP framework limitations
- Rapid Execution: Execute all steps quickly or use the one-liner command
- MCP Protocol: The
notifications/initialized
step is required by the MCP protocol after initialization
Cleanup
To remove from Kubernetes:
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A containerized MCP server deployed on Amazon EKS that provides a simple calculator tool for adding two numbers. Demonstrates how to deploy and scale MCP servers in a Kubernetes environment with proper session management and HTTP endpoints.
Related MCP Servers
- AsecurityFlicenseAqualityA simple and extendable MCP server that currently provides basic addition functionality and can be easily extended by defining new tools with docstrings.Last updated -4Python
- -securityFlicense-qualityA server that provides basic mathematical operations (addition, subtraction, multiplication, division, power, square root) through MCP tools for use with AI assistants like Claude.Last updated -Python
- -securityFlicense-qualityA containerized MCP (Model Context Protocol) server that provides a simple calculator tool for adding two numbers, deployable to Kubernetes/EKS environments.Last updated -4Python
- -securityFlicense-qualityA simple calculator MCP server that provides basic arithmetic functions (add and subtract) through HTTP transport, designed to be cloud-ready and easily deployable.Last updated -Python