Excel MCP Server
Enables AI-powered employee data management in Excel files, automatically classifying employees by department, designation, and salary band based on experience and role, with automatic data validation and backup capabilities.
README
Excel MCP Server & Employee Classification Agent
An MCP (Model Context Protocol) server with an AI agent that automatically classifies employees in Excel files based on their experience, role, and other attributes.
šļø Architecture
This project consists of two main components:
- MCP Server (
mcp_server/): Exposes Excel operations as MCP tools - AI Agent (
agent/): Uses OpenAI to make intelligent decisions about employee classifications
How It Works
- The agent connects to the MCP server via stdio
- Scans ALL employee rows from Excel (comprehensive scanning)
- Calculates/updates Experience_Years from DOJ automatically
- Uses GPT-4o-mini to analyze each employee and decide:
- Department: Web, AI, HR, Finance, or Operations
- Designation: Intern, Junior, Senior, or Lead (auto-updates as experience grows)
- Salary_Band: L1, L2, or L3
- Fills empty cells and updates outdated values automatically
- Applies decisions back to Excel with confidence scores and reasoning
š Prerequisites
- Python 3.8+
- OpenAI API key
- Excel file with employee data
š Setup
-
Clone the repository
cd excel_mcp -
Install dependencies
pip install -r requirements.txt -
Configure environment
# Create .env file (if it doesn't exist) # Add your OPENAI_API_KEY: OPENAI_API_KEY=your_openai_api_key_here -
Configure settings (optional)
- Edit
config/config.yamlto customize:- Excel file path
- OpenAI model settings
- Processing batch size
- Logging level
- Decision rules
- Edit
-
Prepare Excel file
- Place your Excel file at
data/employees_mcp.xlsx(or path in config) - Ensure it has required columns (see
mcp_server/schema.py) - The system will create backups automatically before updates
- Place your Excel file at
š» Usage
Run the Agent
Scan and process all employees (fills empty cells, updates outdated values):
python main.py
The agent will:
- Scan ALL employees (not just unprocessed)
- Calculate/update Experience_Years from DOJ
- Fill empty cells in any column
- Auto-update designations when experience changes (e.g., Junior ā Senior)
- Update any outdated values
Run MCP Server Standalone
For testing or integration with other MCP clients:
python -m mcp_server.server
š Decision Rules
The agent follows these rules:
Designation (based on Experience_Years)
- Intern: < 2 years
- Junior: 2-4 years
- Senior: 5-7 years
- Lead: 8+ years
Salary Band
- L1: Entry level (Intern, Junior with <3 years)
- L2: Mid level (Junior with 3-4 years, Senior)
- L3: Senior level (Lead, Senior with 7+ years)
Department
- Inferred from employee's Role or existing Department
- Options: Web, AI, HR, Finance, Operations
š ļø MCP Tools
The server exposes these tools:
fetch_unprocessed: Get all unprocessed employee rowsfetch_all_employees: Get ALL employee rows for comprehensive scanningapply_employee_update: Update employee data with AI decisionsupdate_experience: Recalculate experience from DOJ (MCP tool, not a script)reset_processed_flag: Reset processing flags for reprocessing
š Project Structure
excel_mcp/
āāā mcp_server/ # MCP server implementation
ā āāā server.py # MCP server with tool definitions
ā āāā tools.py # Excel operations (read/write)
ā āāā schema.py # Data validation schemas
āāā agent/ # AI agent (MCP client)
ā āāā employee_agent.py # Decision-making logic
āāā utils/ # Utility modules
ā āāā logger.py # Logging configuration
ā āāā config_loader.py # Configuration management
ā āāā backup.py # Backup functionality
āāā config/ # Configuration files
ā āāā config.yaml # Main configuration
āāā data/ # Excel data files
ā āāā employees_mcp.xlsx
āāā backups/ # Automatic backups (created automatically)
āāā logs/ # Log files (created automatically)
āāā main.py # Entry point (runs agent)
āāā requirements.txt # Python dependencies
š§ Configuration
Configuration File
Edit config/config.yaml to customize:
- Excel file path:
excel_path - OpenAI settings: Model, temperature, retry settings
- Processing settings: Batch size, backup options
- Logging: Log level, file path
- Decision rules: Experience thresholds, salary band rules
Environment Variables
OPENAI_API_KEY: Your OpenAI API key (required)EXCEL_PATH: Override Excel file path (optional)OPENAI_MODEL: Override OpenAI model (optional)
Example Configuration
excel_path: "data/employees_mcp.xlsx"
openai:
model: "gpt-4o-mini"
temperature: 0
max_retries: 3
processing:
backup_before_update: true
backup_directory: "backups"
logging:
level: "INFO"
file: "logs/mcp_server.log"
š Excel File Format
Required columns:
Emp_ID: Employee IDName: Employee nameDOJ: Date of JoiningExperience_Years: Years of experience (auto-calculated)Role: Employee roleStatus: Active/InactiveDepartment: Department (filled by agent)Designation: Designation (filled by agent)Salary_Band: Salary band (filled by agent)Is_Processed: Yes/No flagAI_Decision_Reason: Reasoning for decisionsConfidence_Score: Confidence (0.0-1.0)Last_Processed_On: Timestamp
⨠Features
- ā Automatic Backups: Creates timestamped backups before updates
- ā Comprehensive Logging: File and console logging with rotation
- ā Error Handling: Retry logic for API calls, graceful error recovery
- ā Progress Reporting: Real-time progress and summary statistics
- ā Configuration Management: YAML-based configuration
- ā Data Validation: Enforces dropdown constraints
- ā Unit Tests: Test suite for core functionality
ā ļø Notes
- The agent scans ALL employees and updates any empty or outdated fields
- Automatically updates Experience_Years from DOJ on every run
- Auto-updates designations when experience changes (e.g., Junior ā Senior)
- Automatic backups are created before updates (configurable)
- Data validation (dropdowns) is preserved after updates
- Experience is calculated as:
(Today - DOJ) / 365.25 - Logs are written to
logs/directory - Backups are stored in
backups/directory
š Troubleshooting
"Invalid row_id" error
- Ensure Excel file hasn't been manually edited
- Row IDs are positional (0-indexed)
"Invalid value" error
- Check that values match allowed dropdown values in
schema.py - Agent should only use allowed values, but manual edits might cause issues
API Key errors
- Ensure
.envfile exists withOPENAI_API_KEY - Check API key is valid and has credits
š License
[Add your license here]
š¤ Contributing
[Add contribution guidelines here]
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
E2B
Using MCP to run code via e2b.