
mcp python test
一个使用FastAPI构建的学生管理服务,集成了MCP协议,支持数据库操作和Cursor IDE工具。
Repository Info
About This Server
一个使用FastAPI构建的学生管理服务,集成了MCP协议,支持数据库操作和Cursor IDE工具。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Student Management MCP Server
A FastAPI-based student management system with MCP (Model Context Protocol, also known as Method Call Protocol) integration for Cursor IDE.
Prerequisites
- Docker and Docker Compose
- Python 3.12 or higher (for local development)
- uv (for dependency management)
- Cursor IDE
Quick Start
- Clone the repository:
git clone https://github.com/supriyakundu99/mcp-python-test.git
cd mcp-python-test
- Build and start the containers (app and PostgreSQL) using Docker Compose:
docker compose up --build -d
-
The FastAPI MCP server will be running at http://localhost:3000 and the MCP endpoint at http://localhost:3000/mcp.
-
The PostgreSQL database will be available at
localhost:5432(user:postgres, password:postgres, db:students).
Note:
- The database schema and tables are initialized automatically using
init.sqlon first run. - To stop the containers:
docker compose down
Cursor IDE Integration
- Create or update your
sample-mcp.jsonfile in your Cursor IDE workspace:
{
"mcpServers": {
"student-mcp-http-python": {
"url": "http://127.0.0.1:3000/mcp"
}
}
}
-
Restart Cursor IDE to load the MCP configuration.
-
The Student Management System MCP tools will now be available in your Cursor IDE.
Available MCP Tools
get_all_students: Retrieve all student recordsget_student_statistics: Get statistical information about studentscreate_student: Create a new student recordget_student: Get student details by IDupdate_student: Update student informationdelete_student: Delete a student recordadd_marks: Add marks for a studentupdate_marks: Update marks for a studentsearch_students_by_name: Search students by namesearch_students_by_department: Search students by departmentsearch_students_by_class: Search students by class yearsearch_students_by_marks_range: Search students by marks rangeget_student_marks: Get marks for a specific studentget_students_above_marks: Get students with marks above thresholdget_students_below_marks: Get students with marks below threshold
Development
Local Setup
- Install dependencies and set up a virtual environment using uv and pyproject.toml:
uv sync
- Start the PostgreSQL database using Docker Compose:
docker compose up -d db
- Initialize the database schema and tables by running the provided SQL script:
docker exec -i <your_postgres_container_name> psql -U <your_db_user> -d <your_db_name> < init.sql
Replace <your_postgres_container_name>, <your_db_user>, and <your_db_name> with your actual container, user, and database names.
- Run the application:
python src/main.py
Database Schema
Students Table
- id: Serial Primary Key
- name: VARCHAR(100)
- roll_number: VARCHAR(20) Unique
- department: VARCHAR(50)
- class_year: INTEGER
- email: VARCHAR(100) Unique
Student Marks Table
- id: Serial Primary Key
- student_id: INTEGER (Foreign Key)
- subject: VARCHAR(100)
- marks: FLOAT
- semester: INTEGER
Quick Start
Clone the repository
git clone https://github.com/supriyakundu99/mcp-python-testInstall dependencies
cd mcp-python-test
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.