college-tools-mcp
College Management AI Assistant (v5)
基于 Google Gemini 和模型上下文协议(Model Context Protocol,MCP)构建的智能高校行政助手。该助手通过结构化的 FastMCP 工具与关系型 SQLite 数据库交互,用来回答有关学生、教师、课程、选课以及学业成绩的问题。
架构概览
+-------------------------------------------------------------+
| User / Client |
+-------------------------------------------------------------+
|
v
+-------------------------------------------------------------+
| Gemini LLM Assistant |
| (bot.py) |
+-------------------------------------------------------------+
|
MCP Protocol (stdio)
|
v
+-------------------------------------------------------------+
| FastMCP Server |
| (tooling.py) |
+-------------------------------------------------------------+
|
SQLite Queries
|
v
+-------------------------------------------------------------+
| College SQLite Database |
| (college.db) |
| - persons (students, faculty, staff) |
| - courses |
| - student_enrollments |
+-------------------------------------------------------------+Related MCP server: College AI Assistant
功能特性
合成数据生成:使用
Faker创建真实完整的高校数据,包括学生、教师、课程以及成绩记录。FastMCP 工具:提供健壮、依据 schema 规范的 MCP 工具,用于查询学术记录、课程、院系和选课统计信息。
交互式多轮对话机器人:基于 Google GenAI SDK(
google-genai)的聊天气泡,并通过 MCP 自动编排工具调用。安全配置:基于环境变量的密钥管理,支持
.env文件。
项目结构
.
├── bot.py # Interactive Gemini chatbot integrating MCP tools via stdio
├── tooling.py # FastMCP Server exposing database querying tools
├── create_data.py # SQLite database schema initializer & synthetic data generator
├── college.db # SQLite database file (generated by create_data.py)
├── system_prompt.txt # System instruction prompt for the AI assistant
├── prompt.txt # Context and initial project design prompts
├── mcp_config.example.json # Example configuration for MCP client registration
├── requirements.txt # Python package dependencies
├── .env # Environment variables (GEMINI_API_KEY)
└── .gitignore # Git ignore file for Python, SQLite, and secrets数据库结构
SQLite 数据库(college.db)包含以下关系表:
persons:存储学生、教师和职员的用户档案(ID, name, email, phone, DOB, gender, address, role)。courses:存储课程信息(course ID, code, course name, department, credits, assigned instructor)。student_enrollments:存储选课记录(enrollment ID, student ID, course ID, date, grade, semester)。
可用的 MCP 工具(tooling.py)
get_student_info(student_id_or_name):按 ID、姓名或 email 查找学生档案。get_course_details(course_code_or_name):获取课程详细信息以及授课教师。get_student_enrollments(student_id_or_name):列出某学生的所有课程和成绩。get_students_by_course(course_code_or_name):列出选修某门课程的所有学生。list_courses_by_department(department):列出某个院系的所有全部课程。get_courses_taught_by_faculty(faculty_id_or_name):列出某位教师所教授的所有课程。search_persons(query, role):跨角色(学生、教师、教职工)搜索人员信息。get_course_statistics(course_code_or_name):给出汇总统计(总选课人数、成绩分布)。list_all_courses():提供所有大学课程的完整目录。execute_custom_sql_query(query):供复杂聚合查询的只读 SQL 执行。
设置与安装
1. 前置条件
已安装 Python 3.10+
Google Gemini API Key(Google AI Studio)
2. 安装依赖
pip install -r requirements.txt3. 配置环境变量
在项目的根目录下创建或编辑你的 .env 文件:
GEMINI_API_KEY=your_actual_gemini_api_key_here4. 生成合成数据
用合成数据初始化数据库:
python create_data.py使用说明
运行交互式 AI 对话
python bot.py输入你的学术或行政相关问题(例如,“列出计算机科学系的所有课程” 或 “John Doe 的 ID 是多少?”),输入 exit 或 quit 即可结束会话。
作为 MCP 服务器连接(例如 IDE / Claude Desktop / Antigravity)
可参考 mcp_config.example.json 在 MCP 客户端配置中注册 tooling.py:
{
"mcpServers": {
"college-tools-mcp": {
"command": "python",
"args": [
"-Wignore",
"<FULL_PATH_TO>/tooling.py"
]
}
}
}This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only MCP server for ClassQuill, a tutoring-business-management platform.
Governed data discovery, exact queries, decisions, simulations, and runtime utilities over MCP.
Read-only MCP tools for AI agent discovery, structured resources, and NIULAI information.
Public read-only MCP access to digital learning concepts, semantic relationships, and citations.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceEnables querying student information such as marks, attendance, pending assignments, and timetables from a MySQL database through MCP tools.-
- FlicenseNot gradedqualityCmaintenanceProvides MCP tools for searching student profiles, viewing marks/attendance, and finding low-attendance students. Enables AI assistants like Gemini to interact with college student data through natural language.-
- FlicenseNot gradedqualityBmaintenanceMCP server exposing a university course catalog with tools for searching courses, looking up prerequisites and instructors, and generating prerequisite graphs, plus resources and a prompt template for AI academic advisors.-
- FlicenseNot gradedqualityCmaintenanceEnables LLM agents to safely query educational administration databases through read-only MCP tools, enforcing SQL whitelisting, automatic LIMIT caps, parameterized queries, timeouts, token authentication, and audit logging.-