Skip to main content
Glama
subh812

KLH Campus Assistant

by subh812
README.md
# KLH Campus Assistant — MCP Demo

A Model Context Protocol (MCP) server for KLH University Hyderabad, built with
FastMCP. It exposes 7 tools (CGPA calculator, schedule-conflict checker,
study-group finder, course search, club finder, exam schedule, library
lookup) and 2 resources (campus FAQ, curriculum requirements) over local
stdio — no deployment, no network service, just Python.

## Files

- [`server.py`](server.py) — the MCP server. Run directly with `python server.py` (it will idle waiting for a client — that's expected).
- [`client.py`](client.py) — a terminal demo that connects to the server and drives a scripted conversation through Claude.
- [`web/app.py`](web/app.py) + [`web/index.html`](web/index.html) — a small FastAPI + browser chat UI for a live, on-screen demo.
- [`requirements.txt`](requirements.txt) — all dependencies for server, CLI client, and web demo.

## Setup & Running the Demo

### Requirements
- **Python 3.10+** (project written for Python 3.14)
- An Anthropic API key (get one at https://console.anthropic.com/keys)

### Step 1: Install Dependencies
Open a terminal in this folder and run:
```bash
pip install -r requirements.txt
```

### Step 2: Set Your API Key
You need to set your Anthropic API key as an environment variable:

**On macOS/Linux:**
```bash
export ANTHROPIC_API_KEY=sk-ant-...
```
(Replace `sk-ant-...` with your actual API key)

**On Windows (Command Prompt):**
```cmd
set ANTHROPIC_API_KEY=sk-ant-...
```

**On Windows (PowerShell):**
```powershell
$env:ANTHROPIC_API_KEY="sk-ant-..."
```

### Step 3: Run the Terminal Demo (Fastest)
Run this command to see the MCP server in action with a scripted demo:
```bash
python client.py
```
This will automatically start the MCP server and walk through several examples:
- CGPA calculation
- Schedule conflict checking
- Study group search
- Club search

### Step 4: Run the Interactive Web Chat (Recommended)
For a live, interactive demo with a visual UI:

```bash
# Navigate to the web folder
cd web

# Start the app (on Windows, use 'python -m uvicorn' instead)
uvicorn app:app --reload --port 8000
```

Then open your browser and go to **http://localhost:8000**

- Paste your API key into the page
- Chat with the assistant — every tool call appears as an expandable card
- Try queries like:
  - "What's my CGPA?" 
  - "Do I have any schedule conflicts?"
  - "Find study groups for Data Structures"
  - "List all clubs at KLH"

### Troubleshooting
- **ModuleNotFoundError:** Make sure you installed dependencies with `pip install -r requirements.txt`
- **API key errors:** Verify your API key is set correctly (it should start with `sk-ant-`)
- **Port 8000 already in use:** Try a different port: `uvicorn app:app --reload --port 8001`