Integrating-MCP-with-Claude-Desktop-on-Windows
This guide explains how to integrate an MCP-based Python service with Claude Desktop on Windows, specifically for handling leave management operations. It details the necessary steps for installation of required packages and project structure. Users can check employee leave balances, apply for leave on specific dates, and more.
GitHub Stars
5
User Rating
Not Rated
Favorites
0
Views
17
Forks
0
Issues
0
README
Integrating MCP with Claude Desktop on Windows
Model Context Protocol (MCP) Integration Guide
Use this guide to connect your MCP-based Python service to Claude Desktop on Windows to handle leave management operations.
📚 Table of Contents
- 🚀 Features
- 📁 Project Structure
- 📋 Prerequisites
- 🛠️ Workflow
- 🖥️ Install Claude Desktop
- 🐍 Install Python
- 📦 Install
uvPython Package Manager - 🔧 Install MCP Python SDK
- 📁 Create Project Using
uv - ▶️ Run the MCP Service
- 🧪 Sample Questions to Ask the Leave Management System
🚀 Features
- ✅ Check employee leave balance
- 📆 Apply for leave on specific dates
- 📜 View leave history
- 🙋 Personalized greeting functionality
- 🔁 Cancel approved leaves
- 👥 Add/Remove employee records
- 🧮 Calculate total leaves taken
📁 Project Structure
mcp-server/
├── main.py # MCP server logic for leave management
├── pyproject.toml # Python dependencies for the MCP server
└── README.md # Project documentation
📋 Prerequisites
- Operating System: Windows 10 or later
- Software:
- Claude Desktop
- Python 3.13+
uv(package manager)mcpPython SDK
🛠️ Workflow
- Install Claude Desktop on Windows
- Start Claude Desktop in Developer Mode
- Install Python, uv, and mcp
- Initialize a project using
uv init - Add
main.pyto the project - Run
uv run mcp install main.py - Verify and test integrated tools in Claude
🖥️ Install Claude Desktop
➤ Windows
- Download Installer:
- Visit Claude Desktop Download and click Download for Windows to get
Claude-Setup-x64.exe.
- Visit Claude Desktop Download and click Download for Windows to get
- Install Claude Desktop:
- Execute
Claude-Setup-x64.exeand follow the installation prompts.


- After installation, restart computer if required.
- After restarting computer, Claude Desktop runs in the system tray.

- Execute
- Enable Developer Mode:
- Click the ☰ menu →
Help→Enable Developer Mode - Developer tools will now be availablemenue and click on
Enable Developer Mode


- Click the ☰ menu →
🐍 Install Python
- Download Installer:
- Visit Python Download and click Download for Windows to get
python-3.13.4-amd64.exe.
- Visit Python Download and click Download for Windows to get
- Run the Installer:
- Execute
Claude-Setup-x64.exeand follow the installation prompts.


- Execute
- Verify Installation:
Open PowerShell and run the command
python --version
Check pip installation
pip --version
Upgrade pip if required
python -m pip install --upgrade pip
📦 Install uv Python package manager
uvdocumentation:Install
uv:pip install uv

Verify Installation:
- Open PowerShell and run the command
uv --version
- Open PowerShell and run the command
🔧 Install MCP Python SDK
mcpdocumentation:- Install SDK and CLI
pip install mcp pip install mcp[cli]


- Verify Installation:
- Open PowerShell and run the command
pip show mcp
📁 Create Project Using uv
uvdocumentation- Initialize uv project
uv init mcp-server cd mcp-server
- Copy main.py with leave management tools into project directory
Sample MCP Server:main.pyfrom mcp.server.fastmcp import FastMCP from typing import List from datetime import datetime # In-memory mock database # In-memory mock database with 5 sample employees employee_leaves = { "E1": {"balance": 18, "history": ["2024-12-25", "2025-01-01"]}, "E2": {"balance": 20, "history": []}, "E3": {"balance": 15, "history": ["2025-03-15", "2025-03-18"]}, "E4": {"balance": 10, "history": ["2025-02-14", "2025-04-10", "2025-05-05"]}, "E5": {"balance": 5, "history": ["2025-01-15", "2025-03-01", "2025-04-01", "2025-05-01", "2025-05-15"]} } # Create MCP server mcp = FastMCP("LeaveManager") # 1. Check Leave Balance @mcp.tool() def get_leave_balance(employee_id: str) -> str: """Check how many leave days are left for the employee""" data = employee_leaves.get(employee_id) if data: return f"{employee_id} has {data['balance']} leave days remaining." return "Employee ID not found." # 2. Apply for Leave @mcp.tool() def apply_leave(employee_id: str, leave_dates: List[str]) -> str: """Apply for leave on specified dates""" if employee_id not in employee_leaves: return "Employee ID not found." requested_days = len(leave_dates) available_balance = employee_leaves[employee_id]["balance"] if available_balance < requested_days: return f"Insufficient leave balance. Requested {requested_days}, but only {available_balance} available." employee_leaves[employee_id]["balance"] -= requested_days employee_leaves[employee_id]["history"].extend(leave_dates) return f"Leave applied for {requested_days} day(s). Remaining balance: {employee_leaves[employee_id]['balance']}." # 3. Get Leave History @mcp.tool() def get_leave_history(employee_id: str) -> str: """Retrieve leave history of an employee""" data = employee_leaves.get(employee_id) if data: history = ', '.join(data['history']) if data['history'] else "No leaves taken." return f"Leave history for {employee_id}: {history}" return "Employee ID not found." # 4. Cancel Leave @mcp.tool() def cancel_leave(employee_id: str, cancel_dates: List[str]) -> str: """Cancel previously applied leave dates""" if employee_id not in employee_leaves: return "Employee ID not found." history = employee_leaves[employee_id]["history"] cancelled = [date for date in cancel_dates if date in history] if not cancelled: return "None of the specified dates were found in leave history." for date in cancelled: history.remove(date) employee_leaves[employee_id]["balance"] += 1 return f"Cancelled {len(cancelled)} day(s). New balance: {employee_leaves[employee_id]['balance']}." # 5. Check if a Date is on Leave @mcp.tool() def is_on_leave(employee_id: str, date: str) -> str: """Check if an employee is on leave for a specific date""" if employee_id not in employee_leaves: return "Employee ID not found." return "Yes" if date in employee_leaves[employee_id]["history"] else "No" # 6. Total Leaves Taken @mcp.tool() def total_leaves_taken(employee_id: str) -> str: """Get the total number of leave days taken by the employee""" if employee_id not in employee_leaves: return "Employee ID not found." return f"{employee_id} has taken {len(employee_leaves[employee_id]['history'])} leave day(s)." # 7. Set Leave Balance @mcp.tool() def set_leave_balance(employee_id: str, new_balance: int) -> str: """Set a new leave balance for an employee (admin use)""" if employee_id not in employee_leaves: return "Employee ID not found." employee_leaves[employee_id]["balance"] = new_balance return f"{employee_id}'s leave balance updated to {new_balance} day(s)." # 8. Add New Employee @mcp.tool() def add_employee(employee_id: str, initial_balance: int = 20) -> str: """Add a new employee to the leave management system""" if employee_id in employee_leaves: return "Employee ID already exists." employee_leaves[employee_id] = {"balance": initial_balance, "history": []} return f"Employee {employee_id} added with {initial_balance} leave day(s)." # 9. Remove Employee @mcp.tool() def remove_employee(employee_id: str) -> str: """Remove an employee from the system""" if employee_id not in employee_leaves: return "Employee ID not found." del employee_leaves[employee_id] return f"Employee {employee_id} removed from system." # 10. List All Employees @mcp.tool() def list_all_employees() -> str: """List all employee IDs currently in the system""" return "Employees: " + ", ".join(employee_leaves.keys()) # Greeting Resource @mcp.resource("greeting://{name}") def get_greeting(name: str) -> str: """Get a personalized greeting""" return f"Hello, {name}! How can I assist you with leave management today?" if __name__ == "__main__": mcp.run()
▶️ Run the MCP service
- Run mcp server using
main.pyfile:uv run mcp install main.py
- Verify the MCP tools:
- This will configure and register tools with Claude
- Restart Claude Desktop (Quit & Open) and verify in Tools Panel
- You should see LeaveManager and all listed tools



- Verify the MCP server configuration:


🧪 Sample Questions to Ask the Leave Management System
- How many leave days are left for employee E1?
- What are the exact dates when E1 took leaves?
- Please apply for leave on July 4th for employee E2.
- How many leave days are remaining for E2 after that?
- List all the days E2 has taken off.
- Cancel E5’s leave on May 1st.
- Is E4 on leave on April 10th?"
- Add a new employee with ID E6 and 25 leave days.
- Update E3’s leave balance to 12 days.
- Show me the list of all employees in the system.
