Skip to content

Add MCP activity generation tools and API key authentication#52

Open
Marviel wants to merge 1 commit into
stagingfrom
claude/mcp-activity-generator-Vr2Pq
Open

Add MCP activity generation tools and API key authentication#52
Marviel wants to merge 1 commit into
stagingfrom
claude/mcp-activity-generator-Vr2Pq

Conversation

@Marviel
Copy link
Copy Markdown
Contributor

@Marviel Marviel commented Mar 10, 2026

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

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, and generate-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 the REASONOTE_MCP_API_KEYS environment variable. Additionally, a new study-session prompt template is included to guide users through a structured study workflow using the generated activities.

⏱️ Estimated Review Time: 30-90 minutes

💡 Review Order Suggestion
Order File Path
1 bun_apps/mcp-server/.env.example
2 bun_apps/mcp-server/src/auth.ts
3 bun_apps/mcp-server/src/activity-tools.ts
4 bun_apps/mcp-server/src/index.ts

Need help? Join our Discord

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
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
reasonote Ready Ready Preview, Comment Mar 10, 2026 4:24pm

Request Review

Copy link
Copy Markdown

@recurseml recurseml Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by RecurseML

🔍 Review performed on 3f81521..1a5314a

  Severity     Location     Issue     Delete  
High 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',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants