- Leave Management MCP Server
Leave Management MCP Server
This is my attempt at creating a leave management mcp server to retrieve details of employees stored in a workbook.
Content
Leave Management MCP Server
This repository contains a Model Context Protocol (MCP) server for managing employee leave in an organization. The server integrates with Excel workbooks containing employee leave data and provides tools for querying and analyzing leave records.
Table of Contents
- Prerequisites
- Project Structure
- Installation
- Configuration
- Running the Server
- Troubleshooting
- Example Queries
Prerequisites
- Python 3.9+
- UV package manager
- Claude Desktop (or another MCP client)
- Excel workbook with leave data
Project Structure
leave-management-mcp/
├── src/
│ ├── __init__.py
│ ├── config.py # Configuration settings
│ ├── leave_server.py # Main MCP server
│ ├── data_manager.py # Data processing module
│ └── models/
│ ├── __init__.py
│ └── employee.py # Employee data models
├── data/
│ └── leave_tracker.xlsx # Excel workbook with leave data
├── main.py # Entry point wrapper
├── __init__.py # Root package marker
├── requirements.txt # Dependencies
└── README.md # Project documentation
Installation
- Clone this repository:
git clone https://github.com/ItsMistahJi/itsmistahji-leave-management-mcp.git
cd leave-management-mcp
- Set up the Python environment with UV:
pip install uv
uv init .
- Install dependencies:
uv add "mcp[cli]" pandas openpyxl python-dotenv PyPDF2
Configuration
- Create a
.envfile in the project root:
DATA_DIR=/path/to/your/data/directory
EXCEL_FILE=/path/to/your/data/directory/leave_tracker.xlsx
SERVER_NAME=LeaveManagement
DEBUG_MODE=True
- Ensure your Excel workbook has the correct structure:
- A sheet named "Leaves-2025" (or modify
data_manager.pyto use your sheet name) - Columns for "Sl No", "Name", "EMP ID", "Location", and month names ("Jan", "Feb", etc.)
- A sheet named "Leaves-2025" (or modify
Running the Server
Local Development Testing
# Test the server locally
uv run python -m src.leave_server
# Install in Claude Desktop for testing
uv run mcp install src/leave_server.py --name "Leave Management"
VS Code Integration
Add this configuration to your VS Code settings:
"mcpServers": {
"LeaveManagement": {
"type": "stdio",
"command": "uv",
"args": [
"run",
"--with",
"mcp[cli],pandas,openpyxl,python-dotenv,PyPDF2",
"mcp",
"run",
"/path/to/leave-management-mcp/src/leave_server.py"
]
}
}
[
Note: Replace /path/to/leave-management-mcp with your actual project path.
Troubleshooting
"No module named 'src'" Error
This error occurs when Python can't find the 'src' package in its module search path.
Solutions:
- Add
__init__.pyfiles to make src a proper package:
touch __init__.py
touch src/__init__.py
touch src/models/__init__.py
- Modify your server script (leave_server.py) to include the path:
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(__file__))))
- Use the main.py wrapper in the root directory:
import sys
import os
sys.path.insert(0, os.path.abspath('.'))
from src.leave_server import mcp
if __name__ == "__main__":
mcp.run()
"No module named 'pandas'" Error
This occurs when the environment running your server doesn't have pandas installed.
Solutions:
- Ensure all dependencies are installed in the same environment:
uv add pandas openpyxl python-dotenv PyPDF2
- Use the
--withflag when running the server:
uv run --with "mcp[cli],pandas,openpyxl,python-dotenv,PyPDF2" mcp run src/leave_server.py
Excel Data Loading Issues
If you encounter validation errors with Excel data:
- Review and modify the
load_datafunction indata_manager.pyto match your Excel structure - Ensure the sheet name matches your Excel file
- Check column names and handle NaN values properly
Example Queries
Once your server is running, you can ask Claude:
- "Who is on leave today?"
- "Show me the leave balance for employee 12345"
- "List all employees on leave in April"
- "Get leave details for Arun S"
- "When did Jeeva Rao take leave in March?"
Finding Logs for Debugging
- Claude Desktop Logs:
- macOS:
~/Library/Logs/Claude/mcp.log - Windows:
%APPDATA%\Claude\logs\mcp.log
- macOS:
- Print Statements: Any
print()statements in your server code will appear in the logs.
⁂
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
WindsurfThe new purpose-built IDE to harness magic
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
ChatWiseThe second fastest AI chatbot™
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Amap Maps高德地图官方 MCP Server
Playwright McpPlaywright MCP server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题;
Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
CursorThe AI Code Editor
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Serper MCP ServerA Serper MCP Server
DeepChatYour AI Partner on Desktop
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Tavily Mcp
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.