mcp_server_and_client

mcp_server_and_client

3.3

This project provides a minimal working example of the Model Context Protocol (MCP), demonstrating how to set up a FastMCP server with basic tools and interact with it using an MCP client.

MCP Server and Client

This project provides a minimal working example of the Model Context Protocol (MCP), demonstrating how to set up a FastMCP server with basic tools and interact with it using an MCP client. It serves as a simple reference for understanding how MCP-based communication between agents and tools can be implemented.


Setup Instructions

1. Install uv

	python -m pip install uv

2. Initialize the Project and activate the env

	uv init mcp_server_for_llm_agents

	uv venv

	source .venv/bin/activate

3. Install dependencies

	uv pip install -r requirements.txt

Server

Agent tools (e.g., summarize_text, code executin, etc.) should be implemented in server.py Run the server with:

	uv run mcp dev server.py

Or directly:

	python server.py

Client

A client using the official MCP SDK is defined in client.py

Run using:

	python client.py

It connects to the MCP server and calls tools like: summarize_text, cat_fact, execute_code present from server.py

After running we can see results in terminal for now


References: