Leave Management MCP Server

Leave Management MCP Server

Enables HR teams to query and manage employee leave through natural language using Claude Desktop, with tools for checking balances, applying leave, and viewing history.

Category
访问服务器

README

Leave Management MCP Server

An AI-powered leave management assistant built using Anthropic's Model Context Protocol (MCP). This server connects directly to Claude Desktop, enabling HR teams to query and manage employee leave through natural language — no dashboards, no forms, just conversation.


The Problem

HR teams in most organizations manage leave through static spreadsheets or rigid portals that require navigating multiple screens to answer simple questions like:

  • "How many leave days does Rahul have left?"
  • "Has Anjali taken any leave this quarter?"
  • "Apply 2 days of leave for Karan on April 17th and 18th"

These systems are slow, require training, and don't scale well for HR managers handling large teams.


The Solution

This project exposes leave management operations as MCP tools that Claude can call in real time. HR can simply open Claude Desktop and ask questions in plain English — Claude intelligently decides which tool to call, passes the right parameters, and returns a human-readable answer.

No UI. No SQL. No form submissions. Just conversation.


Demo

Check leave balance:

"What is the leave balance for E003?" → Rahul Verma has 15 leave days remaining.

Apply for leave:

"Apply leave for E007 on 2025-07-10 and 2025-07-11" → Leave applied for 2 day(s). Remaining balance: 17.

View leave history:

"Show me the leave history for E006" → Leave history for E006: 2024-12-31, 2025-01-02, 2025-01-03, ...


Tech Stack

Layer Technology
AI Client Claude Desktop
Protocol Model Context Protocol (MCP)
Server Framework FastMCP (Python)
Package Manager uv
Language Python 3.11
Data Layer In-memory JSON (mock database)

Architecture

Claude Desktop (MCP Client)
        │
        │  MCP Protocol (stdio transport)
        ▼
  FastMCP Server — main.py
        │
        ├── Tool: get_leave_balance(employee_id)
        ├── Tool: apply_leave(employee_id, leave_dates)
        ├── Tool: get_leave_history(employee_id)
        └── Resource: greeting://{name}
              │
              ▼
    In-memory employee_leaves dictionary

How it works end-to-end:

  1. HR types a natural language query in Claude Desktop
  2. Claude identifies the right MCP tool based on the query
  3. Claude calls the tool with extracted parameters
  4. The Python function runs and returns the result
  5. Claude presents the result in a conversational response

Project Structure

my_mcp/
├── main.py              # MCP server — all tools and resources defined here
├── pyproject.toml       # Project metadata and dependencies
├── uv.lock              # Locked dependency versions for reproducibility
└── README.md            # This file

Getting Started

Prerequisites

Setup

# Clone the repo
git clone <your-repo-url>
cd my_mcp

# Install dependencies
uv sync

# Install the server into Claude Desktop
uv run mcp install main.py

# Restart Claude Desktop
# The LeaveManager tools will now appear in Claude

Mock Data

The server comes pre-loaded with 10 employees:

ID Name Leave Balance
E001 Amit Sharma 18 days
E002 Priya Mehta 20 days
E003 Rahul Verma 15 days
E004 Sneha Iyer 17 days
E005 Karan Patel 20 days
E006 Anjali Singh 12 days
E007 Vikram Nair 19 days
E008 Deepa Pillai 16 days
E009 Rohan Gupta 20 days
E010 Meera Joshi 11 days

Each employee starts with 20 days. Balance reflects days already taken.


MCP Tools Exposed

get_leave_balance

Returns the remaining leave balance for an employee.

  • Input: employee_id (string)
  • Output: Remaining days as a string

apply_leave

Applies leave for specific dates, deducting from balance and recording in history.

  • Input: employee_id (string), leave_dates (list of date strings)
  • Output: Confirmation with updated balance

get_leave_history

Returns all leave dates taken by an employee.

  • Input: employee_id (string)
  • Output: Comma-separated list of dates

What This Demonstrates

  • MCP Server Development — Building a production-pattern MCP server using FastMCP, exposing typed tools and resources that an AI client can discover and invoke
  • AI Tool Integration — Understanding how LLMs interact with external tools via structured protocols, including tool discovery, parameter extraction, and response handling
  • Python Project Structure — Using uv for dependency management, virtual environments, and reproducible builds with lockfiles
  • Protocol Design — Designing tool interfaces with clear docstrings that serve as tool descriptions for the LLM, following the principle that the docstring IS the API contract in MCP

Next Steps / Roadmap

  • [ ] Replace in-memory dict with a real database (PostgreSQL / SQLite)
  • [ ] Add leave approval workflow (manager approval tool)
  • [ ] Add leave type support (sick, casual, annual)
  • [ ] Add employee lookup by name instead of only by ID
  • [ ] Deploy server for remote access

Author

Built by Nishant Kumar as a hands-on exploration of Anthropic's Model Context Protocol and AI tool integration patterns.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选