Python-based Model Context Protocol (MCP) project for CPAN 372.
This repo contains two MCP servers, stdio and SSE clients, and tool-selection experiments:
server1_movies.py- movie MCP server with 3 tools and 2 resourcesserver2_weather.py- weather MCP server with 3 toolsclient.py- stdio client for the movie serverclient_ec2.py- SSE client for the deployed serverstrategies_compare.py- compares MCP tool-selection strategiesstrategy1_connect_selectively.pystrategy2_prefilter.pystrategy3_two_stage_llm.py
- Python 3.12+
- MCP, FastMCP, OpenAI, Requests, python-dotenv
Install dependencies:
pip install -r requirements.txtCreate a .env file with:
OPENAI_API_KEY=your_key_hereMovie server:
python server1_movies.pyWeather server:
python server2_weather.pyLocal MCP client:
python client.pyEC2 SSE client:
python client_ec2.pyStrategy comparison:
python strategies_compare.py- Part 1: MCP server with typed tools and URI-template resources
- Part 2: stdio client with server initialization, tool discovery, and tool/resource calls
- Part 3: tool selection experiments
- Part 4: remote deployment via SSE
The main demo domain is movies. The server exposes movie search, recommendation, rating comparison, and resource-based movie lookups.
MIT License. See LICENSE.