Skip to main content
Glama

UAAR University MCP Server

PyPI version Python Versions License: MIT Development Status Total Tools

Model Context Protocol (MCP) Server for PMAS Arid Agriculture University Rawalpindi

A comprehensive MCP server that provides AI agents with structured access to university academic resources, admissions, student services, and administrative functions through 53 specialized tools.

✨ Features

šŸŽ“ Academic & Admissions

  • Course Management: Search courses by name or code across all departments

  • Department Information: List all academic departments with faculty details

  • Merit Lists: Access latest department-specific merit rankings for admissions

  • Admission System: Multi-step admission form with progress tracking

  • Program Availability: Check available academic programs and requirements

  • Class Schedules: Get timetables filtered by course or day

šŸ“š Student Services

  • Library System: Search books by title, author, ISBN; check availability and borrowing status

  • Hostel Management: Check room availability, view mess menus, fee structures

  • Transport Services: Bus routes, stops, and transport card information

  • Scholarship Portal: Browse scholarships, check eligibility criteria, view details

  • Academic Results: Semester results, CGPA calculation, transcript request info

šŸ›ļø Administrative Functions

  • Faculty Directory: Search faculty by name or research interests

  • Department Contacts: Emergency contacts and departmental information

  • Event Management: University events, workshops, and announcements

  • News System: Latest university news categorized by relevance

  • Financial Aid: Financial aid office information and fee structures

šŸ”§ Administrative Tools (Admin Only)

  • Data Management: Add departments, courses, faculty members

  • Content Management: Add library books, scholarships, events, news

  • System Administration: Full CRUD operations for university data

⚔ Technical Features

  • Multi-Transport Support: Stdio (Claude Code CLI) and HTTP/SSE modes

  • JWT Authentication: Secure token-based authentication system

  • SQLite Database: Lightweight database with auto-initialization and seeding

  • Async Architecture: All tools implemented as async functions

  • Type Safety: Full Pydantic validation with comprehensive type hints

  • Paginated Responses: Efficient handling of large datasets

šŸš€ Quick Start

Prerequisites

  • Python 3.10 or higher

  • Git (for development)

  • Claude Desktop or Claude Code CLI

Installation Methods

pip install uaar-university-mcp

Method 2: Using uv (Modern Python Package Manager)

uv add uaar-university-mcp

Method 3: Local Development Setup

# Clone the repository git clone https://github.com/uaar-university/uaar-university-mcp.git cd uaar-university-mcp # Install dependencies pip install -e . # Or with uv: uv pip install -e . # Copy environment template cp .env.example .env # Edit .env with your configuration

šŸ–„ļø Usage

Running the MCP Server

Stdio Mode (Claude Code CLI Integration)

python -m server.cli

This mode is optimized for integration with Claude Code CLI and other MCP clients using stdio transport.

HTTP/SSE Mode (Alternative Transport)

python -m server.main # Server runs on http://localhost:8000

Use this mode for HTTP-based clients or testing via REST API.

Integration with Claude

Claude Desktop Configuration

Add to your claude_desktop_config.json:

{ "mcpServers": { "uaar-university": { "command": "python", "args": ["-m", "server.cli"], "cwd": "/path/to/your/uaar-university-mcp", "description": "UAAR University MCP Server - Academic resources, admissions, student services" } } }

Claude Code Configuration

Option A: PyPI Installation (Recommended) Use the included claude-code-config-pypi.json:

# Copy the configuration file to your Claude Code config directory

Option B: Local Development

{ "mcpServers": { "uaar-university": { "command": "python", "args": ["-m", "server.cli"], "cwd": "/absolute/path/to/uaar-university-mcp" } } }

Option C: Universal Configuration Use the included claude-code-config-universal.json for general-purpose setup.

Environment Configuration

  1. Create your .env file:

cp .env.example .env
  1. Configure environment variables:

DATABASE_URL=sqlite:///university.db SECRET_KEY=your-secret-key-here ALGORITHM=HS256 ACCESS_TOKEN_EXPIRE_MINUTES=30 HOST=0.0.0.0 PORT=8000 DEBUG=True

šŸ› ļø Available Tools

The server provides 53 tools organized into 17 categories:

šŸ“Š Complete Tool Reference

Category

Tools

Description

Academic Tools

6 tools

Course search, department info, merit lists, schedules

Admission System

11 tools

Admission status, multi-step forms, program info

Student Results

4 tools

Semester results, GPA calculation, transcripts

Library Services

4 tools

Book search, availability, borrowing status

Hostel Management

4 tools

Room availability, mess menu, fees, rules

Scholarship Portal

4 tools

Scholarship listing, eligibility checking

Transport Services

4 tools

Bus routes, stops, transport info

Faculty Directory

2 tools

Faculty search and profile information

Event Management

1 tool

University events and workshops

News System

1 tool

Latest announcements and news

Contact Information

5 tools

Department contacts, emergency numbers

Administrative Tools

7 tools

[Admin] Data management operations

Financial Information

1 tool

Fee structures and financial aid

Support System

1 tool

Help ticket submission

University Info

4 tools

General university information and links

Audit Logging

1 tool

Agent interaction tracking

User Management

1 tool

User profile operations

šŸ”‘ Key Tools

Academic Operations

  • search_courses(query) - Search courses by name or code

  • list_departments() - Get all university departments

  • get_merit_list(dept_id) - Get department merit rankings

  • get_class_schedule() - Get class timetables

  • get_exam_schedule() - Get exam schedules

  • get_today_classes() - Get all classes scheduled for today

Admission System

  • check_admission_status(cnic) - Check admission status by CNIC

  • start_admission_form() - Begin new admission application

  • fill_admission_field() - Step-by-step form filling

  • fill_multiple_admission_fields() - Bulk field filling

  • get_admission_form_status() - Check form completion status

  • preview_admission_form() - Review form before submission

  • confirm_and_submit_admission_form() - Final submission

  • get_available_programs() - List available academic programs

  • get_admission_requirements() - Get admission eligibility criteria

Student Services

  • get_semester_result(student_id) - Get semester academic results

  • get_cgpa(student_id) - Calculate cumulative GPA

  • calculate_gpa(grades) - Manual GPA calculator

  • get_transcript_request_info() - Information for transcript requests

  • search_library_books(query) - Search library catalog

  • check_book_availability(book_id) - Check book availability

  • check_hostel_availability() - Check hostel room availability

  • get_mess_menu(day) - Get daily mess menu

  • list_scholarships() - Browse available scholarships

  • check_scholarship_eligibility() - Check scholarship eligibility

  • get_bus_routes() - Get university bus routes

  • find_bus_stop(location) - Find nearest bus stops

Administrative Functions

  • search_faculty(query) - Search faculty members

  • get_department_contact() - Get department contact information

  • get_emergency_contacts() - Emergency contact numbers

  • list_upcoming_events() - Upcoming university events

  • get_latest_news() - Latest news and announcements

  • submit_help_ticket() - Submit IT/administrative help request

  • get_university_info() - General university information

  • get_important_links() - Important website links

  • get_fee_structure() - Program fee structures

  • log_interaction() - Log AI agent interactions (audit)

Admin Tools (Requires Admin Privileges)

  • admin_add_department() - Add new academic department

  • admin_add_course() - Add new course to catalog

  • admin_add_faculty() - Add new faculty member

  • admin_add_event() - Add university event

  • admin_add_news() - Add news announcement

  • admin_add_book() - Add library book

  • admin_add_scholarship() - Add scholarship program

šŸ—ļø Architecture & Development

Project Structure

uaar-university-mcp/ ā”œā”€ā”€ .claude/ # Claude AI configuration and documentation │ └── claude.md # Comprehensive project documentation for Claude ā”œā”€ā”€ server/ │ ā”œā”€ā”€ main.py # FastAPI application with HTTP/SSE transport │ ā”œā”€ā”€ cli.py # CLI entry point for stdio transport │ ā”œā”€ā”€ database.py # SQLite setup, queries, and seeding (441 lines) │ ā”œā”€ā”€ auth.py # JWT authentication with bcrypt hashing │ ā”œā”€ā”€ schemas.py # Pydantic models with comprehensive validation │ └── tools/ # 17 tool modules with 53 MCP tools │ ā”œā”€ā”€ __init__.py # Central tool registry │ ā”œā”€ā”€ academic_tools.py # Courses, departments, merit lists (2 tools) │ ā”œā”€ā”€ admin_tools.py # Admin data management (7 tools) │ ā”œā”€ā”€ admission_form_tools.py # Multi-step form system (8 tools) │ ā”œā”€ā”€ admission_tools.py # Admission status checking (2 tools) │ ā”œā”€ā”€ audit_tools.py # Interaction logging (1 tool) │ ā”œā”€ā”€ contact_tools.py # Department contacts (5 tools) │ ā”œā”€ā”€ event_tools.py # University events (1 tool) │ ā”œā”€ā”€ faculty_tools.py # Faculty search (1 tool) │ ā”œā”€ā”€ fee_tools.py # Fee structures (1 tool) │ ā”œā”€ā”€ hostel_tools.py # Hostel management (4 tools) │ ā”œā”€ā”€ library_tools.py # Library services (4 tools) │ ā”œā”€ā”€ news_tools.py # News system (1 tool) │ ā”œā”€ā”€ result_tools.py # Academic results (4 tools) │ ā”œā”€ā”€ scholarship_tools.py # Scholarship portal (4 tools) │ ā”œā”€ā”€ timetable_tools.py # Class/exam schedules (3 tools) │ └── transport_tools.py # Transport services (4 tools) ā”œā”€ā”€ pyproject.toml # Project metadata and dependencies ā”œā”€ā”€ .env.example # Environment variable template ā”œā”€ā”€ claude-code-config-*.json # Claude Code integration configs ā”œā”€ā”€ claude-desktop-config.json # Claude Desktop configuration └── uaar-university-mcp.json # MCP server configuration

Database Schema

The SQLite database (university.db) contains 25 tables covering:

  • Academic Data: Departments, courses, faculty, merit lists, schedules

  • Student Records: Users, results, grade points, admission forms

  • Student Services: Library books, hostel rooms, mess menu, bus routes

  • Administrative: Events, news, scholarships, help tickets

  • System Tables: Audit logs, contacts, university info, emergency contacts

Technical Architecture

  • Framework: FastMCP (MCP Python SDK) with FastAPI backend

  • Database: SQLite with auto-initialization and seeding

  • Authentication: JWT tokens with bcrypt password hashing

  • Transport: Dual-mode (stdio for CLI, HTTP/SSE for web)

  • Async Pattern: All tools implemented as async functions

  • Validation: Pydantic models for all request/response schemas

  • Error Handling: Structured error responses with context

Adding New Tools

  1. Create or modify tool module in server/tools/

  2. Define async function with proper type hints and docstring

  3. Register with decorator:

    @mcp.tool( name="tool_name", annotations={ "readOnlyHint": True, # Safe read operations "destructiveHint": False, # No destructive side effects "idempotentHint": True, # Safe to retry "openWorldHint": False # Deterministic results } ) async def tool_name(param: str) -> Dict: """Tool description for AI agents."""
  4. Add registration to module's register_*_tools() function

  5. Import and register in tools/__init__.py

Database Operations

Use helper functions from database.py:

  • query_db(sql, params=None) - For SELECT queries (returns list)

  • execute_db(sql, params=None) - For INSERT/UPDATE/DELETE (returns lastrowid)

  • init_db() - Creates all tables (called automatically)

  • seed_db() - Populates with demo data (if tables are empty)

šŸ”§ Development Guide

Setting Up Development Environment

# Clone repository git clone https://github.com/uaar-university/uaar-university-mcp.git cd uaar-university-mcp # Create virtual environment python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate # Install dependencies pip install -e . # Or using uv (recommended) uv sync uv pip install -e . # Configure environment cp .env.example .env # Edit .env with your settings

Running in Development Mode

# Stdio mode (for Claude Code testing) uv run python -m server.cli # HTTP/SSE mode (for API testing) uv run python -m server.main # Server available at http://localhost:8000 # Test endpoints curl http://localhost:8000/token \ -X POST \ -d "username=admin&password=admin"

Testing Tool Execution

# Direct MCP protocol testing python -m server.cli # Then use MCP client to invoke tools # Or test via HTTP API curl http://localhost:8000/api/departments \ -H "Authorization: Bearer YOUR_TOKEN"

🧪 Testing

Tool Testing Checklist

  1. āœ… Input Validation - Test with invalid/missing parameters

  2. āœ… Edge Cases - Empty results, pagination boundaries

  3. āœ… Error Handling - Database errors, authentication failures

  4. āœ… Performance - Response times for large datasets

  5. āœ… Integration - Test with Claude Desktop/Code

Database Testing

# Test database operations from server.database import query_db, execute_db # Test query results = query_db("SELECT * FROM departments LIMIT 5") print(f"Found {len(results)} departments") # Test insert new_id = execute_db( "INSERT INTO departments (id, name, faculty) VALUES (?, ?, ?)", ["CS", "Computer Science", "Sciences"] ) print(f"Created department with ID: {new_id}")

āš™ļø Configuration Reference

Environment Variables

Variable

Default

Description

DATABASE_URL

sqlite:///university.db

Database connection string

SECRET_KEY

your-secret-key-here

JWT signing secret

ALGORITHM

HS256

JWT algorithm

ACCESS_TOKEN_EXPIRE_MINUTES

30

Token expiration time

HOST

0.0.0.0

Server host binding

PORT

8000

Server port

DEBUG

True

Debug mode flag

MCP Configuration Files

  • claude-desktop-config.json: Claude Desktop integration

  • claude-code-config-pypi.json: PyPI installation for Claude Code

  • claude-code-config-universal.json: Universal configuration

  • uaar-university-mcp.json: MCP server definition for uv launcher

šŸ“ˆ Performance & Security

Performance Optimization

  1. Pagination: All list endpoints support pagination (limit, offset)

  2. Database Indexing: Critical fields indexed for fast queries

  3. Connection Management: Lightweight connection per query (MVP approach)

  4. Async Operations: Non-blocking tool execution

Security Considerations

  1. JWT Tokens: 30-minute expiration prevents token reuse

  2. Password Hashing: bcrypt with salt for secure storage

  3. SQL Injection Prevention: Parameterized queries throughout

  4. Input Validation: Pydantic models validate all inputs

  5. Admin Protection: Admin tools marked with destructiveHint=True

  6. Audit Logging: All agent interactions logged via log_interaction()

Production Deployment

For production deployment, consider:

  1. Use PostgreSQL instead of SQLite for scalability

  2. Environment Variables for all secrets

  3. Connection Pooling for database connections

  4. Rate Limiting on API endpoints

  5. CORS Configuration for web clients

  6. Logging & Monitoring setup

  7. Docker Containerization for consistency

šŸ¤ Contributing

We welcome contributions! Here's how you can help:

Reporting Issues

  • Check existing issues before creating new ones

  • Include detailed reproduction steps

  • Provide relevant error messages and logs

Submitting Pull Requests

  1. Fork the repository

  2. Create a branch for your feature/fix

  3. Write tests for your changes

  4. Ensure code style matches existing patterns

  5. Update documentation as needed

  6. Submit PR with clear description

Code Standards

  • Type Hints: All functions must have complete type annotations

  • Docstrings: Include descriptive docstrings for all tools

  • Async Patterns: Use async/await consistently

  • Error Handling: Return structured error dictionaries

  • Testing: Include tests for new functionality

šŸ“š Resources & References

Documentation

University Resources

šŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for complete details.

Permissions

  • āœ… Commercial use

  • āœ… Modification

  • āœ… Distribution

  • āœ… Private use

Conditions

  • ā— Include original copyright notice

  • ā— Include license copy

Limitations

  • āš ļø No warranty

  • āš ļø No liability

šŸ™ Acknowledgments

Core Technologies

Inspiration

  • UAAR University Digital Transformation: Inspired by the university's commitment to educational technology

  • Open Source Education Tools: Building on the tradition of open educational resources

  • AI-Assisted Learning: Advancing the integration of AI in educational administration

Contributors

  • The UAAR University IT Department for their vision and support

  • Open source contributors who help improve the project

  • The MCP community for developing this revolutionary protocol

Special Thanks

To the students, faculty, and staff of PMAS Arid Agriculture University Rawalpindi for inspiring this project and for their dedication to educational excellence.


Made with ā¤ļø for the UAAR University community

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SARAMALI15792/InstituaionMCPServer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server