Skip to content
3 changes: 3 additions & 0 deletions developers/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ This guide will help you understand and contribute to the Pawtograder project. L
<Card title="Local Setup" icon="laptop-code" href="/developers/local-setup">
Set up your development environment and run Pawtograder locally.
</Card>
<Card title="MCP Server & AI Assistance" icon="brain-circuit" href="/developers/mcp-server">
Model Context Protocol server for AI-powered student support.
</Card>
<Card title="Surveys" icon="clipboard-list" href="/developers/surveys">
Database schema, API, and implementation details for the survey system.
</Card>
Expand Down
27 changes: 27 additions & 0 deletions developers/local-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,33 @@ The dev server uses a self-signed certificate. This is expected:
```
2. Restart the dev server

## Cursor Agent Development Environment

Pawtograder includes a Cursor agent development environment setup that allows AI assistants to help with development tasks. This environment provides:

- Pre-configured development container settings
- Access to the codebase structure and conventions
- Integration with the local development environment

### Setup

The Cursor agent environment is automatically configured when you clone the repository. The configuration files are located in the `.cursor` directory and include:

- Development environment settings
- Code style and formatting rules
- Project-specific AI assistant guidelines

### Usage

When using Cursor or other AI-powered development tools, the agent will have access to:

- Project structure and file organization
- Database schema and migrations
- Component patterns and conventions
- Testing setup and examples

This helps AI assistants provide more accurate and context-aware suggestions when working on Pawtograder features.

## Next Steps

- Read the [Surveys Developer Guide](/developers/surveys) for feature-specific documentation
Expand Down
157 changes: 157 additions & 0 deletions developers/mcp-server.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
---
title: "MCP Server & AI Assistance"
description: "Model Context Protocol server for AI-powered student support and development assistance"
icon: "brain-circuit"
---

# MCP Server & AI Assistance

Pawtograder includes a Model Context Protocol (MCP) server that enables AI assistants to help instructors and TAs support students who are struggling with programming assignments.

## Overview

The MCP server provides AI assistants with secure, authenticated access to course data, allowing them to:

- Fetch help requests and discussion threads
- Access student submissions and test results
- Review build output and error messages
- Provide context-aware assistance to course staff

All access is controlled through Supabase OAuth authentication and restricted to instructors and graders only.

## Features

### Authentication & Security

- **Supabase OAuth**: Secure authentication using your Pawtograder account
- **Role-based access**: Only instructors and graders can use the MCP server
- **Privacy protection**: Never exposes sensitive user data or private profile information
- **Row-level security**: All database queries respect Supabase RLS policies

### Available Tools

The MCP server provides the following tools for AI assistants:

#### Help Request Tools
- **Fetch help requests**: Retrieve active and resolved help requests from office hours queues
- **Get discussion threads**: Access discussion board posts and replies
- **View chat history**: Read conversation history between students and staff

#### Assignment Tools
- **Fetch submissions**: Access student code submissions for specific assignments
- **Get test results**: Retrieve autograder test output and results
- **View build output**: Access compilation errors and build logs

#### Context Tools
- **Assignment handouts**: Access assignment descriptions and requirements via the `handout_url` field
- **Course information**: Retrieve course settings and configuration

### AI Help Button

Course staff can access AI assistance directly from:

- **Help request chat**: Click the "AI Help" button in the help request interface
- **Discussion threads**: Use AI assistance when responding to student questions

The AI Help button generates an MCP context URL that can be used with any MCP-compatible client (such as Claude Desktop, Cursor, or other AI development tools).

## Setup

### Local Development

When running Supabase locally, the MCP server is automatically available at:

```
http://127.0.0.1:54321/mcp
```

This URL is displayed in the output when you run `npx supabase start`.

### Configuration

The MCP server requires the following database schema additions:

#### Assignment Handout URL

Assignments can include a `handout_url` field that points to the assignment description or requirements document. This provides AI assistants with context about what students are working on:

```sql
ALTER TABLE assignments ADD COLUMN handout_url TEXT;
```

Update your assignments to include handout URLs:

```sql
UPDATE assignments
SET handout_url = 'https://example.com/assignments/hw1.pdf'
WHERE id = 'assignment-id';
```

## Usage

### For Course Staff

1. **Navigate to a help request or discussion thread** where you want AI assistance
2. **Click the "AI Help" button** in the interface
3. **Copy the generated MCP context URL**
4. **Paste the URL into your MCP-compatible AI client** (e.g., Claude Desktop)
5. **The AI assistant will have access to**:
- The student's question or help request
- Their code submission
- Test results and error messages
- Assignment requirements (if handout_url is configured)

### For Developers

The MCP server is implemented as a Supabase Edge Function and follows the Model Context Protocol specification. You can extend it by:

1. **Adding new tools**: Define additional MCP tools in the Edge Function
2. **Expanding data access**: Add new database queries (respecting RLS policies)
3. **Customizing context**: Modify what information is provided to AI assistants

## Privacy & Data Protection

The MCP server is designed with privacy in mind:

- **No user table access**: The server never queries the `users` table directly
- **No private profiles**: The `is_private_profile` flag is never exposed
- **Instructor/grader only**: Only authenticated course staff can access the MCP server
- **RLS enforcement**: All database queries respect row-level security policies
- **Audit logging**: MCP requests are logged for security and debugging

## MCP-Compatible Clients

The MCP server works with any client that supports the Model Context Protocol:

- **Claude Desktop**: Anthropic's desktop application with MCP support
- **Cursor**: AI-powered code editor with MCP integration
- **Custom clients**: Build your own MCP client using the protocol specification

## Troubleshooting

### MCP server not accessible

1. Verify Supabase is running: `npx supabase status`
2. Check that Edge Functions are running: `npx supabase functions serve`
3. Ensure you're authenticated as an instructor or grader

### AI assistant can't access data

1. Verify your account has instructor or grader role in the course
2. Check that RLS policies allow access to the requested data
3. Ensure the MCP context URL is correctly formatted

### Missing assignment context

1. Verify the assignment has a `handout_url` configured
2. Check that the URL is accessible to the AI assistant
3. Ensure the handout document is in a format the AI can read (PDF, Markdown, HTML)

## Future Enhancements

Planned improvements to the MCP server include:

- **Expanded tool set**: Additional tools for accessing course analytics and gradebook data
- **Real-time updates**: Support for streaming updates to AI assistants
- **Custom prompts**: Configurable system prompts for different types of assistance
- **Integration with autograder**: Direct access to test case details and grading rubrics
2 changes: 1 addition & 1 deletion docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
},
{
"group": "Feature Documentation",
"pages": ["developers/surveys", "developers/polls"]
"pages": ["developers/surveys", "developers/polls", "developers/mcp-server"]
}
]
}
Expand Down
23 changes: 23 additions & 0 deletions staff/assignments/autograding.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,29 @@ The autograder system uses an "overlay grader" architecture that allows flexible

*Detailed documentation coming soon.*

## Submission File Support

Pawtograder supports both text and binary files in student submissions:

### Text Files
Text files (code, markdown, configuration files, etc.) are displayed with syntax highlighting in the submission viewer. Students and graders can view the file contents directly in the browser.

### Binary Files
Binary files (images, PDFs, compiled executables, etc.) are supported in submissions. These files:
- Are stored securely in the submission
- Can be downloaded by students and graders
- Display a download button in the file viewer
- Show file metadata (name, size, type)

### Markdown Preview
Markdown files (`.md`, `.markdown`) in submissions are automatically rendered with a live preview. This allows students and graders to see formatted documentation, README files, and written responses without needing to download the file.

The markdown preview supports:
- Standard markdown syntax (headings, lists, links, code blocks)
- Inline code and code blocks with syntax highlighting
- Images and links
- Tables and blockquotes

## Quickstart: Java and Python

Build system integration guides for common programming languages.
Expand Down
10 changes: 10 additions & 0 deletions staff/assignments/handgrading.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ Instructors can define multiple handgrading rubrics for each assignment, althoug

Once all required rubric checks are done, the grader can click the "Complete Review" button to confirm that they have completed grading. This does **not** release the review to the student, but indicates to the instructor that it **could** be released (at the instructor's discretion).

## Editing Scores After Completing a Review

TAs can edit or delete rubric scores even after marking a review as complete. This allows you to:

- Correct scoring mistakes discovered after completing the review
- Adjust scores based on regrade requests or instructor feedback
- Update comments or feedback without needing to "uncomplete" the review

Simply navigate back to the submission and make your changes. The review will remain marked as complete, but the updated scores will be reflected immediately.

## Grading Submissions That You Have Been Assigned

When you have submissions assigned to grade, you will see a summary of them on the assignment's landing page.
Expand Down
35 changes: 35 additions & 0 deletions staff/office-hours/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ Pawtograder's office hours feature allows students to request live help from cou

Students are encouraged to make public requests for help, so that other students can also benefit from the discussion.

## Student Experience

Students can access office hours through a persistent **Get Help** button that appears in the bottom-right corner of every page. This button opens a help drawer showing:

- Current office hours status
- Active queues accepting requests
- Weekly queue schedule with live "Happening now" highlights
- Quick access to submit new requests

Students receive notifications through multiple channels (browser notifications, title updates, sound alerts, and favicon badges) to stay informed about their help request status even while browsing other course pages.

## Office Hours Queues

Instructors can create multiple office hours queues to provide different types of help. For example, if a class is coordinated across multiple campuses, there may be in-person help queues per-campus, and a cross-network virtual help queue.
Expand Down Expand Up @@ -55,6 +66,20 @@ Staff can communicate with students through:

After the staff member has started the video chat, students can click the **Join Video Chat** button to join. The video chat window opens in a popup.

### AI Assistance

Instructors and graders can access AI-powered assistance when helping students:

- **AI Help Button**: Available in help request chats and discussion threads
- **Context-aware support**: AI assistants have access to student submissions, test results, and error messages
- **Assignment context**: Provide assignment handout URLs to give AI assistants full context about the task

Click the **AI Help** button to generate an MCP context URL that can be used with AI assistants like Claude Desktop or Cursor. The AI will have access to all relevant information about the student's question and code.

<Tip>
For more details on setting up and using AI assistance, see the [MCP Server & AI Assistance](/developers/mcp-server) developer documentation.
</Tip>

### Active Help Request Widget

When a student has an active help request, it follows them around the site. They'll see:
Expand All @@ -69,6 +94,16 @@ This ensures students never miss updates, even while browsing the discussion boa

A help request can be marked as "Resolved" by either a staff member or a student.

When students resolve their own requests, they are prompted to select a resolution status:

- **Resolved - Question Answered**: Their question was fully answered
- **Resolved - Problem Solved**: Their technical issue was fixed
- **Resolved - Referred Elsewhere**: They were directed to other resources
- **Resolved - No Longer Needed**: They no longer need help with this issue
- **Resolved - Other**: The request was resolved for another reason

This resolution data helps you understand common student needs and the effectiveness of your office hours support.

## Feedback and Analytics

After a help request is completed, the student can provide feedback on the help provided. This feedback is visible to instructors only and can be used to:
Expand Down
38 changes: 38 additions & 0 deletions students/office-hours.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ Pawtograder's office hours feature allows students to request live help from cou

Students are encouraged to make public requests for help, so that other students can also benefit from the discussion.

## Get Help Button

A persistent **Get Help** button appears in the bottom-right corner of every page, making it easy to request help from anywhere in the course. Click this button to:

- View the current office hours status
- See which queues are active now
- Check the weekly queue schedule with live "Happening now" highlights
- Submit a new help request
- Access your active help requests

The help drawer shows you all available office hours queues, when they're scheduled, and which ones are currently staffed and accepting requests.

## Office Hours Queues

Instructors can create multiple office hours queues to provide different types of help. For example, if a class is coordinated across multiple campuses, there may be in-person help queues per-campus, and a cross-network virtual help queue.
Expand Down Expand Up @@ -86,6 +98,17 @@ Once you submit a help request:
Your active help request follows you around the site! You'll see status updates and video call notifications even while browsing the discussion board or other pages.
</Tip>

## Notifications

Pawtograder provides multiple notification options to keep you informed about your help requests:

- **Browser Notifications**: Receive desktop notifications when staff responds or starts helping you (requires browser permission)
- **Title Notifications**: The page title updates to show new messages even when you're on another tab
- **Sound Alerts**: Optional audio notifications for new messages
- **Favicon Badge**: The site icon shows a notification badge when you have unread messages

You can test notifications and manage your notification preferences from the help request interface. If you haven't granted browser notification permission, you'll see a warning with instructions to enable it.

## Help Request Status

Your help request will show different statuses:
Expand All @@ -94,4 +117,19 @@ Your help request will show different statuses:
- **In Progress**: A staff member is actively helping you
- **Resolved**: Your request has been marked as complete

## Resolving Help Requests

When you're finished receiving help, you can resolve your help request from either:

- The floating banner that appears while you have an active request
- The main chat view with the staff member

When resolving a request, you'll be asked to select a resolution status to help course staff understand the outcome:

- **Resolved - Question Answered**: Your question was fully answered
- **Resolved - Problem Solved**: Your technical issue was fixed
- **Resolved - Referred Elsewhere**: You were directed to other resources
- **Resolved - No Longer Needed**: You no longer need help with this issue
- **Resolved - Other**: The request was resolved for another reason

After receiving help, you can provide feedback on the assistance you received. This feedback is visible only to instructors and helps improve the office hours experience.