L
Leavemanagementmcp
MCP server by ankaleshsarma
Created 11/13/2025
Updated about 1 month ago
README
Repository documentation and setup instructions
Leave Management MCP Server
Overview
This project delivers a Model Context Protocol (MCP) server called LeaveManagementSystem. It lets AI assistants such as Cursor or Claude act like an HR co-pilot: gathering leave details, validating policies, instantly approving requests, and emitting human-friendly confirmations. The server is implemented in Python with fastmcp, so it is lightweight, stateful, and easy to extend.
The Problem We Solve
- Manual leave workflows are slow. HR teams spend time collecting employee information, validating policies, and writing approval emails.
- Assistants often miss critical context. Typical AI automations trigger tools without ensuring they have all details, leading to errors or back-and-forth clarification.
- Approvals need an auditable trail. Managers want visibility into who asked for leave, how many days have been taken, and why the leave was granted.
Solution Highlights
- Structured MCP tools:
apply_leave,approve_leave,reject_leave, and theleave-statusresource expose all core HR actions as deterministic APIs. - Guardrails built in: Tool validation ensures the assistant collects
employee_id,days, and a concretereasonbefore taking action. - Auto-approval workflow: When
apply_leaveis invoked, the system automatically approves the request, updates balances, and simulates an email notification. Claude (or any MCP-aware assistant) can respond instantly without waiting for a human manager. - Live status tracking: Assistants can query
leave-status://{emp_id}to share current balances and decision history with employees.
Why This Is Cutting Edge
- Assistant-first design: Instead of exposing yet another REST API, we deliver a native MCP server tailored for LLM tooling platforms. Claude, Cursor, and future MCP clients can discover capabilities, enforce parameter contracts, and orchestrate advanced flows with minimal glue code.
- Operational safety for AI agents: Validation, policy limits, and audit trails are enforced server-side, making it safer to let autonomous agents approve leave.
- Composable HR automations: Because everything runs inside an MCP server, you can chain this with other MCP services—calendar syncing, payroll, analytics—without bespoke integrations.
- Ready for real-time collaboration: The in-memory model keeps state during the session; migrating to a database or SaaS backend is as simple as swapping out the storage layer.
Tech Stack
Core Technologies
- Python 3.11+: Modern Python with type hints for robust development
- FastMCP: High-performance MCP server framework that provides seamless integration with MCP-compatible clients
- Model Context Protocol (MCP): Standardized protocol for AI assistants to interact with external tools and resources
- uv: Fast Python package installer and dependency manager for reproducible environments
Data Layer
- Current Implementation: In-memory data structures (dictionaries and lists) for rapid prototyping and development
- Production Ready: Designed with database abstraction in mind—can seamlessly connect to:
- SQLite: Lightweight, file-based database for small to medium deployments
- PostgreSQL: Enterprise-grade relational database for production environments
- MySQL/MariaDB: Alternative relational database options
- MongoDB: NoSQL option for flexible document storage
- SaaS HRIS APIs: Direct integration with existing HR management systems (Workday, BambooHR, etc.)
Integration Points
- MCP Clients: Native support for Claude Desktop, Cursor IDE, and any MCP-compatible client
- Email Notifications: Simulated email system (ready for integration with SendGrid, AWS SES, SMTP servers)
- Future Extensions: Calendar APIs, Slack/Teams webhooks, payroll systems
Development Tools
- pyproject.toml: Modern Python project configuration with dependency management
- uv.lock: Locked dependency versions for reproducible builds
Architecture At a Glance
Claude / Cursor ──► MCP Transport ──► LeaveManagementSystem (fastmcp)
├─ apply_leave() → Validates → Approves → Sends notification
├─ approve_leave() → Manual override
├─ reject_leave() → Manual override
└─ leave-status resource → Generates human-readable summaries
Data Layer (Configurable):
├─ In-Memory (Development) ──► Python dictionaries/lists
└─ Database (Production) ───► SQLite / PostgreSQL / MySQL / MongoDB / HRIS APIs
Quick Start
- Install dependencies (uses
uvfor deterministic environments):uv pip install -r pyproject.toml - Run the MCP server manually (optional):
uv run --with mcp[cli] mcp run main.py - Register the server in your MCP client (Cursor or Claude). Use the command:
C:\Users\Asus\.local\bin\uv.EXE run --with mcp[cli] mcp run C:\Users\Asus\Desktop\leavemanagementMCP\main.py - Restart your client to load the new server.
Using the Server
- Apply for leave: Collect
emp_id,days, andreason. The tool auto-approves and returns a formatted confirmation plus a simulated email notification. - Override decisions: If needed, call
approve_leaveorreject_leavemanually to adjust status. - Check status: Query
leave-status://emp001(replace with any employee) to see balances and decision history.
Extending the System
Database Integration
The system is architected to support direct database connections. You can replace the in-memory data structures with database queries:
- SQLite: Perfect for small teams, single-file database with zero configuration
- PostgreSQL/MySQL: Enterprise-ready with ACID compliance, transactions, and complex queries
- MongoDB: Document-based storage for flexible schema evolution
- HRIS APIs: Connect directly to existing HR systems (Workday, BambooHR, ADP) via REST/GraphQL APIs
Example database integration pattern:
# Replace in-memory dictionaries with database queries
employees = db.query("SELECT emp_id, name, leaves_taken FROM employees")
leave_requests = db.query("SELECT * FROM leave_requests WHERE emp_id = ?", [emp_id])
Additional Enhancements
- Authentication & Authorization: Add role-based access control (RBAC) to restrict who can approve/reject leaves
- Real Email/SMS Integration: Connect to transactional email providers (SendGrid, AWS SES) or SMS gateways (Twilio)
- Analytics & Reporting: Expose MCP resources for year-to-date summaries, team leave calendars, and policy compliance reports
- Webhook Support: Trigger external systems when leaves are approved/rejected
- Multi-tenant Support: Isolate data by organization/company for SaaS deployments
Quick Setup
Installation guide for this server
Install Package (if required)
uvx leavemanagementmcp
Cursor configuration (mcp.json)
{
"mcpServers": {
"ankaleshsarma-leavemanagementmcp": {
"command": "uvx",
"args": [
"leavemanagementmcp"
]
}
}
}