ofirzvishaboo/mcp_server
If you are the rightful owner of mcp_server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This project demonstrates how to run an MCP (Model Control Protocol) server using Docker, featuring a simple calculator tool accessible by a client.
MCP Server with Docker
This project demonstrates how to run an MCP (Model Control Protocol) server using Docker. The server provides a simple calculator tool that can be accessed by a client.
Prerequisites
- Docker installed on your system
- Git (to clone the repository)
Project Structure
server.py
: The MCP server implementation with a simple calculator toolclient.py
: A client that connects to the server and calls the calculator toolDockerfile
: Instructions for building the Docker imagerequirements.txt
: Python dependencies for the project
Running with Docker
Step 1: Build the Docker image
docker build -t mcp-server .
Step 2: Run the Docker container
docker run -p 8050:8050 mcp-server
This will start the MCP server inside a Docker container and expose it on port 8050.
Running the Client
Once the server is running, you can run the client in a separate terminal:
python client.py
The client will connect to the server, list available tools, and call the calculator tool to add 2 and 3.
Troubleshooting
If you encounter connection issues:
-
Check if the server is running: Make sure the Docker container is running with
docker ps
. -
Verify port mapping: Ensure the port is correctly mapped with
docker ps
or by checking the output of thedocker run
command. -
Check server logs: View the server logs with
docker logs <container_id>
to see if there are any errors. -
Host binding: The server is configured to bind to
0.0.0.0
instead of127.0.0.1
to make it accessible from outside the container. If you're still having issues, you might need to check your firewall settings. -
Network issues: If you're running Docker on a remote machine, make sure the port is accessible from your client machine.
Notes
- The server is configured to use SSE (Server-Sent Events) transport and listens on port 8050.
- The client connects to the server at
http://localhost:8050/sse
. - Make sure the server is running before starting the client.