REST API交互工具

一个用于与Insperity REST API进行交互的Python包,提供获取凭证和调用API端点的功能。

  • by lwanger
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 lwanger/insperity_mcp

使用说明

Insperity MCP项目

Python包与Insiperity REST API交互。

有关如何使用该包的示例,请参阅示例文件夹。最简单的例子是:

    from dotenv import load_dotenv
    from insperity_rest_api import *

    my_client_code = 'your client code here'  

    # Get access credentials (token_dict, client_id, legal_id) to call the API endpoints
    token_dict, client_id, legal_id = get_credentials(client_code=my_client_code, legal_name_substring=None)

    # Use the access credentials to call an API endpoint
    response = get_minimal_employee_list(token_dict=token_dict, client_id=client_id, legal_id=legal_id)

注意:不要像上面那样将客户端代码放在脚本中!请参阅 examples文件夹,了解如何使用环境变量存储客户端代码。

insperity_mcp包可以在GitHub上找到:

https://github.com/lwanger/insperity_mcp

Insperity REST API端点的文档:

http://insperity.myisolved.com/rest

一切:

  • 测试Insiperity REST API
    • 获取支票详细信息(需要员工id)
    • 实现其他REST API端点
  • 使用FastMCP构建MCP服务器
  • 添加将员工资料获取到MCP的功能
  • 以NEST为例:从上次120天检查开始雇佣员工, 自上次检查以来,获取电子邮件地址并向员工发送电子邮件
  • 在本地运行:
    • 鹅?: https://block.github.io/goose/docs/goose-architecture/
    • https://blog.craigers.rocks/mcp-ollama/
    • 或者:https://github.com/Sanjaykrishnamurthy/mcp-ollama-integration
    • 或者:https://thomas.trocha.com/blog/creating-a-world-time-mcp-server-and-agent-with-a-local-ollama-llm-llama3-1-latest-on-linux/
    • 或者:https://github.com/rajeevchandra/mcp-client-server-example
    • 或者:https://medium.com/@hp/simple-mcp-tools-used-fastmcp和a-local-llm-d266b8a166bd技术
    • 或者:https://medium.com/@smrati.katiyar/在python中构建mcp服务器和客户端并使用olama-as-all-provider-dd79fe3a2b16
  • https://github.com/open-webui/open-webui

python-domainv用于管理环境变量,包括API凭据。变量, 诸如API证书之类的证书应该存储在.env文件中。Dotenv将自动加载变量 从.env文件中,它们将作为环境变量提供。环境变量 应命名如下:

  • INSPERIT_CLIENT_ID=api_CLIENT_ID
  • 保密=秘密
  • INSPERITY_USER=INSPERITY_username
  • INSPERITY_PWD=INSPERITY_username

为任何实体提供合法身份也是有用的:

  • LEGAL_ID_1=公司法人身份
  • LEGAL_ID_2=LEGAL_ID_for_company_2

Len Wanger 2025

REST问题:

  • 如何运行报告?
  • 如何向员工发送信息?(使用模板)
  • 如何为员工增加递延薪酬?