About MCP Client
MCP Client is a Python chat client for connecting to MCP servers, aimed at users who want to query server tools through natural language. It uses Anthropic's Claude API and includes a weather server example with forecasts and US alerts.
Key features
- 01Interactive MCP chat client
- 02Connect to compatible server scripts
- 03Claude API natural-language queries
- 04Example weather alerts and forecasts
Use cases
- 01Ask for a location-based weather forecast
- 02Check US weather alerts by state
MCP support
Connects to an MCP server script, discovers its tools and lets the chat client use them to handle natural-language queries.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEMCP Client
A Python client for interacting with MCP servers, featuring a weather tool server as an example. The client uses Anthropic's Claude API for natural language queries and can connect to any compatible MCP server script.
Features
- Interactive chat client for MCP servers
- Example weather server (
server/weather.py) with:- US state weather alerts
- Location-based weather forecasts (via NWS API)
- Extensible: connect to any MCP-compatible server script
- Uses Anthropic Claude API for natural language understanding
Requirements
- Python 3.12+
- Anthropic API key
- MCP Python package (
mcp>=1.9.2) - uv (for running with isolated environments, optional but recommended)
Installation
-
Clone the repository:
git clone <your-repo-url> cd mcp-client -
Install dependencies:
uv pip install -r requirements.txtOr, if you use
uvandpyproject.toml:uv pip install -
Set up your Anthropic API key:
- Create a
.envfile in the project root:ANTHROPIC_API_KEY=your-anthropic-api-key-here - The
.envfile is in.gitignoreand will be loaded automatically.
- Create a
Usage
Start the Weather Server
The example weather server is located at server/weather.py. It provides two tools: get_alerts and get_forecast.
Run the Client
You can connect the client to the weather server using:
uv run client.py ./server/weather.py
Or, if you prefer plain Python:
python client.py ./server/weather.py
You should see output like:
Connected to server with tools: ['get_alerts', 'get_forecast']
MCP Client Started!
Type your queries or 'quit' to exit.
Example Queries
What is the weather in New York?Are there any weather alerts for CA?Give me the forecast for latitude 40.7, longitude -74.0
Exiting
Type quit to exit the chat loop.
Project Structure
.
├── client.py # Main MCP client
├── server/
│ └── weather.py # Example weather MCP server
├── pyproject.toml # Project metadata and dependencies
├── .env # (Not committed) Your API keys
├── .gitignore
└── README.md
Development
- The client loads environment variables from
.envusingpython-dotenv. - The weather server uses the US National Weather Service API and requires internet access.
Troubleshooting
- Anthropic API errors:
Ensure your API key is valid and has sufficient credits. - Python version:
The project requires Python 3.12 or newer. - Network issues:
The weather server needs to reachhttps://api.weather.gov.
License
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.