Skip to main content

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:
ALTER TABLE assignments ADD COLUMN handout_url TEXT;
Update your assignments to include handout URLs:
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