# MCP Server Setup for LLM Integration This guide explains how to set up the CRM Employee Management MCP Server to work with LLMs like Claude Desktop, Cursor, and other MCP-compatible clients. ## What is MCP? Model Context Protocol (MCP) is an open standard developed by Anthropic that allows LLMs to interact with external tools and data sources. Our CRM MCP Server exposes employee management functions as tools that LLMs can use. ## Prerequisites 1. Python 3.8+ installed 2. MCP SDK installed: `pip install git+https://github.com/modelcontextprotocol/python-sdk.git` 3. All dependencies from `requirements.txt` installed ## Installation 1. Install the MCP SDK: ```bash pip install git+https://github.com/modelcontextprotocol/python-sdk.git ``` 2. Verify installation: ```bash python3 -c "from mcp.server.stdio import stdio_server; print('MCP SDK OK')" ``` ## MCP Server Tools The CRM MCP Server exposes the following tools: 1. **list_employees** - List employees with optional filtering 2. **get_employee** - Get employee details by ID 3. **create_employee** - Create a new employee 4. **update_employee** - Update employee information 5. **delete_employee** - Delete an employee (soft delete) 6. **search_employees** - Search employees by name, email, etc. 7. **get_employee_stats** - Get employee statistics 8. **get_departments** - List all departments ## Configuration for Claude Desktop ### macOS 1. Open Claude Desktop settings 2. Navigate to the MCP servers configuration 3. Edit the configuration file (usually at `~/Library/Application Support/Claude/claude_desktop_config.json`) 4. Add the following configuration: ```json { "mcpServers": { "crm-employee-management": { "command": "python3", "args": [ "/absolute/path/to/your/project/crm_mcp_server.py" ], "env": {} } } } ``` **Important:** Replace `/absolute/path/to/your/project/` with the actual path to your project directory. ### Linux The configuration file is usually at: `~/.config/Claude/claude_desktop_config.json` ### Windows The configuration file is usually at: `%APPDATA%\Claude\claude_desktop_config.json` ## Configuration for Cursor 1. Open Cursor settings 2. Navigate to MCP settings 3. Add a new MCP server with: - Name: `crm-employee-management` - Command: `python3` - Args: `["/absolute/path/to/your/project/crm_mcp_server.py"]` ## Testing the MCP Server You can test the MCP server manually: ```bash python3 crm_mcp_server.py ``` The server communicates via stdio, so it's designed to be used by MCP clients, not directly. ## Using with LLMs Once configured, you can use natural language to interact with your CRM: **Example queries:** - "List all employees in the Engineering department" - "Show me statistics about our employees" - "Create a new employee named John Doe in the Sales department" - "Search for employees with 'engineer' in their position" - "Update employee emp-001's salary to 90000" - "What departments do we have?" The LLM will automatically use the appropriate MCP tools to fulfill your requests. ## Troubleshooting ### Import Errors If you get import errors, ensure: 1. The MCP SDK is installed: `pip install git+https://github.com/modelcontextprotocol/python-sdk.git` 2. Python can find the SDK (check `python3 -c "import mcp.server"`) ### Path Issues Make sure to use absolute paths in the configuration file, not relative paths. ### Data Store The MCP server uses the same data store as the REST API server (`crm_rest_server.py`). Both servers share the same `employees_db` dictionary, so changes made through one interface are visible in the other. ## Example Usage Once connected to Claude Desktop, you can ask: ``` "Can you show me all active employees in the Engineering department?" ``` Claude will use the `list_employees` tool with filters: - `department: "Engineering"` - `status: "active"` And return the results in a natural language format.