MCP logo

MCP

by edonyzpc

MCP provides personal servers and clients for interacting with Large Language Models (LLMs). It includes example weather server and client implementations.

View on GitHub

Last updated: N/A

MCP

Personal MCP Servers and Clients for LLM

Setup

  1. init the project with uv
uv init --python=3.10 .
touch .gitignore .env
cat << EOF >> .gitignore
.env
.venv/
__pycache__/
EOF
  1. init python virtual environment
uv venv
source .venv/bin/activate
  1. install dependencies
uv add dashscope httpx mcp python-dotenv langchain langchain-core langchain-mcp-adapters langchain-community langgraph

MCP Server

MCP Server Weather

This is the MCP server for the Weather service to get US weather data.

Project
# Create a new directory for our project
mkdir -p servers/weather-server-mcp

# Create virtual environment and activate it
uv venv
source .venv/bin/activate

# Create our server file
cd servers/weather-server-mcp
touch weather.py
Run
  1. Copy the server configuration file from the MCP Host, e.g. OpenCat
  2. Select the tool of this MCP server(weather)
  3. Chat in the Host, e.g. OpenCat

MCP Client

MCP Client for Weather Server

This is the MCP client for the Weather service to get US weather data.

Project
# Create project directory
mkdir -p clients/mcp-client

# Create virtual environment
uv venv
# Activate virtual environment
source .venv/bin/activate

# Create our main file
cd clients/mcp-client
touch clients/mcp-client/client.py
Run
# to run the client which is connected to the weather mcp server
uv run ./clients/mcp-client/client.py ./servers/weather-server-mcp/weather.py

Inspect MCP Server

npx @modelcontextprotocol/inspector \
  uv \
  --directory servers/weather-server-mcp \
  run \
  weather.py