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
docker build -t mcp-calculator:latest .
Running Locally
# Run the container locally
docker run -p 8000:8000 mcp-calculator:latest
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:
# Deploy the application
kubectl apply -f k8s-deployment.yaml
# Check deployment status
kubectl rollout status deployment/mcp-calculator
# Get service information
kubectl get services mcp-calculator-service
- Get the LoadBalancer external IP:
kubectl get services mcp-calculator-service -w
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:
http://<insert loadbalancer url>/mcp/
Complete curl Test Workflow
Step 1: Initialize MCP Session and Get Session ID
SESSION_ID=$(curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{"roots":{"listChanged":true},"sampling":{}},"clientInfo":{"name":"curl-test","version":"1.0.0"}}}' \
http://<insert loadbalancer url>/mcp/ \
-D /dev/stderr 2>&1 | grep "mcp-session-id:" | cut -d' ' -f2 | tr -d '\r')
echo "Session ID: $SESSION_ID"
Step 2: Send Initialization Notification (Required by MCP Protocol)
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "mcp-session-id: $SESSION_ID" \
-d '{"jsonrpc":"2.0","method":"notifications/initialized"}' \
http://<insert loadbalancer url>/mcp/
Step 3: List Available Tools (Optional)
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "mcp-session-id: $SESSION_ID" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \
http://<insert loadbalancer url>/mcp/
Expected Result:
event: message
data: {"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"add_numbers","description":"Add two numbers together.\n\nArgs:\n a: First number to add\n b: Second number to add\n \nReturns:\n The sum of a and b","inputSchema":{"type":"object","properties":{"a":{"type":"number"},"b":{"type":"number"}},"required":["a","b"]}}]}}
Step 4: Call the add_numbers Tool
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "mcp-session-id: $SESSION_ID" \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"add_numbers","arguments":{"a":15.5,"b":24.3}}}' \
http://<insert loadbalancer url>/mcp/
Expected Result:
event: message
data: {"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"39.8"}],"structuredContent":{"result":39.8},"isError":false}}
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/initializedstep is required by the MCP protocol after initialization
Cleanup
To remove from Kubernetes:
kubectl delete -f k8s-deployment.yaml
Metadata
Release files for iflow-mcp_saha-rajdeep-remote-mcp-server 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iflow_mcp_saha_rajdeep_remote_mcp_server-0.1.0.tar.gz | 279.4 kB | Without provenance | Details for iflow_mcp_saha_rajdeep_remote_mcp_server-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iflow_mcp_saha_rajdeep_remote_mcp_server-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for iflow_mcp_saha_rajdeep_remote_mcp_server-0.1.0-py3-none-any.whl |
Total release size: 563.5 kB
Release files / iflow_mcp_saha_rajdeep_remote_mcp_server-0.1.0.tar.gz
| Download URL | iflow_mcp_saha_rajdeep_remote_mcp_server-0.1.0.tar.gz |
|---|---|
| Size | 279.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9e38929101e2e3c26cc45065c2565e2a17517db8739d389f5372ea144d1ac7c
|
|
BLAKE2b-256 checksum How to use checksums |
0a5ddb5237da46ec5b6587fd85da968bd2a59cad9db92918710ef3e541a88689
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / iflow_mcp_saha_rajdeep_remote_mcp_server-0.1.0-py3-none-any.whl
| Download URL | iflow_mcp_saha_rajdeep_remote_mcp_server-0.1.0-py3-none-any.whl |
|---|---|
| Size | 284.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c4d933ffbf4c5450fa1a3c78139844c232c76867dcb5fe48784d3f02014963c3
|
|
BLAKE2b-256 checksum How to use checksums |
193ec812dd8384678eb276d9589a37145539e0787662577d6d2226c548a02ee7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for iflow-mcp_saha-rajdeep-remote-mcp-server 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.