MCP Client Example
by RGGH
This project demonstrates a simple client-server implementation using the Model Context Protocol (MCP), which is a standardized way to connect large language models with tools and data. It shows how to create an MCP server with custom tools and connect to it using an MCP client.
Last updated: N/A
What is MCP Client Example?
This is an example implementation of a client and server using the Model Context Protocol (MCP). The server exposes tools that can be called by the client.
How to use MCP Client Example?
To use this example, first install the prerequisites (Python 3.9+ and uv). Then, install the dependencies using uv install -e .
. Start the client by running uv run src/client/mcp_client.py
. The client will connect to the server, list available tools, and call the BMI calculator and weather tool with sample data.
Key features of MCP Client Example
MCP implementation
Custom tools
Client-server communication
BMI calculator tool
Weather data tool
Stdio transport
Use cases of MCP Client Example
Demonstrating MCP usage
Building custom tools for LLMs
Connecting LLMs to external data sources
Creating client-server applications with LLMs
Testing MCP Inspector
FAQ from MCP Client Example
What is MCP?
What is MCP?
MCP stands for Model Context Protocol, a standardized way to connect large language models with tools and data.
What are the prerequisites for running this example?
What are the prerequisites for running this example?
You need Python 3.9+ and uv (Python package manager) installed.
How do I install the dependencies?
How do I install the dependencies?
Run uv install -e .
in the project directory.
How do I start the client?
How do I start the client?
Run uv run src/client/mcp_client.py
in the project directory.
What tools does the server expose?
What tools does the server expose?
The server exposes two tools: calculate_bmi
and fetch_weather
.