Skip to content

Repository files navigation

MCP Assignment 2

Python-based Model Context Protocol (MCP) project for CPAN 372.

Overview

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 resources
  • server2_weather.py - weather MCP server with 3 tools
  • client.py - stdio client for the movie server
  • client_ec2.py - SSE client for the deployed server
  • strategies_compare.py - compares MCP tool-selection strategies
  • strategy1_connect_selectively.py
  • strategy2_prefilter.py
  • strategy3_two_stage_llm.py

Requirements

  • Python 3.12+
  • MCP, FastMCP, OpenAI, Requests, python-dotenv

Install dependencies:

pip install -r requirements.txt

Setup

Create a .env file with:

OPENAI_API_KEY=your_key_here

Run

Movie server:

python server1_movies.py

Weather server:

python server2_weather.py

Local MCP client:

python client.py

EC2 SSE client:

python client_ec2.py

Strategy comparison:

python strategies_compare.py

Assignment Notes

  • 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

Project Domain

The main demo domain is movies. The server exposes movie search, recommendation, rating comparison, and resource-based movie lookups.

License

MIT License. See LICENSE.

About

Python MCP project with FastMCP servers, stdio/SSE clients, tool discovery, and LLM-based tool selection for movie and weather workflows.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages