MCP-USV
A comprehensive MCP server for university faculty administration, enabling management of students, faculty, courses, grades, and documents with AI-powered chat and multiple access patterns.
README
MCP-USV: Faculty Administration System
A comprehensive Model Context Protocol (MCP) server for university faculty administration, built with Next.js, Prisma, PostgreSQL, and Gemini AI.
Features:
- 🛠️ 50+ MCP Tools for managing students, faculty, courses, grades, documents, and more
- 🤖 AI-Powered Chat interface with Gemini for natural language queries
- 🔗 Multiple Access Patterns: HTTP API, MCP protocol, and direct database queries
- 📄 Certificate Generation with PDF export and email delivery
- 🏫 Academic Management covering students, specializations, courses, and appointments
- 🔒 Type-Safe with TypeScript, Zod validation, and Prisma ORM
📚 Documentation
Start here based on your role:
| Document | Purpose | For |
|---|---|---|
| MCP_ARCHITECTURE.md | System design & how everything works together | Architects, Senior Developers |
| MCP_ARCHITECTURE_DIAGRAMS.md | Visual flows and interactions | All technical readers |
| DEVELOPER_GUIDE.md | How to add tools and extend the project | Developers, Contributors |
| DOCUMENTATION_PROCESS.md | How to maintain and improve documentation | Documentation maintainers |
| This README | Getting started & quick reference | Everyone (START HERE) |
Quick Navigation by Role
👤 New Team Member:
- Read: README.md (this file)
- Follow: Setup instructions below
- Reference: DEVELOPER_GUIDE.md
👨💻 Want to Add a New Tool: → See DEVELOPER_GUIDE.md#adding-a-new-tool
🏗️ Want to Understand the Architecture: → See MCP_ARCHITECTURE.md and MCP_ARCHITECTURE_DIAGRAMS.md
🧪 Want to Test an API: → See DEVELOPER_GUIDE.md#api-endpoint-examples
❓ Something Not Working? → See DEVELOPER_GUIDE.md#common-debugging
Environment Variables
- Copy
.env.exampleto.env. - Update
DATABASE_URLto point at your Postgres instance (the same value is used by Prisma, the MCP server, and the Next.js API routes). - Set
GEMINI_API_KEY(and optionallyGEMINI_MODEL, defaultgemini-1.5-pro) so the chat agent can call Gemini. - Adjust
MCP_SERVER_COMMAND/MCP_SERVER_PATHif the compiled MCP binary lives elsewhere. - Configure SMTP for certificate delivery:
SMTP_HOST,SMTP_PORT,SMTP_USER,SMTP_PASS, optionalSMTP_FROM.
Getting Started
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.
MCP Server
Build the TypeScript MCP server and start it against the same datastore:
npm run build:mcp
node dist/mcp-server.js
Students API
The React app now exposes the MCP student tools over HTTP:
GET /api/studentsaccepts the same optional filters as thelist_studentstool.POST /api/studentsvalidates payloads with Zod and creates a student via the shared Prisma service.
The API handlers import the exact same business logic that powers the MCP tools, so data written by the React UI is immediately visible to MCP clients.
Faculties API
GET /api/facultiesreturns all faculties with onlyidandname.GET /api/faculties/[facultyId]/specializationsreturns all specializations for that faculty with onlyidandname.
Certificate Requests API
POST /api/certificate-requestsvalidates student certificate request payloads.GET /api/certificate-requestsreturns certificate requests (newest first); optionalstatusquery filter, e.g./api/certificate-requests?status=pending.- Expected body:
lastName,firstName,fatherInitial,faculty,specialization,studyYear,purpose,otherPurpose. facultyandspecializationare received as IDs in the request, validated against student/faculty/specialization data, then stored as names inCertificateRequest.firstName,lastName, andfatherInitialare validated at POST time and resolved from the relatedStudentrecord on GET responses.- On invalid data the endpoint returns
valid: falsewithreasons; on success it stores the request withstatus: "pending". POST /api/certificate-requests/[requestId]/approveapproves one request, generates:- JSON snapshot in
generated-certificates/ - PDF file in
generated-certificates/pdf/ Documentrow withfilePathset to the generated PDF path- Email with PDF attachment to the linked student's email
- JSON snapshot in
- If SMTP fails, approval still completes and API response includes
email.sent: falsewith an error message.
For PDF generation with Playwright, install Chromium once:
npx playwright install chromium
Secretariat Appointments API
GET /api/secretariat-appointmentsreturns appointments ordered bydate+time.GET /api/secretariat-appointments?studentEmail=...&dateFrom=YYYY-MM-DD&dateTo=YYYY-MM-DDfilters appointments.POST /api/secretariat-appointmentscreates a new appointment.GET /api/secretariat-appointments/[appointmentId]fetches one appointment.PATCH /api/secretariat-appointments/[appointmentId]updates one or more fields.DELETE /api/secretariat-appointments/[appointmentId]removes one appointment.- Expected body fields:
studentName,studentEmail,date(YYYY-MM-DD),time(HH:mm), optionaldurationMinutes,meetingMode,location,notes.
MCP Tool Proxy
External apps can now discover and invoke any MCP tool via HTTP:
GET /api/tools– returns every tool name plus its description so you can build pickers in another UI.POST /api/tools/[toolName]– validates the request body with the tool’s Zod schema, spins up the MCP server (node dist/mcp-server.jsby default), and returns theCallToolResultJSON.
Environment tweaks:
- Run
npm run build:mcpwhenever tool code changes sodist/mcp-server.jsstays in sync. - Override
MCP_SERVER_COMMAND/MCP_SERVER_PATHif the binary lives elsewhere (see.env.example).
Each HTTP invocation launches the MCP server via stdio, executes a single tool, and shuts it down—ideal for React clients that can only speak HTTP.
Chat Agent API
POST /api/chat accepts { "message": "..." }, sends the prompt to Gemini with the MCP tool catalog, executes the tool Gemini selects, and replies with:
reply: Gemini's final answer after the tool call (if any).toolCalls: arguments plus raw MCP output so clients can audit what happened.
You can exercise the endpoint via the simple chat UI on the home page.
Internal Auth API
POST /internal/auth/secretary-checkchecks whether an email is allowed to use secretary-only flows.- Expected JSON body:
{ "email": "user@gmail.com" }. - Success response shape:
{ "allowed": true }(orfalse). - Configure allowed emails with
SECRETARY_EMAILSas a comma-separated list.
Students UI
Visit the home page to:
- Send prompts that flow through
/api/chat. - Watch Gemini's replies plus any MCP tool traces for debugging.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。