Skip to main content
Glama
README.md
# EDUwise MCP Server

An **MCP (Model Context Protocol)** server that acts as the AI integration layer for [EDUwise](https://github.com/your-username/eduwise) — an AI-powered Learning Management System for secondary schools.

It exposes student performance data, class analytics, quiz generation, personalised recommendations, and content search to any MCP-compatible AI host (Claude Desktop, Claude Code, or any custom MCP client).

---

## Architecture

```
┌─────────────────────────────────────┐
│           MCP Host / Client         │
│  (Claude Desktop · Claude Code ·    │
│   MCP Inspector · Custom agent)     │
└───────────────┬─────────────────────┘
                │  MCP Protocol (stdio / SSE)
                ▼
┌─────────────────────────────────────┐
│       EDUwise MCP Server            │
│  ┌──────────┐  ┌────────────────┐   │
│  │  Tools   │  │   Resources    │   │
│  │ students │  │ dashboard/     │   │
│  │analytics │  │   overview     │   │
│  │ quizzes  │  └────────────────┘   │
│  │  recs    │  ┌────────────────┐   │
│  │ content  │  │    Prompts     │   │
│  └──────────┘  │ student_report │   │
│                │  parent_email  │   │
│                └────────────────┘   │
└───────────────┬─────────────────────┘
                │  HTTP / REST
                ▼
┌─────────────────────────────────────┐
│       EDUwise FastAPI Backend       │
│  ┌──────────┐  ┌──────────────────┐ │
│  │PostgreSQL│  │      Redis       │ │
│  └──────────┘  └──────────────────┘ │
│  ┌──────────┐  ┌──────────────────┐ │
│  │  MinIO   │  │ scikit-learn ML  │ │
│  └──────────┘  └──────────────────┘ │
│  ┌──────────────────────────────┐   │
│  │  Claude Haiku (quiz gen /    │   │
│  │  AI tutoring via Anthropic)  │   │
│  └──────────────────────────────┘   │
└─────────────────────────────────────┘
```

---

## Tools

| Tool | Description |
|------|-------------|
| `get_student_performance` | Grades, attendance, ML-predicted performance level, at-risk flag, and confidence score for a student |
| `search_students` | Fuzzy name / ID search against the student roster |
| `get_class_analytics` | Aggregated metrics for a class: average, median, grade distribution, top/bottom performers |
| `get_subject_analytics` | Cross-class analytics for a subject — school average, per-class breakdown |
| `generate_quiz` | AI quiz generation (Claude Haiku) with configurable subject, topic, difficulty, and question type |
| `list_quizzes` | List quizzes with optional filters for class, subject, and status |
| `get_quiz_results` | Statistics and per-question accuracy for a completed quiz |
| `get_recommendations` | Personalised learning resources, weak topics, and teaching strategies via collaborative filtering |
| `search_content` | Full-text search across lessons, assignments, and resources |
| `get_lesson` | Full lesson details including objectives, body content, and attached materials |

---

## Resources

| URI | Description |
|-----|-------------|
| `eduwise://dashboard/overview` | Live school-wide dashboard: total students, teachers, classes, overall average, today's attendance, and at-risk count |

---

## Prompts

| Prompt | Args | Description |
|--------|------|-------------|
| `student_report_prompt` | `student_id`, `term` | Instructs the AI to call performance + recommendations tools and compose a formal student progress report |
| `parent_email_prompt` | `student_id`, `term` | Instructs the AI to draft a professional parent/guardian email about student progress |

---

## Setup

### Prerequisites

- Python 3.11+
- A running EDUwise FastAPI backend
- [`uv`](https://docs.astral.sh/uv/) (recommended) or `pip`

### Install with uv (recommended)

```bash
git clone https://github.com/your-username/eduwise-mcp-server.git
cd eduwise-mcp-server

uv venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
uv pip install -e .
```

### Install with pip

```bash
pip install -e .
```

### Install dev dependencies (for testing)

```bash
uv pip install -e ".[dev]"
# or
pip install -e ".[dev]"
```

### Configure environment variables

```bash
cp .env.example .env
```

Edit `.env`:

```env
EDUWISE_API_URL=https://api.your-school.eduwise.app
EDUWISE_API_TOKEN=your-secret-api-token
EDUWISE_API_TIMEOUT=30
```

| Variable | Default | Description |
|----------|---------|-------------|
| `EDUWISE_API_URL` | `http://localhost:8000` | Base URL of the EDUwise FastAPI backend |
| `EDUWISE_API_TOKEN` | *(empty)* | Bearer token for API authentication |
| `EDUWISE_API_TIMEOUT` | `30` | Request timeout in seconds |

---

## Running the Server

```bash
# Using the installed script
eduwise-mcp

# Or directly with Python
python -m eduwise_mcp

# Or run the server module
python src/eduwise_mcp/server.py
```

---

## Connecting to Claude Desktop

Add the following to your Claude Desktop configuration file.

**macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
**Windows:** `%APPDATA%\Claude\claude_desktop_config.json`

```json
{
  "mcpServers": {
    "eduwise": {
      "command": "python",
      "args": ["-m", "eduwise_mcp"],
      "cwd": "/absolute/path/to/eduwise-mcp-server",
      "env": {
        "EDUWISE_API_URL": "https://api.your-school.eduwise.app",
        "EDUWISE_API_TOKEN": "your-secret-api-token"
      }
    }
  }
}
```

Restart Claude Desktop. The EDUwise tools will appear automatically.

---

## Connecting to Claude Code

```bash
claude mcp add eduwise python -m eduwise_mcp \
  --cwd /absolute/path/to/eduwise-mcp-server \
  --env EDUWISE_API_URL=https://api.your-school.eduwise.app \
  --env EDUWISE_API_TOKEN=your-secret-api-token
```

---

## Testing with MCP Inspector

```bash
mcp dev src/eduwise_mcp/server.py
```

This opens the interactive MCP Inspector in your browser where you can invoke tools, read resources, and render prompt templates against a live (or mocked) backend.

---

## Running Tests

```bash
pytest
```

Tests use `respx` to mock the EDUwise API — no live backend is required.

```bash
# Run with coverage
pytest --cov=src/eduwise_mcp --cov-report=term-missing
```

---

## Tech Stack

| Layer | Technology |
|-------|-----------|
| MCP Framework | `mcp[cli]` with `FastMCP` |
| HTTP Client | `httpx` (async) |
| Configuration | `pydantic-settings` |
| Package Manager | `uv` |
| Testing | `pytest`, `pytest-asyncio`, `respx` |
| Python | 3.11+ |

---

## Roadmap

- [ ] **WebSocket support** — subscribe to live quiz events streamed from the EDUwise backend
- [ ] **Bulk analytics tool** — fetch analytics for multiple classes or subjects in a single call
- [ ] **Assignment grading tool** — trigger AI-assisted short-answer grading via the backend
- [ ] **Attendance tools** — mark, retrieve, and report on student attendance records
- [ ] **Notification tool** — send in-app notifications to teachers and students
- [ ] **OAuth 2.0 support** — replace static bearer tokens with scoped OAuth tokens
- [ ] **Streaming responses** — stream long AI-generated quiz or report content as it is produced
- [ ] **Docker image** — official `ghcr.io/your-username/eduwise-mcp-server` image for easy deployment