SmartHR MCP Server

SmartHR MCP Server

site icon
2025.04.06 0
Python人力资源API集成其它
SmartHR MCP Server 是一个基于 Model Context Protocol (MCP) 的服务器,专门用于与 SmartHR API 进行交互。它允许用户通过 MCP 工具管理和操作 SmartHR 中的员工、部门、职位、雇佣类型、等级等信息。该服务器提供了丰富的功能,包括数据的创建、删除、更新、查询等操作,适用于需要集成 SmartHR 数据的各种场景。
View on GitHub

Overview

基本能力

产品定位

SmartHR MCP Server 是一个用于与 SmartHR API 交互的 MCP 服务器,主要用于管理和操作 SmartHR 中的员工、部门、职位、雇佣类型、等级等信息。

核心功能

  • 数据创建:支持创建员工、部门、家族信息、雇佣形态、等级、职种、役职等。
  • 数据删除:支持删除员工、家族信息、雇佣形态、等级、职种、役职等。
  • 数据更新:支持部分更新和完全更新部门、家族信息、雇佣形态、等级、职种、役职等。
  • 数据查询:支持获取单个或多个员工、部门、家族信息、雇佣形态、等级、职种、役职等。
  • 数据列表获取:支持获取员工、部门、家族信息、雇佣形态、等级、职种、役职等的列表。
  • 数据搜索:支持搜索员工信息。
  • 员工邀请:支持邀请员工。

适用场景

  • 需要集成 SmartHR 数据的第三方应用。
  • 需要自动化管理 SmartHR 数据的场景。
  • 需要批量操作 SmartHR 数据的场景。

工具列表

  • smarthr_create_crew(): 创建员工
  • smarthr_create_department(): 创建部门
  • smarthr_create_dependent(): 创建家族信息
  • smarthr_create_employment_type(): 创建雇佣形态
  • smarthr_create_grade(): 创建等级
  • smarthr_create_job_category(): 创建职种
  • smarthr_create_job_title(): 创建役职
  • smarthr_delete_crew(): 删除员工
  • smarthr_delete_dependent(): 删除家族信息
  • smarthr_delete_employment_type(): 删除雇佣形态
  • smarthr_delete_grade(): 删除等级
  • smarthr_delete_job_category(): 删除职种
  • smarthr_delete_job_title(): 删除役职
  • smarthr_discontinue_department(): 废弃部门
  • smarthr_get_crew(): 获取员工
  • smarthr_get_department(): 获取部门
  • smarthr_get_dependent(): 获取家族信息
  • smarthr_get_employment_type(): 获取雇佣形态
  • smarthr_get_grade(): 获取等级
  • smarthr_get_job_category(): 获取职种
  • smarthr_get_job_title(): 获取役职
  • smarthr_invite_crew(): 邀请员工
  • smarthr_list_crews(): 获取员工列表
  • smarthr_list_departments(): 获取部门列表
  • smarthr_list_dependents(): 获取家族信息列表
  • smarthr_list_employment_types(): 获取雇佣形态列表
  • smarthr_list_grades(): 获取等级列表
  • smarthr_list_job_categories(): 获取职种列表
  • smarthr_list_job_titles(): 获取役职列表
  • smarthr_list_relations(): 获取续柄列表
  • smarthr_partial_update_department(): 部分更新部门
  • smarthr_partial_update_dependent(): 部分更新家族信息
  • smarthr_partial_update_employment_type(): 部分更新雇佣形态
  • smarthr_partial_update_grade(): 部分更新等级
  • smarthr_partial_update_job_category(): 部分更新职种
  • smarthr_partial_update_job_title(): 部分更新役职
  • smarthr_search_crews(): 搜索员工
  • smarthr_update_crew(): 更新员工
  • smarthr_update_department(): 更新部门
  • smarthr_update_dependent(): 更新家族信息
  • smarthr_update_employment_type(): 更新雇佣形态
  • smarthr_update_grade(): 更新等级
  • smarthr_update_job_category(): 更新职种
  • smarthr_update_job_title(): 更新役职

常见问题解答

  • 如何设置环境变量? 需要在 .env 文件中设置 SMARTHR_API_BASE_URLSMARTHR_API_KEY
  • 如何启动服务? 克隆仓库后,设置环境变量,然后启动服务。
  • 如何调试? 可以通过日志和返回的错误信息进行调试。

使用教程

使用依赖

  1. 确保已安装 Python 3.7 或更高版本。
  2. 安装依赖包: bash pip install -r requirements.txt

安装教程

  1. 克隆仓库: bash git clone https://github.com/smarthr/smarthr-mcp-server.git
  2. 进入项目目录: bash cd smarthr-mcp-server
  3. 设置环境变量: bash echo "SMARTHR_API_BASE_URL=https://app.smarthr.jp/api" > .env echo "SMARTHR_API_KEY=YOUR_SMARTHR_API_TOKEN" >> .env
  4. 安装依赖: bash pip install -r requirements.txt

调试方式

  1. 启动服务: bash python main.py
  2. 检查日志: bash tail -f logs/smarthr_mcp_server.log
  3. 测试 API: bash curl http://localhost:8000/smarthr_get_crew?crew_id=1

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。