Mcp-simple-client-server

Kamwebdev/Mcp-simple-client-server

3.2

If you are the rightful owner of Mcp-simple-client-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 dayong@mcphub.com.

mcp-simple-client-server is a minimal working example of the Model Context Protocol (MCP).

Mcp-simple-client-server

Overview

mcp-simple-client-server is a minimal working example of the Model Context Protocol (MCP) — showing how to:

  • register tools on an MCP server,
  • expose them to an LLM (Ollama, OpenAI-compatible),
  • let the model call these tools dynamically,
  • return results back into the conversation loop.

The project is intentionally simple and clean, making it an ideal starting point for building your own MCP-powered automations, assistants and local AI integrations.

Tutorial [PL]

All code and content are authored by me.

Available Parts

Install:

python -m venv .venv
.venv\Scripts\activate.bat
pip3 install -r requirements.txt

Run:

MCP Server

To start the mcp server, execute:

cd server
python mcp_server.py
How It Works
  1. The server starts a FastMCP instance and registers all available tools.
  2. FastMCP automatically exposes the tools over HTTP at /mcp.
  3. The client (or LLM) can now remotely execute these tools through function calling.
Sample output:

Client

To run our mcp server client, execute in the second terminal

cd client
cp .env_dist .env
python client.py
Sample outputs:
How It Works
  1. The client connects to the MCP server.
  2. It fetches registered tools.
  3. Tools are forwarded to the LLM (via Ollama function calling).
  4. The LLM may: answer normally or request tool execution.
  5. The tool runs on the MCP server.
  6. The result is returned to the LLM.
  7. Loop continues until the model stops calling tools.