Add Phase 4B: Pandora MCP server and safe MCP tools - #101
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughAdds Pandora MCP authentication, tool handlers, MCP server wiring, Next.js route handling, and Phase 4B documentation for the MCP endpoint. ChangesPandora MCP Server
Sequence Diagram(s)Included in the hidden review stack artifact. Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc074b6ca7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const input = memoryContextInputSchema.parse(rawInput); | ||
| const maxItems = Math.min(Math.max(input.max_items ?? 8, 1), 20); | ||
| const packs = await (client.from<MemoryContextPack>("memory_context_packs").select("*").eq("user_id", principal.userId).eq("namespace", input.namespace).eq("status", "active").order("created_at", { ascending: false }).limit(1) as unknown as Promise<{ data: MemoryContextPack[] | null; error: { message: string } | null }>); | ||
| const events = await (client.from<MemoryEvent>("memory_events").select("*").eq("user_id", principal.userId).eq("namespace", input.namespace).neq("status", "archived").order("created_at", { ascending: false }).limit(maxItems) as unknown as Promise<{ data: MemoryEvent[] | null; error: { message: string } | null }>); |
There was a problem hiding this comment.
Exclude ignored events from MCP context
When an operator marks a memory event as ignored, this MCP query still returns it because it excludes only archived; the ignore endpoint leaves the row at status ignored, so get_memory_context can surface rejected facts and the distillation path below uses the same filter to fold them back into active context packs. This defeats the review/ignore workflow for any bearer-token MCP client once ignored events exist in the namespace.
Useful? React with 👍 / 👎.
Motivation
Description
/api/mcp,/api/mcp/sse, and/api/mcp/messagethat use the official@modelcontextprotocol/sdktransport in JSON-response mode for Vercel serverless.lib/services/mcp-auth.ts, and usePANDORA_ENABLE_MCP,PANDORA_MCP_TOKEN,PANDORA_MCP_USER_ID, andPANDORA_MCP_DB_KEYto gate and scope access.lib/services/pandora-mcp-server.tsandlib/services/pandora-mcp-tools.ts:get_latest_context_pack,get_memory_context,capture_memory_event(gated byPANDORA_ENABLE_MCP_CAPTURE), anddistill_context_pack(gated byPANDORA_ENABLE_MCP_DISTILLATION), and add best-effort audit logging inlib/services/pandora-mcp-audit.ts.docs/phase-4b-pandora-mcp.md, unit teststests/unit/pandora-mcp-auth.test.tsandtests/unit/pandora-mcp-tools.test.ts, and add@modelcontextprotocol/sdkruntime dependency topackage.json.Testing
npm run typecheckand it completed without errors.npm run lint; it passed but left existing pre-existing warnings inlib/db/core-repositories.tsandvitest.config.ts.npm run testand all tests passed (76 test files, 454 tests).npm run build; build succeeded (warnings include the existing Supabase Edge runtime notice and Next.js export recognizer warnings for the re-exported routes).Codex Task
Summary by CodeRabbit
New Features
Bug Fixes