EduChain MCP Server
by siv3sh
README.md
# π Professional Technical Report: EduChain MCP System
## Overview
This report provides a comprehensive analysis of the two core files in the EduChain MCP (Modular Command Platform) project:
- `main.py` β Backend server implementation using FastMCP.
- `educhain_ui.py` β Streamlit-based frontend interface.
The EduChain system facilitates AI-powered educational content generation, including MCQs and lesson plans, designed to support modern teaching needs.
---
## 1. File: `main.py` β Backend Server
### π Objective
The `main.py` script is the primary backend module that sets up and runs a FastMCP server. It exposes educational functionalities as web-accessible tools and resources, supporting dynamic educational content generation.
### π§ Core Functionalities
- **Server Initialization:** Instantiates an MCP server with the identifier `"Demo"` using the `FastMCP` class.
- **Tool Exposure:** Registers the `generate_mcq` function as a callable MCP tool using the `@mcp.tool()` decorator.
- **Resource API Exposure:** Registers the `lesson_plan` function as an HTTP resource using the `@mcp.resource()` decorator.
- **Tool Descriptions:**
- `generate_mcq(topic: str, num_questions: int = 5)`: Accepts a topic and number of questions, returns a list of multiple-choice questions generated by an external AI module.
- `lesson_plan(subject: str)`: Accepts a subject string and returns a structured lesson plan suitable for educators.
### π§© Design Considerations
- Abstraction of internal logic (`generate_mcqs`, `generate_lesson_plan`) promotes modularity and separation of concerns.
- Use of decorators simplifies registration and routing.
- Designed for rapid prototyping of AI-powered educational tools.
### π¦ Dependencies and Imports
- `FastMCP` from `src.mcp.server.fastmcp` β Core server functionality.
- External educational generation logic (not shown) β Handles content generation.
---
## 2. File: `educhain_ui.py` β Streamlit Frontend
### π Objective
The `educhain_ui.py` script serves as the user interface for interacting with the MCP backend server. Built using the Streamlit framework, this module provides an intuitive web-based GUI for educators to input topics or subjects and retrieve AI-generated educational materials.
### π§ Core Functionalities
- **UI Layout:**
- MCQ Generator section: Accepts a topic and number of questions.
- Lesson Plan Generator section: Accepts a subject.
- **Backend Integration:**
- Sends POST requests to `http://localhost:8000/generate_mcqs` and `http://localhost:8000/generate_lesson_plan` using the `requests` library.
- Parses and renders returned JSON responses in real time.
### π Technical Breakdown
- **Libraries Used:**
- `streamlit`: Renders the interactive web interface.
- `requests`: Handles HTTP communication with the backend.
- `json`: Parses structured server responses.
- **Error Management:**
- Includes basic exception handling for failed requests or malformed responses.
- **User Experience:**
- Real-time interaction and feedback.
- Clean separation between MCQ and lesson plan features.
### π Workflow Summary
1. User launches the Streamlit app.
2. Inputs are collected through the web UI.
3. Requests are dispatched to the backend MCP server.
4. The server responds with AI-generated data.
5. Streamlit renders the responses within the interface.
---
## 3. π Interaction Between Components
| Component | Role | Endpoint Used |
|------------------|-----------------------------|----------------------------------------|
| `main.py` | API Provider (MCP backend) | `/generate_mcqs`, `/generate_lesson_plan` |
| `educhain_ui.py` | UI Client | Sends POST requests to above endpoints |
The architecture follows a decoupled client-server model. The backend (MCP) handles content generation, while the frontend (Streamlit) manages user input and output rendering.
---
## 4. π§ Recommendations for Improvement
### β
Functionality
- Add detailed logging using Pythonβs `logging` module to enhance observability.
- Define expected input/output formats via OpenAPI or Swagger for documentation.
### π Security
- Implement input validation to prevent injection attacks.
- Configure CORS headers if deploying for public access.
- Switch to HTTPS for production environments.
### π§ͺ Testing
- Develop unit tests for each tool function (e.g., using `pytest` or `unittest`).
- Add integration tests to ensure end-to-end functionality.
### π Deployment
- Consider containerizing the MCP server using Docker.
- Deploy using a platform like Heroku, AWS, or Azure with proper CI/CD setup.
### π Documentation
- Include inline docstrings and function-level comments.
- Add a README.md for contributors with setup and usage instructions.
---
## π Summary
The EduChain MCP project demonstrates a robust and modular approach to delivering AI-based educational tools. The clear separation between the backend processing (via MCP) and frontend interaction (via Streamlit) enables scalability, maintainability, and future extensibility.
---
Β© 2025 EduChain Team β AI-Powered Learning Tools
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo issues