National Central University
Uedu Main Site
Explore Uedu
Student Console
Register as Member/Login
Research Informed Consent Center
Survey Center
Teacher Console
Course Setup
Support & Messages
Uptime Data

UeduGPTs

--

Jupyters

7

Local AI

--

Uedu Code

--

AI Reply Desktop Notifications

Show a desktop notification when the AI TA finishes replying

Chat Message Notifications

Notify me when classmates post messages in the forum

Sound notification

Play an alert sound whenever there is a new notification

METHODOLOGY

MCP Server
LLM-Native Access to Educational Data

Using Anthropic's Model Context Protocol as the interface, package Uedu Public API v1 into tools that an LLM can call directly. Supports stdio and streamable-http dual transport, SHA-256 hashed keys, and two-tier rate limiting, strictly separating public and sensitive data.

1. Design philosophy

University teachers and researchers often need to query platform data ("What courses is NCU General Education Centre offering in 114-2?" "Which papers has the Uedu team published this year?"), but are not familiar with REST APIs and do not want to write Python scripts. The previous solution was to build many query pages, but UI development costs were high and maintenance was difficult.

Model Context Protocol (MCP) is an open protocol proposed by Anthropic in 2024, allowing LLM clients (Claude Desktop, Claude Code, Cursor, VS Code, etc.) to access external data via a standardised tool interface. Uedu wraps Public API v1 as an MCP server, enabling researchers to query data in natural language and allowing the LLM to decide autonomously which tool to call.

Why it matters

This is the infrastructure behind Uedu's design philosophy of Human-AI Collaboration. Without writing any code, researchers can turn AI assistants such as Claude and Cursor into research assistants familiar with Uedu data. This lowers the barrier for scholars without an engineering background to use the platform's data.

2. Relationship between MCP and Public API

The MCP Server is not an independent data source, but a wrapper layer for Public API v1 (/api/v1/*):

LLM Client (Claude/Cursor/VS Code) │ (MCP protocol, JSON-RPC over stdio/HTTP) ▼ Uedu MCP Server ← subject of this document │ (HTTPS, Bearer token) ▼ Uedu Public API v1 (/api/v1/*) │ ▼ MySQL database (querying low-sensitivity fields only)

Actual data queries, permission checks, and rate limiting all happen at the API layer. The MCP server is only responsible for:

  • Convert an MCP tool call into an HTTP request
  • Convert an HTTP response into an MCP tool result
  • Retrieve the API key from MCP transport and send it via the Authorization header

This layered design ensures that changes to MCP do not affect the core API, and vice versa. If the MCP protocol is revised in future, only the wrapper needs to be rewritten.

3. Dual transmission architecture

Uedu offers two MCP transport implementations, located in the mcp_server/ directory:

Orientationstdio(uedu_mcp_server.pyHTTP(uedu_mcp_http.py
Transmissionstdin / stdout JSON-RPCstreamable-http(Starlette / ASGI)
DeployUser’s local machine (requires Python + mcp[cli], httpx)Runs permanently on the Uedu server, reverse-proxied to https://uedu.tw/mcp
Client settingsA full Python path must be specifiedFill in URL + Bearer token only
API key sourceEnvironment variable UEDU_API_KEYHTTP Authorization header, retrieved per request
Multi-user concurrencyEach client runs its own copySingle server supports concurrent multiple keys
Applicable audienceOffline, private deployment, developmentFor general researchers, do not want to install dependencies
Scripts must be synchronised

There are two stdio versions: mcp_server/uedu_mcp_server.py (development version) and static/mcp/uedu_mcp_server.py (for users to download with curl). Whenever a tool is added or modified, all three places, including the HTTP version, must be kept in sync.

4. Tool list

Currently provides 6 tools, all aimed at public data:

ToolCorresponding to EndpointPurpose
list_universitiesGET /api/v1/universitiesList the universities included (filterable by region)
search_coursesGET /api/v1/coursesSearch public courses (keywords, semester, school, pagination)
get_courseGET /api/v1/courses/<id>Retrieve single public course details
get_course_statsGET /api/v1/course_statsCourse statistics (by semester / academic year / institution grouping)
list_papersGET /api/v1/papersAcademic papers published by the Uedu team
list_conferencesGET /api/v1/conferencesAcademic conferences attended by the Uedu team

Tool schema design pattern

All tools follow the conventions below:

  • Declare using the @mcp.tool() decorator in FastMCP
  • Return type is fixed as str (JSON serialisation, ensure_ascii=False to preserve Chinese)
  • Empty string / 0 parameters are treated as unspecified and not included in the query string
  • A docstring is the tool description visible to the LLM; it must explain its purpose and limitations
  • The HTTP version additionally receives a Context parameter, used to retrieve the per-request Bearer token

5. Verification and rate limiting

Key lifecycle

  • Format: uedu_<48 hex> (53 characters in total)
  • Immediately hash with SHA-256 after generation; store only the hash and the first 12-character prefix in the database (for UI identification).
  • Plain text is shown only once in SweetAlert at creation time; the user must save it themselves
  • Up to 5 valid keys per user
  • Verification process: Authorization: Bearer <key> → compute SHA-256 → check api_v1_keys.key_hash → verify is_active=1

Two-tier rate limiting

Each API request updates two buckets at the same time (INSERT... ON DUPLICATE KEY UPDATE, atomic):

  • Minute bucket: bucket_minute = DATETIME.replace(second=0, microsecond=0)
  • day bucket: bucket_day = DATE
LayerDefault maximumcan override
Per minute60 timesapi_v1_keys.rate_limit_per_minute (NULL = use default)
Daily10,000 timesapi_v1_keys.rate_limit_per_day (NULL = use default)

Administrators can raise or lower the limit for individual keys via /api/developers/admin/keys/<id>, for example allowing a trusted research institution key to be relaxed to 300/min.

Request audit

Each API call is written to api_v1_request_log (including endpoint, HTTP status code, IP, User-Agent), retained for 30 days, for abuse detection and debugging.

6. Data boundaries: public vs. prohibited

The MCP Server is Uedu's external "gateway", and the data-boundary rules must be strict:

✅ Exposure allowed

TypeField example
University metadatacode、name_zh、name_en、region
Public Course (is_public=1)class_name、instructor、semester、department、teaching_goal
Course statisticsAggregated course_count and instructor_count by semester / academic year / school
Paper metadataTitle, author, conference, year, DOI, category
Seminar metadataName, location, date, number of papers presented

❌ Strictly prohibited

  • Student personal data: name, student number, Email, contact details
  • Grades and assignments: marks, submission records, attendance
  • Forum content: posts, comments, likes
  • AI dialogue history: ClassroomGPT / Aida / Uedu Open conversation records
  • Physiological data: HRV, sleep, stress, EEG, fNIRS
  • Course code and private Course (is_public=0)
  • Instructor internal settings: system prompt, API keys, RAG documents
Executive mechanism

The data boundary does not rely on “judgement at the time of request”; instead, sensitive fields are not retrieved at the SQL layer. The SELECT statement for each Public API endpoint is designed as a whitelist, and sensitive fields never enter the API response path. The WHERE is_public = 1 AND deleted = 0 clause is hard-coded into each course endpoint to prevent enumeration attacks.

7. Implementation notes

3 files added to the tool

When adding a tool, the following three places must be updated at the same time:

  1. mcp_server/uedu_mcp_server.py (stdio development version)
  2. static/mcp/uedu_mcp_server.py (downloadable version for users)
  3. mcp_server/uedu_mcp_http.py (HTTP version)

Update app_api_v1.py as needed (to add new endpoints) and templates/developers/index.html (user documentation).

Rate limiter storage

At present, Flask-Limiter uses in-memory storage by default. In a multi-worker deployment, Redis must be used, otherwise each worker's count is independent and the actual limit will become N times larger.

HTTP deployment

The HTTP MCP server must be run as a separate process bound to 127.0.0.1:5050 (managed by supervisord), and nginx must be configured with a location /mcp/ reverse-proxy rule. It is currently marked as experimental.

8. Future plans

In addition to tools, the MCP specification also defines Resources and Prompts. Uedu plans to add these gradually:

MCP Resources (planned)

Expose structured resources via URI, so users can add them on the LLM client side via "Add Context → MCP Resources":

  • uedu://courses/<id> → course outline
  • uedu://papers/<id> → paper metadata and abstract
  • uedu://universities/<code>/courses → all public courses at a university

MCP Prompts (planned)

Predefined interactive prompt template, triggered when the user types /uedu.xxx in the LLM client:

  • /uedu.find_advisor (corresponds to the advisor_match module)
  • /uedu.summarize_course (corresponds to the course module)
  • /uedu.related_papers (search the Uedu paper collection by interest keywords)

MCP Registry submission

Plan to submit to the GitHub MCP Registry, allowing users to install with one click in VS Code via @mcp uedu.

9. Research applications

The Uedu MCP Server itself is a research subject. Possible topics to explore:

  • Reliability of LLM calls to external tools: success rate, hallucination proportion, and error-use patterns of different LLMs on the same set of Uedu tools
  • Feasibility of MCP as an educational data API: compared with traditional REST SDKs, differences in users' query efficiency and accuracy
  • rate limit evidence: usage distribution (long tail / concentration) and the optimal per-key custom strategy
  • Semantic alignment between natural-language queries → tool calls: tool selection accuracy under different language styles used by Students / Instructors / researchers
Citation recommendations

When citing this system, please cite: "Uedu MCP Server: an educational-data MCP implementation with dual transport (stdio + streamable-http) (https://uedu.tw/developers)". If using API v1 to obtain data, please also state the endpoint used, the query period and the data scope. Before publication, be sure to confirm that all data used belong to the "public" category; private fields must not appear in the research materials.