Leave Manager
Leave Manager MCP Server
该项目是一个 Python MCP 服务器,用于通过 SQLite 管理员工、请假余额和请假请求。
1. 创建项目
打开 PowerShell 并创建一个项目目录:
mkdir D:\Coding\mcpserver\LeaveManager
cd D:\Coding\mcpserver\LeaveManager在 leave_manager_server 内创建一个 uv Python 项目:
uv init leave_manager_server
cd leave_manager_server
uv add "mcp[cli]>=2.1.1"该项目需要 Python 3.14 或更高版本。uv 会创建 pyproject.toml、uv.lock 以及用于运行服务器的虚拟环境。
Related MCP server: leave_manager
2. 实现服务器
创建 server.py 并添加以下部分:
从
mcp.server.mcpserver导入MCPServer。使用
MCPServer("Leave Manager")创建服务器。定义
Employee和LeaveRequest数据模型。使用绝对路径在
server.py旁边创建一个 SQLite 数据库。初始化
employees和leave_requests表,并在启动时插入示例数据。为员工目录和请假请求添加资源。
添加工具以提交和审批请假、检查余额、列出待审批事项、获取数据库统计信息以及添加员工。
从
__main__块启动服务器:
if __name__ == "__main__":
init_database()
mcp.run()该项目使用 MCP 2.x。旧的 MCP 1.x 导入不适用于此依赖项:
from mcp.server.fastmcp import FastMCP可用的 MCP 2.x 写法是:
from mcp.server.mcpserver import MCPServer
mcp = MCPServer("Leave Manager")3. 直接运行服务器
从项目目录:
cd D:\Coding\mcpserver\LeaveManager\leave_manager_server
uv run server.py服务器使用标准输入/输出进行 MCP 通信,因此在 MCP 客户端连接期间它会保持运行。按 Ctrl+C 停止它。
验证模块无需启动长时间运行的服务器即可正确导入:
uv run python -c "import server; print('Server import valid')"4. 使用 MCP Inspector 进行测试
支持的开发命令是:
cd D:\Coding\mcpserver\LeaveManager\leave_manager_server
uv run mcp dev server.pyMCP Inspector 使用 Node.js。在使用最新版 Inspector 之前,请安装 Node.js 22.19.0 或更高版本。使用以下命令检查版本:
node --version
npm --version不要在这个 Python 项目目录中运行 npm i,因为它没有 package.json。如果 Inspector 报告缺少原生绑定,请清除临时 npx 缓存并重试:
Remove-Item "$env:LOCALAPPDATA\npm-cache\_npx" -Recurse -Force
uv run mcp dev server.py5. 连接 Claude Desktop
Claude Desktop 从以下位置读取其配置:
%APPDATA%\Claude\claude_desktop_config.json添加此服务器条目。如果项目存储在其他位置,请替换路径:
{
"mcpServers": {
"leave-manager": {
"command": "uv",
"args": [
"run",
"--directory",
"D:\\Coding\\mcpserver\\LeaveManager\\leave_manager_server",
"server.py"
]
}
}
}保存配置后重启 Claude Desktop。服务器在首次启动时会在 server.py 旁边创建 leave_manager.db。
可用的 MCP 功能
资源:
employees://allemployee://{employee_id}leave-requests://allleave-requests://employee/{employee_id}leave-requests://status/{status}
工具:
submit_leave_requestapprove_leave_requestcheck_leave_balanceget_p_ending_approvalsget_database_statsadd_employeeThis will add my Config file automaticuv run mcp install server.py --name "leave_manager"
Available Tools
6 toolsadd_employeeC
Add a new employee to the system with duplicate checking
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| manager | Yes | ||
| department | Yes | ||
| force_create | No | ||
| sick_leave_balance | No | ||
| annual_leave_balance | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full disclosure burden. It reveals one behavioral trait ('duplicate checking'), but does not state what happens when a duplicate is found, whether force_create bypasses that check, what permissions are needed, or whether the operation is reversible. For a mutation tool with zero annotation coverage this is thin.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with no filler. It is efficient, though its brevity borders on under-specification for a six-parameter mutation tool.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return values need not be described. But with six undocumented parameters, no annotations, and a state-changing operation, the definition leaves major gaps an agent needs before calling it safely.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% across six parameters, so the description is expected to compensate but does not. None of name, manager, department, force_create, sick_leave_balance, or annual_leave_balance are explained, and the vague 'duplicate checking' phrase never connects to force_create.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb ('Add') and resource ('employee'), which is enough to separate it from the leave-management siblings listed. However, it does not explicitly contrast itself with any sibling, so it lands just short of the top band.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no when-to-use guidance, no prerequisites, and no mention of alternatives. The agent learns what the tool does but not the context or conditions for invoking it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
approve_leave_requestD
Approve a leave request
| Name | Required | Description | Default |
|---|---|---|---|
| request_id | Yes | ||
| approver_name | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full behavioral burden, yet it discloses nothing about authorization requirements (who may approve), irreversibility of the state change, side effects such as notifications to the requester, or failure modes for already-decided requests. It only implies a mutation via the word 'Approve'.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
It is short, but that brevity reflects under-specification rather than conciseness: the single phrase duplicates the tool name and earns no additional place in the definition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a state-changing approval operation with an output schema but zero annotation coverage and zero parameter documentation, the definition omits everything an agent needs — required permissions, effect of approval, idempotency, and the meaning of both required inputs.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% for both parameters, so the description must compensate, but it says nothing about request_id (format, source, where to obtain it) or approver_name (whether it must match an authenticated identity). The two required parameters are entirely undocumented.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The text 'Approve a leave request' is a verbatim human-readable restatement of the tool name approve_leave_request, adding no scope, object detail, or distinguishing information. It does not distinguish this tool from siblings like submit_leave_request or get_pending_approvals beyond the obvious verb.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no when-to-use guidance, no prerequisites, and no reference to alternatives such as get_pending_approvals (which presumably surfaces the requests worth approving). The agent must infer the entire workflow context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
check_leave_balanceC
Check leave balance for an employee
| Name | Required | Description | Default |
|---|---|---|---|
| employee_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must disclose behavior. It only states the action; it does not mention read-only nature, permissions required, side effects, or whether it returns current or accrued balance. The output schema covers return values, but behavioral traits are absent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single front-loaded sentence with no filler. It is arguably too terse given missing guidance, but from a pure conciseness standpoint it avoids waste.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple one-param read tool, the description covers the core purpose, and the output schema handles return values. Still missing parameter semantics and usage context, leaving an agent to infer format and when to call.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0% for the single employee_id parameter. The phrase 'for an employee' merely restates the parameter name and adds no format, source, or validation detail (e.g., whether it is a UUID or email). It fails to compensate for the coverage gap.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb 'check' and resource 'leave balance' scoped to an employee, making the action clear. It does not explicitly differentiate from siblings like submit_leave_request or approve_leave_request, though the verb implies a read-only query.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No indication of when to use this tool versus alternatives, no prerequisites (e.g., employee must exist), and no mention of related tools. Usage is only implied by the verb.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_database_statsC
Get database statistics
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It does not clarify whether this is read-only, what scope of statistics is returned, or any performance/caching considerations, though the verb "Get" weakly implies a read.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with no filler. It is appropriately terse for a zero-parameter call, though the brevity comes at the cost of detail rather than being maximally informative.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return values need not be explained. For a zero-param read tool this is minimally adequate, but the description omits what the statistics cover, which the agent cannot recover from a generic schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool takes zero parameters, so the baseline is 4. The description correctly implies no input is required, and there are no parameter semantics to document.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a generic verb and resource ("Get database statistics"), which is understandable but essentially restates the tool name with no differentiation from siblings and no indication of which statistics or for what entity.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance on when to use this tool, what triggers it, or how it relates to the leave-management siblings. The agent must infer usage entirely.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_pending_approvalsA
Get all pending leave requests that need approval
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. 'Get all' usefully discloses an unfiltered, complete read with no parameters, but it says nothing about required permissions (approver role), scope (own team vs. all), or freshness of results. Adequate but not rich.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single, front-loaded sentence with no filler. Every word contributes to defining the resource and its scope.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple, zero-parameter read tool with an output schema (which covers return values), the description supplies enough to select and invoke it. Only minor gaps around authorization context remain.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool takes zero parameters, so per the baseline there is nothing for the description to disambiguate; the description correctly conveys that no input filtering is available.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb ('Get') and resource ('all pending leave requests that need approval'), and the name/siblings make the scope distinct from approve_leave_request or submit_leave_request. It is clear but relies on the tool name rather than explicit contrast with alternatives.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'need approval' implies the usage context (an approver looking at their queue), but there is no explicit when-to-use statement, no mention of prerequisites, and no routing toward alternatives. Usage is only implied.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
submit_leave_requestC
Submit a new leave request
| Name | Required | Description | Default |
|---|---|---|---|
| reason | Yes | ||
| end_date | Yes | ||
| leave_type | Yes | ||
| start_date | Yes | ||
| employee_id | Yes | ||
| days_requested | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure, but it only implies a mutation ('Submit') without stating permissions required, validation rules, whether approval is triggered, or what happens to existing data. It reveals that a write occurs but nothing about side effects or constraints.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The single sentence is front-loaded and free of filler, but it is under-specified relative to the tool's complexity. Brevity here functions as omission rather than efficiency, since the sentence adds almost nothing beyond the tool name.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return values need not be described, but the input side is severely under-documented: six required parameters with no schema descriptions and no annotation coverage. For a mutation tool that likely interacts with leave balances and approval workflows, the description should convey more context to prevent malformed calls.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% and there are six required parameters, yet the description adds no meaning for any of them. It does not explain formats for dates, allowable values for leave_type, the relationship between start_date/end_date and days_requested, or the employee_id semantics.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb ('Submit') and resource ('a new leave request'), making the tool's core action immediately clear. It does not explicitly differentiate itself from siblings like approve_leave_request or check_leave_balance, so an agent must rely on tool names to disambiguate.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description offers no when-to-use guidance, no prerequisites, and no mention of alternatives such as checking leave balance first. It simply restates the action, leaving the agent to infer the appropriate context without help.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
6 tool updates
v0.1.0- First observed
add_employee - First observed
approve_leave_request - First observed
check_leave_balance - First observed
get_database_stats - First observed
get_pending_approvals - First observed
submit_leave_request
TDQS
Scored across 6 tools
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.
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.
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.
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
Related MCP Connectors
Employee leave and PTO: requests, approvals, balances, who is out, and conflict checks.
Track and manage employee time off with quick balance lookups and streamlined applications. Find t…
Check shifts, time clock entries, time-off requests, swaps and availability, and manage shifts.
Read employees, leave, recruiting and reports; book or decide leave and add applicant notes.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage employee leave by checking balances, applying for leave, and viewing history via MCP tools.-
- FlicenseNot gradedqualityDmaintenanceEnables natural-language-based employee leave management including leave balance checks, leave applications, approvals, and history retrieval through an MCP-compatible client.-
- FlicenseAqualityDmaintenanceExposes employee leave-management operations (add employees, check balance, apply/cancel leave, view history) as MCP tools for AI clients like Claude Desktop to call directly.6-
- FlicenseNot gradedqualityDmaintenanceEnables managing employee information, tasks (todos), and company policies via MCP tools and resources.-