MAYO Apollo HRM MAYO Apollo 人力資源
Released已發布MCP Server for MAYO Apollo HRM — 33 AI-callable tools for people, attendance, and payroll via Model Context Protocol
MAYO Apollo 人力資源 MCP Server,提供 AI 代理透過自然語言存取相關資料與功能。
Features功能特色
- 33 tools — 28 thin wrappers around every MAYO Apollo endpoint plus 5 semantic compositions
- Three backend domains — Foundation, Attendance, Payroll — served from one MCP server with a single
hrmlicenseAPI key - Date-format normalization — callers use ISO
YYYY-MM-DD/YYYY-MM; the server converts to each endpoint's expected format internally - Semantic aggregations — one-call helpers like
get_employee_profile,get_organization_snapshot_as_of,get_attendance_summary - Typed with Pydantic — every parameter has a description the AI can see
- E2E test runner — exercises every registered tool against the live PRE environment
- 33 個工具 — 28 個一對一的 endpoint 包裝 + 5 個語意化組合工具
- 三個後端網域 — Foundation / Attendance / Payroll 用同一把
hrmlicenseAPI key 就能存取 - 日期格式自動轉換 — 呼叫端用 ISO
YYYY-MM-DD/YYYY-MM,內部轉成各 endpoint 要求的格式 - 語意化聚合 — 例如
get_employee_profile、get_organization_snapshot_as_of、get_attendance_summary一次回應完整資訊 - Pydantic 型別 — 每個參數都有 AI 可讀的描述
- E2E 測試 — 對著 PRE 環境跑完所有工具
Available Tools可用工具
Semantic (recommended for AI use)
| Tool | What it does |
|---|---|
get_employee_profile |
One employee's PA + work history + education in a single call |
get_organization_snapshot_as_of |
Org tree + active headcount for a date |
get_attendance_summary |
History + abnormal + overtime + leave fan-out over a range |
search_active_employees |
list_active_employees with today as default |
get_monthly_payroll_report |
Single-month salary/bonus roster using ISO YYYY-MM |
Foundation (FD) — 15
list_active_employees ¹, list_resigned_employees ¹, get_organization_tree ¹, export_organization_with_employees, export_employees, export_departments, export_organization_full, export_employees_full, export_expatriations, export_working_history, export_education_history, export_employee_changes, export_organization_changes, export_pa_options, export_company_custom_fields
Attendance (PT) — 8
get_attendance_rules, get_attendance_history, get_attendance_abnormal, get_forgot_checkin_records, get_leave_history, get_employee_calendar, get_overtime_records, get_trip_history ²
Payroll (PY) — 5
get_monthly_labor_insurance ², get_monthly_nhi ², get_monthly_labor_pension ², get_salary_insurance_detail, get_salary_bonus_list
¹ The three /ClientOut/ReportCenter/* routes (plus the two semantic wrappers search_active_employees and get_organization_snapshot_as_of that depend on them) currently return 404 on the PRE Foundation backend. The tools stay exposed so they work the moment MAYO redeploys these endpoints.
² Flagged as failing upstream in MAYO's own Postman collection. Same story — tool stays, docstring carries a KNOWN ISSUE note.
語意化工具 (AI 優先使用)
| 工具 | 功能 |
|---|---|
get_employee_profile |
一次拿到一位員工的 PA + 工作經歷 + 學歷 |
get_organization_snapshot_as_of |
指定日期的組織樹 + 在職名單 |
get_attendance_summary |
一次取回區間的出勤/異常/加班/請假 |
search_active_employees |
預設以今天為基準的在職名單 |
get_monthly_payroll_report |
以 ISO YYYY-MM 取單月薪資發放清冊 |
人事 Foundation (FD) — 15
list_active_employees ¹、list_resigned_employees ¹、get_organization_tree ¹、export_organization_with_employees、export_employees、export_departments、export_organization_full、export_employees_full、export_expatriations、export_working_history、export_education_history、export_employee_changes、export_organization_changes、export_pa_options、export_company_custom_fields
差勤 Attendance (PT) — 8
get_attendance_rules、get_attendance_history、get_attendance_abnormal、get_forgot_checkin_records、get_leave_history、get_employee_calendar、get_overtime_records、get_trip_history ²
薪資勞健保 Payroll (PY) — 5
get_monthly_labor_insurance ²、get_monthly_nhi ²、get_monthly_labor_pension ²、get_salary_insurance_detail、get_salary_bonus_list
¹ 三支 /ClientOut/ReportCenter/* (加上依賴它們的語意化工具 search_active_employees / get_organization_snapshot_as_of) 目前在 PRE Foundation 後端會回 404,工具仍保留以便 MAYO 補上該環境路由後立即生效。
² 在 MAYO 官方 Postman collection 中被標註為伺服器端已報錯的 endpoint。本專案仍保留包裝,當 MAYO 修復後立即可用;docstring 內會看到 KNOWN ISSUE 標示。
Contributing貢獻
See CONTRIBUTING.md.
請見 CONTRIBUTING.md。
License授權
MIT — see LICENSE.
MIT — 詳見 LICENSE。
PrerequisitesPrerequisites
- Python 3.10+
uv(recommended) orpip- A MAYO-issued
hrmlicenseAPI key with read access to the FD / PT / PY backends you plan to call
- Python 3.10+
uv(建議) 或pip- MAYO 核發的
hrmlicenseAPI key,且具備 FD / PT / PY 所需的讀取權限
InstallInstall
From source (current state)
git clone https://github.com/asgard-ai-platform/mcp-mayo.git
cd mcp-mayo
uv sync
cp .env.example .env
# Edit .env and set MAYO_API_KEY
From PyPI (once published)
uv add mcp-mayo
# or
pip install mcp-mayo
從原始碼 (目前狀態)
git clone https://github.com/asgard-ai-platform/mcp-mayo.git
cd mcp-mayo
uv sync
cp .env.example .env
# 編輯 .env,填入 MAYO_API_KEY
從 PyPI (發佈後)
uv add mcp-mayo
# 或
pip install mcp-mayo
ConfigurationConfiguration
| Env var | Required | Purpose |
|---|---|---|
MAYO_API_KEY |
Yes | The token value placed on the hrmlicense header; authenticates Foundation, Attendance, and Payroll in a single credential |
| 環境變數 | 必要 | 用途 |
|---|---|---|
MAYO_API_KEY |
是 | 放在 hrmlicense header 的金鑰;單一憑證即可存取 FD / PT / PY |
UsageUsage
Run locally
uv run --env-file .env python mcp_server.py
Claude Desktop
{
"mcpServers": {
"mayo": {
"command": "uvx",
"args": ["mcp-mayo"],
"env": {
"MAYO_API_KEY": "your_hrmlicense_token"
}
}
}
}
Claude Code (.mcp.json)
{
"mcpServers": {
"mayo": {
"command": "uv",
"args": ["run", "mcp-mayo"],
"cwd": "${PWD}",
"env": {
"PYTHONPATH": "${PWD}",
"MAYO_API_KEY": "${MAYO_API_KEY}"
}
}
}
}
Cursor / other IDEs
Point the MCP client at uvx mcp-mayo with MAYO_API_KEY in its environment.
本機執行
uv run --env-file .env python mcp_server.py
Claude Desktop
{
"mcpServers": {
"mayo": {
"command": "uvx",
"args": ["mcp-mayo"],
"env": {
"MAYO_API_KEY": "your_hrmlicense_token"
}
}
}
}
Claude Code (.mcp.json)
{
"mcpServers": {
"mayo": {
"command": "uv",
"args": ["run", "mcp-mayo"],
"cwd": "${PWD}",
"env": {
"PYTHONPATH": "${PWD}",
"MAYO_API_KEY": "${MAYO_API_KEY}"
}
}
}
}
Cursor / 其他 IDE
讓 MCP client 以 uvx mcp-mayo 啟動,並在環境中提供 MAYO_API_KEY。
Usage ExamplesUsage Examples
"Who was active in department C030010 yesterday?"
You: 昨天 C030010 部門還在職的人列一下
AI calls:
search_active_employees(
dept_code = "C030010",
)
Result: SUCCESS — returns the active-employee list from the Foundation backend with today as the effective date.
"Give me A00384's full profile"
You: 給我員編 A00384 的完整資料
AI calls:
get_employee_profile(
employee_number = "A00384",
)
Result: SUCCESS — aggregates /PA, /Working, and /Education, locally filtered to A00384.
"Attendance picture for the first week of September"
You: 9/1 到 9/7 的出勤統計,含異常跟加班
AI calls:
get_attendance_summary(
start_date = "2025-09-01",
end_date = "2025-09-07",
)
Result: SUCCESS — returns history, abnormal, overtime, and leave sections for the range.
"January salary roster"
You: 2025-01 的薪資發放清冊
AI calls:
get_monthly_payroll_report(
year_month = "2025-01",
)
Result: SUCCESS — converts to 2025/01 under the hood and calls SalaryBonusList.
「C030010 部門還在職的人」
You: 昨天 C030010 部門還在職的人列一下
AI 呼叫:
search_active_employees(
dept_code = "C030010",
)
結果: SUCCESS — 以今天為生效日期呼叫 Foundation 的 ActiveEmployeeData,回傳在職名單。
「員工完整資料」
You: 給我員編 A00384 的完整資料
AI 呼叫:
get_employee_profile(
employee_number = "A00384",
)
結果: SUCCESS — 組合 /PA + /Working + /Education,後兩者在本地 filter 到 A00384。
「9/1 到 9/7 的出勤統計」
You: 9/1 到 9/7 的出勤統計,含異常跟加班
AI 呼叫:
get_attendance_summary(
start_date = "2025-09-01",
end_date = "2025-09-07",
)
結果: SUCCESS — 回傳該區間的出勤/異常/加班/請假各區塊。
「單月薪資清冊」
You: 2025-01 的薪資發放清冊
AI 呼叫:
get_monthly_payroll_report(
year_month = "2025-01",
)
結果: SUCCESS — 內部轉成 2025/01 呼叫 SalaryBonusList。
ArchitectureArchitecture
stdio (JSON-RPC 2.0)
→ mcp_server.py entry point; imports tool modules
→ app.py FastMCP("mcp-mayo") singleton
→ tools/ @mcp.tool() decorated functions
foundation_tools.py 15 FD wrappers
attendance_tools.py 8 PT wrappers
payroll_tools.py 5 PY wrappers
semantic_tools.py 5 high-level compositions
→ connectors/rest_client.py retry + multi-domain URL resolution
→ auth/api_key.py builds {"hrmlicense": <MAYO_API_KEY>}
→ config/settings.py BASE_URLS + ENDPOINTS (keyed by domain)
stdio (JSON-RPC 2.0)
→ mcp_server.py 程式入口;匯入所有工具模組
→ app.py FastMCP("mcp-mayo") 單例
→ tools/ @mcp.tool() 註冊的函式
foundation_tools.py 15 個 FD 包裝
attendance_tools.py 8 個 PT 包裝
payroll_tools.py 5 個 PY 包裝
semantic_tools.py 5 個語意化組合
→ connectors/rest_client.py 重試 + 多網域 URL 解析
→ auth/api_key.py 產生 {"hrmlicense": <MAYO_API_KEY>}
→ config/settings.py BASE_URLS + ENDPOINTS (依網域分類)
TestingTesting
uv run --env-file .env python scripts/auth/test_connection.py # probes FD / PT / PY
uv run --env-file .env python tests/test_all_tools.py # runs every tool
uv run --env-file .env python scripts/auth/test_connection.py # 探測 FD / PT / PY
uv run --env-file .env python tests/test_all_tools.py # 跑全部工具