mcp-example

This repository provides an example of using the Model Context Protocol with a single tool, resource, and prompt, showcasing installation and usage of both the MCP server and client for interaction.

1
0

Model Context Protocol Example

This example illustrates the usage of the Model Context Protocol (MCP) with a simplified setup involving a single tool, resource, and prompt.

Installation

To set up the environment:

pip install uv
uv init
uv venv

.venv\Scripts\activate # Windows
source .venv/bin/activate # Mac/Linux

uv add mcp[cli] # Option-1
# or
uv add -r requirements.txt # Option-2

This involves installing uv, initializing a virtual environment, activating it, and then installing the mcp[cli] package or packages from requirements.txt.

Usage

Diagram

MCP Server

To start the MCP server:

# Server
mcp dev server.py

# Need to install the following packages:
# @modelcontextprotocol/[email protected]
# Ok to proceed? (y) y

The MCP server can be accessed via the inspector at http://localhost:5173/ after installing the @modelcontextprotocol/inspector package.

MCP Host (Client)

The client.py file is used to interact with the MCP server.

python client.py

Repository

BU
buraketmen

buraketmen/mcp-example

Created

February 26, 2025

Updated

March 23, 2025

Language

Python

Category

AI