MCP Server Practice
A practice project demonstrating how to build Model Context Protocol servers with Python, LangGraph, and Groq, featuring a math server via stdio and a weather server via streamable-http, enabling arithmetic operations and mock weather queries through an AI agent.
README
MCP Server Practice
A simple practice project demonstrating how to build and use Model Context Protocol (MCP) servers with Python, LangGraph, and Groq.
Overview
This project contains:
- A Math MCP Server using the
stdiotransport. - A Weather MCP Server using the
streamable-httptransport. - A LangGraph ReAct agent that connects to multiple MCP servers using
MultiServerMCPClient.
Project Structure
.
├── client.py
├── mathserver.py
├── weatherserver.py
├── .env
├── requirements.txt
└── README.md
Features
Math Server (stdio)
Provides the following tools:
add(a, b)multiply(a, b)
Weather Server (streamable-http)
Provides the following tool:
get_weather(location)
Currently returns a mock weather response.
Client
The client:
- Connects to multiple MCP servers.
- Automatically discovers available tools.
- Uses a Groq LLM with LangGraph's ReAct agent.
- Selects and invokes the appropriate tool based on the user's query.
Tech Stack
- Python
- MCP (Model Context Protocol)
- LangGraph
- LangChain MCP Adapters
- Groq
- python-dotenv
Installation
Clone the repository:
git clone https://github.com/shreenithi23/mcp-server-practice.git
cd mcp-server-practice
Create a virtual environment:
python -m venv .venv
Activate it:
macOS/Linux
source .venv/bin/activate
Windows
.venv\Scripts\activate
Install the required packages:
pip install -r requirements.txt
Environment Variables
Create a .env file:
GROQ_API_KEY=your_groq_api_key
Running the Project
1. Start the Weather Server
python weatherserver.py
The Math server is automatically launched by the client using the stdio transport.
2. Run the Client
python client.py
Example Queries
What's (3 + 5) x 12?
What's the weather in California?
Learning Objectives
This project demonstrates:
- Building MCP servers using
FastMCP - Exposing Python functions as MCP tools
- Using different MCP transports (
stdioandstreamable-http) - Connecting multiple MCP servers with
MultiServerMCPClient - Creating an AI agent with LangGraph's ReAct agent
- Integrating Groq LLMs with MCP
Notes
- The Weather server currently returns mock weather data.
- The Math server is started automatically by the client.
- Store API keys in a
.envfile. - Do not commit
.envto GitHub.
License
This project is intended for learning and experimentation with the Model Context Protocol (MCP).
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.