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
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_urlfield - 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
Setup
Local Development
When running Supabase locally, the MCP server is automatically available at:npx supabase start.
Configuration
The MCP server requires the following database schema additions:Assignment Handout URL
Assignments can include ahandout_url field that points to the assignment description or requirements document. This provides AI assistants with context about what students are working on:
Usage
For Course Staff
- Navigate to a help request or discussion thread where you want AI assistance
- Click the “AI Help” button in the interface
- Copy the generated MCP context URL
- Paste the URL into your MCP-compatible AI client (e.g., Claude Desktop)
- 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:- Adding new tools: Define additional MCP tools in the Edge Function
- Expanding data access: Add new database queries (respecting RLS policies)
- 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
userstable directly - No private profiles: The
is_private_profileflag 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
- Verify Supabase is running:
npx supabase status - Check that Edge Functions are running:
npx supabase functions serve - Ensure you’re authenticated as an instructor or grader
AI assistant can’t access data
- Verify your account has instructor or grader role in the course
- Check that RLS policies allow access to the requested data
- Ensure the MCP context URL is correctly formatted
Missing assignment context
- Verify the assignment has a
handout_urlconfigured - Check that the URL is accessible to the AI assistant
- 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