Add MCP activity generation tools and API key authentication#52
Conversation
Adds four new MCP tools for generating educational activities: - generate-flashcards: Creates flashcard activities with front/back - generate-multiple-choice: Creates multiple choice questions with answer choices - generate-short-answer: Creates short answer questions with grading criteria - generate-activities: Generates a mixed set of all three types Also adds: - API key authentication middleware for the HTTP transport (opt-in via REASONOTE_MCP_API_KEYS env var) - A "study-session" MCP prompt that guides users through a structured study flow - Support for OpenAI and Anthropic as LLM backends for generation https://claude.ai/code/session_01XVeR7W4mHBijWcvzeYKZc7
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Review by RecurseML
🔍 Review performed on 3f81521..1a5314a
| Severity | Location | Issue | Delete |
|---|---|---|---|
| bun_apps/mcp-server/src/activity-tools.ts:90 | Invalid Anthropic model name |
✅ Files analyzed, no issues (3)
• bun_apps/mcp-server/.env.example
• bun_apps/mcp-server/src/auth.ts
• bun_apps/mcp-server/src/index.ts
| 'anthropic-version': '2023-06-01', | ||
| }, | ||
| body: JSON.stringify({ | ||
| model: 'claude-sonnet-4-20250514', |
There was a problem hiding this comment.
Invalid Anthropic model identifier. The model name 'claude-sonnet-4-20250514' does not match Anthropic's model naming convention. According to Anthropic's API documentation (https://docs.anthropic.com/), valid Claude Sonnet 4 model names follow the pattern 'claude-sonnet-4-X' where X is a version number (e.g., 'claude-sonnet-4-5', 'claude-sonnet-4-6'). The string '20250514' appears to be a date format (May 14, 2025) which is not valid.
When users configure ANTHROPIC_API_KEY and attempt to use any of the activity generation tools (generate-flashcards, generate-multiple-choice, generate-short-answer, generate-activities) with Anthropic as the LLM provider, ALL API calls will fail with an HTTP 400 error: 'Anthropic API error (400): model_not_found' or similar. This completely breaks the activity generation feature for Anthropic users.
The code at lines 82-101 makes the API request, and line 90 specifies this invalid model. The error will be caught by the check at line 99-101, resulting in the error message being returned to the user, but the tool will be completely non-functional.
Correct model names should be: 'claude-sonnet-4-5', 'claude-sonnet-4-6', or 'claude-opus-4-6'.
React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)
Adds four new MCP tools for generating educational activities:
Also adds:
https://claude.ai/code/session_01XVeR7W4mHBijWcvzeYKZc7
High-level PR Summary
This PR adds AI-powered educational activity generation capabilities to the MCP server, introducing four new tools (
generate-flashcards,generate-multiple-choice,generate-short-answer, andgenerate-activities) that leverage OpenAI or Anthropic LLMs to create structured learning content. It also implements optional API key authentication for the HTTP transport layer, allowing server operators to secure their MCP endpoint by configuring theREASONOTE_MCP_API_KEYSenvironment variable. Additionally, a newstudy-sessionprompt template is included to guide users through a structured study workflow using the generated activities.⏱️ Estimated Review Time: 30-90 minutes
💡 Review Order Suggestion
bun_apps/mcp-server/.env.examplebun_apps/mcp-server/src/auth.tsbun_apps/mcp-server/src/activity-tools.tsbun_apps/mcp-server/src/index.ts