Skip to main content
Glama
AniketDonode

Leave Manager

by AniketDonode
README.md
# Leave Manager MCP Server

This project is a Python MCP server for managing employees, leave balances, and leave requests with SQLite.

## 1. Create the project

Open PowerShell and create a project directory:

```powershell
mkdir D:\Coding\mcpserver\LeaveManager
cd D:\Coding\mcpserver\LeaveManager
```

Create a `uv` Python project inside `leave_manager_server`:

```powershell
uv init leave_manager_server
cd leave_manager_server
uv add "mcp[cli]>=2.1.1"
```

The project requires Python 3.14 or newer. `uv` creates `pyproject.toml`, `uv.lock`, and the virtual environment used to run the server.

## 2. Implement the server

Create `server.py` and add the following parts:

1. Import `MCPServer` from `mcp.server.mcpserver`.
2. Create the server with `MCPServer("Leave Manager")`.
3. Define `Employee` and `LeaveRequest` data models.
4. Create a SQLite database next to `server.py` using an absolute path.
5. Initialize `employees` and `leave_requests` tables and insert sample data on startup.
6. Add resources for employee directories and leave requests.
7. Add tools to submit and approve leave, check balances, list pending approvals, get database statistics, and add employees.
8. Start the server from the `__main__` block:

```python
if __name__ == "__main__":
		init_database()
		mcp.run()
```

The project uses MCP 2.x. The old MCP 1.x import does not work with this dependency:

```python
from mcp.server.fastmcp import FastMCP
```

The working MCP 2.x form is:

```python
from mcp.server.mcpserver import MCPServer

mcp = MCPServer("Leave Manager")
```

## 3. Run the server directly

From the project directory:

```powershell
cd D:\Coding\mcpserver\LeaveManager\leave_manager_server
uv run server.py
```

The server uses standard input/output for MCP communication, so it stays running while an MCP client is connected. Press `Ctrl+C` to stop it.

Validate that the module imports correctly without starting the long-running server:

```powershell
uv run python -c "import server; print('Server import valid')"
```

## 4. Test with MCP Inspector

The supported development command is:

```powershell
cd D:\Coding\mcpserver\LeaveManager\leave_manager_server
uv run mcp dev server.py
```

The MCP Inspector uses Node.js. Install Node.js 22.19.0 or newer before using the latest Inspector. Check versions with:

```powershell
node --version
npm --version
```

Do not run `npm i` in this Python project directory because it has no `package.json`. If Inspector reports a missing native binding, clear the temporary `npx` cache and retry:

```powershell
Remove-Item "$env:LOCALAPPDATA\npm-cache\_npx" -Recurse -Force
uv run mcp dev server.py
```

## 5. Connect Claude Desktop

Claude Desktop reads its configuration from:

```text
%APPDATA%\Claude\claude_desktop_config.json
```

Add this server entry. Replace the path if the project is stored elsewhere:

```json
{
	"mcpServers": {
		"leave-manager": {
			"command": "uv",
			"args": [
				"run",
				"--directory",
				"D:\\Coding\\mcpserver\\LeaveManager\\leave_manager_server",
				"server.py"
			]
		}
	}
}
```

Restart Claude Desktop after saving the configuration. The server creates `leave_manager.db` beside `server.py` on its first startup.

## Available MCP features

Resources:

- `employees://all`
- `employee://{employee_id}`
- `leave-requests://all`
- `leave-requests://employee/{employee_id}`
- `leave-requests://status/{status}`

Tools:

- `submit_leave_request`
- `approve_leave_request`
- `check_leave_balance`
- `get_pending_approvals`
- `get_database_stats`
- `add_employee`

- `This will add my Config file automatic`
 uv run mcp install server.py --name "leave_manager"

TDQS

B3/5.0

Scored across 6 tools

Disambiguation5/5

Each tool has a clearly distinct action and target resource; there is no overlap between submitting, approving, checking balance, listing pending approvals, adding employees, or retrieving stats.

Naming Consistency5/5

All tool names follow a consistent snake_case verb_noun pattern (submit_leave_request, approve_leave_request, etc.), making the set predictable and easy to parse.

Tool Count5/5

Six tools is well within the typical 3-15 range for a focused domain. Each tool earns its place, though get_database_stats is somewhat generic.

Completeness3/5

The leave lifecycle lacks key operations like reject_leave_request, cancel_leave_request, or get_leave_history. Approval without rejection is a notable gap, and employee management only supports addition.

Maintenance

ActivityMaintained
ResponsivenessNo issues