Files
lzwcai-mcp/terminal_dhr_mcp
..

Terminal DHR MCP Server

This project is an MCP (Machine Control Program) skill package that provides services for a Visitor Information Query and Registration System, as well as IoT-based door control.

Features

This server exposes several tools that can be called by an MCP Agent:

  • Visitor Management:
    • query_visitor: Queries visitor reservation records using a user ID.
    • register_visitor: Registers new visitor information into the system.
  • Door Control:
    • control_door: Opens or closes a door through an IoT API.
    • get_door_status: Retrieves the current status of a door (e.g., open, closed).

Configuration

To be used by an MCP Agent, this server requires a JSON configuration file. Create a file (e.g., mcp-server-dhr.json) with the following structure:

{
  "mcpServers": {
    "terminal-dhr-mcp": {
      "disabled": false,
      "type": "stdio",
      "timeout": 30,
      "command": "uvx",
      "args": [
        "terminal-dhr-mcp"
      ],
      "env": {
        "employeeId": "$employeeId$"
      }
    }
  }
}
  • command: The command to execute the server. uvx is used here to run the Python package.
  • args: The name of the package to run.
  • env: Environment variables passed to the server. The $employeeId$ is a placeholder that will be replaced by the MCP Agent with the actual user's ID.

The server itself is configured via environment variables, as defined in terminal_dhr_mcp/config.py. You can create a .env file in the project root to manage these settings:

# .env file
LOG_LEVEL=INFO
DHR_API_BASE_URL=http://your-dhr-api-endpoint.com
DHR_API_TOKEN=your_api_token
IOT_API_BASE_URL=http://your-iot-api-endpoint.com
IOT_API_TOKEN=your_iot_token
DOOR_ENTITY_ID=your_default_door_entity_id

Installation and Usage

  1. Install dependencies: This project uses setuptools. Install the package and its dependencies using pip.

    pip install .
    

    For development, install with the dev extras:

    pip install .[dev]
    
  2. Running the server: The server is defined as a script in pyproject.toml. You can run it directly via:

    terminal-dhr-mcp
    

    However, it is intended to be launched by an MCP Agent using the JSON configuration file described above.