Inspiration As students, we struggle with "context drift" and information overload. We have folders of lecture slides, syllabus PDFs, and calendar appointments scattered across different tabs. We wanted to build a single, unified agent that digests these sources and acts as a personalized study guide, keeping the student strictly grounded in their actual curriculum instead of giving generic study advice.
What it does Cortexa takes raw files (PDFs, DOCX, TXT, etc.), segments them, and indexes the chunks into a private Elasticsearch instance. It then uses the Gemini API to provide three primary workflows:
Grounded Q&A: Answers concept questions using specific citations and LaTeX equations drawn directly from the student's materials. Quiz Lab: Generates custom spaced-recall quizzes based on weak topics detected in notes. Deadline-Aware Planner: Resolves calendar overlaps by automatically moving revision sessions into comfortable free slots.
How we built it We built Cortexa as a single-page progressive web application hosted on Firebase Hosting. The frontend communicates with a serverless Node.js Express API running in Firebase Cloud Functions. For semantic indexing and document retrieval, we integrated the Elastic Model Context Protocol (MCP). When deployed in serverless environments, the backend dynamically falls back to native REST API queries to query the Elasticsearch cluster. Scoping is handled per-user, isolating Firestore entries and Elasticsearch index namespaces dynamically.
Challenges we ran into Integrating standard stdio-based MCP servers into stateless, serverless environments like Firebase Cloud Functions was our biggest hurdle. Because Cloud Functions cannot spawn long-lived subprocesses or run npx wrappers reliably due to runtime limitations, we had to build a robust HTTP REST client fallback. This client mirrors the exact schema, routing, and index mappings of the Elastic MCP tools using native fetch requests.
Accomplishments that we're proud of We successfully implemented a zero-configuration serverless fallback that preserves full search and indexing capabilities on the live Firebase site while keeping the local stdio MCP server functional for local debugging. We established strict user data isolation across all layers: private Firestore sub-collections and private, scoped index name structures in Elasticsearch.
What we learned We learned how to design resilient agents that maintain backend-parity between local command-line runtimes and hosted, stateless cloud environments. We also gained deep experience structuring index mappings and query structures inside Elasticsearch to optimize search results for grounding LLM prompts.
What's next for Cortexa We want to expand Cortexa's data integration by adding automatic syncing of Google Drive folders through the Google Drive API, enabling real-time workspace updates. We also plan to integrate Gmail API to deliver a daily study briefing directly to the student's inbox every morning.
Built With
- api
- css3
- elastic
- gemini
- github
- google-calendar
- google-cloud
- html5
- mcp-server
- node.js
- oauth
- parse
Log in or sign up for Devpost to join the conversation.