HR MCP

HR MCP

Enables querying an HR analytics database (hr_db) using natural language, providing tools to get database schema and run read-only SQL queries for HR metrics like headcount, attrition, and payroll.

Category
访问服务器

README

HR MCP — HR Analytics MCP Server

A small, extensible MCP server that exposes an HR analytics database (hr_db) to Claude / any MCP client. Ask questions in plain English; the client reads the schema, writes SQL, and runs it.

This is the base layer — two foundational tools that make every HR question answerable today, plus a structure built for adding more tools tomorrow.

What's in the database

hr_db (MySQL 8.4, AWS RDS) — loaded from excel_files/ by load_data.py:

Table Grain Rows
employees one per employee (the hub) 100
attendance_leave employee × month 540
payroll employee × month 540
performance_reviews employee × review period 100
attrition_exit one exit event per employee 12

All five link to employees.employee_id; employees.reporting_manager_id self-references for the org chart. Every join/filter/group column is indexed.

Tools

Tool Purpose
get_db_schema Returns the full schema, join keys, and data pitfalls. Call once.
run_db_query Runs a read-only SELECT/WITH query (writes blocked, 500-row cap).

Together these answer anything — headcount, attrition by department, salary trends, attendance vs. performance, org hierarchy, etc.

Setup

pip install -r requirements.txt        # or reuse an existing venv that has `mcp`
cp .env.example .env                    # then fill in DB creds (see below)

.env:

DB_HOST=<rds-endpoint>
DB_USER=<user>
DB_PASSWORD=<password>
DB_NAME=hr_db
DB_PORT=3306

Load / reload the data

python load_data.py

Idempotent — creates hr_db if needed, drops & recreates the 5 tables, and reloads them from excel_files/.

Run the server

python server.py                 # stdio — for Claude Desktop
python -m mcp dev server.py      # dev inspector — browser testing

Claude Desktop config

{
  "mcpServers": {
    "hr": {
      "command": "C:/path/to/python.exe",
      "args": ["C:/Users/sathv/Desktop/HR_MCP/server.py"]
    }
  }
}

Project layout

HR_MCP/
├── excel_files/          source spreadsheets (system of record for load_data.py)
├── load_data.py          Excel -> hr_db loader (idempotent)
├── config.py             loads .env, builds the shared SQLAlchemy engine
├── adapters/
│   └── query.py          schema text + run_query() (SELECT-only, serialisation, logging)
├── tools/
│   └── query.py          get_db_schema + run_db_query (registered on the server)
├── server.py             FastMCP server; registers tool groups
└── requirements.txt

Adding a new tool (the "tomorrow" path)

The server is built so new capabilities slot in without touching existing code:

  1. Business logic → add a function in adapters/ (or a new adapter module) that calls adapters.query.run_query(...) or config.engine directly.
  2. Expose it → create tools/<name>.py:
    from mcp.server.fastmcp import FastMCP
    import adapters.mymodule as _adapter
    
    def register(mcp: FastMCP) -> None:
        @mcp.tool()
        def my_tool(arg: str) -> dict:
            """One-line description the model reads to decide when to call this."""
            return _adapter.do_something(arg)
    
  3. Wire it → in server.py, from tools import <name> and call <name>.register(mcp).

Ideas for the next layer: get_hr_dashboard (headcount / attrition / payroll KPIs), generate_excel_report, attrition_risk scoring, a dim_date + month_date upgrade for faster time-series, and enforced foreign keys.

Making queries faster

  • Every common filter/join/group column is already indexed (see load_data.py).
  • Results are capped at 500 rows to keep payloads small.
  • Add composite indexes for specific hot query shapes as they emerge, e.g. INDEX (department, month) patterns via a covering table/view.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选